classic-lite

Minimalist rewrite of Łukasz Zalewski's "classic" pebble watchface
git clone https://git.instinctive.eu/classic-lite.git
Log | Files | Refs | README | LICENSE

commit 58d9bbec84b5957d9304106ab213f52b5704b734
parent c0cf8f191fcced924cc77ecf1d196606beb3bbf9
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date:   Thu, 10 Dec 2015 17:53:13 +0000

Work around a Pebble Time Round display bug

When leaving a modal window (i.e. a notification), the watch face redraw
seems triggered correctly but most of the screen end up blank. To work
around it, I mark all the layers dirty in an app "did focus" event
(which is triggered after the faulty redraw).
Diffstat:
Msrc/classic-lite.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/classic-lite.c b/src/classic-lite.c @@ -443,6 +443,18 @@ update_text_layer(struct tm *time) { * SERVICE HANDLERS * ********************/ +#ifdef PBL_ROUND +static void +app_did_focus(bool in_focus) { + if (in_focus) { + layer_mark_dirty(background_layer); + layer_mark_dirty(hand_layer); + layer_mark_dirty(icon_layer); + layer_mark_dirty(text_layer_get_layer(text_layer)); + } +} +#endif + static void battery_handler(BatteryChargeState charge) { if (current_battery == charge.charge_percent) return; @@ -595,10 +607,18 @@ window_load(Window *window) { hand_layer = layer_create(bounds); layer_set_update_proc(hand_layer, &hand_layer_draw); layer_add_child(window_layer, hand_layer); + +#ifdef PBL_ROUND + app_focus_service_subscribe_handlers((AppFocusHandlers){ + .will_focus = 0, + .did_focus = &app_did_focus, + }); +#endif } static void window_unload(Window *window) { + app_focus_service_unsubscribe(); layer_destroy(background_layer); layer_destroy(hand_layer); layer_destroy(icon_layer);