int viewer_visibility;
bool ambient_mode;
bool ambient_mode_skip_resume;
+ guint pause_timer;
void *data;
};
_D("viewer is not resumed, do not resume watch");
}
+static gboolean __delayed_pause(gpointer data)
+{
+ LOGW("Delayed pause");
+ __on_ui_base_pause(NULL);
+ __context.pause_timer = 0;
+ return G_SOURCE_REMOVE;
+}
+
+static void __add_pause_timer(void)
+{
+ if (__context.pause_timer == 0) {
+ _D("Add pause timer");
+ __context.pause_timer = g_timeout_add(200,
+ __delayed_pause, NULL);
+ }
+}
+
+static void __remove_pause_timer(void)
+{
+ if (__context.pause_timer) {
+ _D("Remove pause timer");
+ g_source_remove(__context.pause_timer);
+ __context.pause_timer = 0;
+ }
+}
+
static void __on_window_visibility(int type, void *event, void *data)
{
Ecore_Wl2_Event_Window_Visibility_Change *ev = event;
- _D("visibility %u %u",
- (unsigned int)ev->win,
- (unsigned int)ev->fully_obscured);
+ _D("win(%u), fully_obscured(%d)",
+ (unsigned int)ev->win, ev->fully_obscured);
if (ev->fully_obscured) {
__context.watch_visibility = WVS_PAUSE;
- __on_ui_base_pause(NULL);
+ __add_pause_timer();
} else {
+ __remove_pause_timer();
__context.watch_visibility = WVS_RESUME;
if (__context.viewer_visibility == AUL_SCREEN_STATUS_RESUME)
__on_ui_base_resume(NULL);
if (*state == AUL_SCREEN_STATUS_RESUME &&
__context.watch_visibility == WVS_RESUME) {
+ __remove_pause_timer();
__on_ui_base_resume(NULL);
} else if (*state == AUL_SCREEN_STATUS_PAUSE) {
- __on_ui_base_pause(NULL);
+ __add_pause_timer();
} else if (*state == AUL_SCREEN_STATUS_PRE_RESUME) {
+ __remove_pause_timer();
_D("call pre resume tick");
__on_pre_resume(NULL);
}
static void __lcd_on_handler(void *user_data)
{
_D("Call pre resume tick");
+ __remove_pause_timer();
__on_pre_resume(NULL);
}