static unsigned int __watch_rid;
static bool __manual_render;
static guint __manual_render_timer;
-static Ecore_Event_Handler *__iconify_change;
static bool __is_bound = false;
-static bool __iconified = false;
static int __viewer_visibility = AUL_SCREEN_STATUS_PAUSE;
+static Ecore_Event_Handler *__pre_visibility;
static GList *__dead_cbs;
struct dead_cb_s {
}
}
-static Eina_Bool __iconify_state_changed(void *data, int type, void *event)
+static Eina_Bool __window_on_pre_visibility(void *data, int type, void *event)
{
- Ecore_Wl2_Event_Window_Iconify_State_Change *ev =
- (Ecore_Wl2_Event_Window_Iconify_State_Change *)event;
- Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(__win));
+ Ecore_Wl2_Event_Window_Pre_Visibility_Change *ev = event;
+ Ecore_Evas *ee;
+ Ecore_Wl2_Window *wl_win;
+ unsigned int win_id;
- if(ev->win !=
- ecore_wl2_window_id_get(ecore_evas_wayland2_window_get(ee)))
- return ECORE_CALLBACK_PASS_ON;
+ if (!ev)
+ return ECORE_CALLBACK_RENEW;
- LOGI("Iconify state changed, win(%d) is %s",
- ev->win,
- ev->iconified ? "iconified" : "uniconified");
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(__win));
+ if (!ee)
+ return ECORE_CALLBACK_RENEW;
- if (ev->iconified == EINA_FALSE && __iconified) {
+ wl_win = ecore_evas_wayland2_window_get(ee);
+ if (!wl_win)
+ return ECORE_CALLBACK_RENEW;
+
+ win_id = ecore_wl2_window_id_get(wl_win);
+ if (ev->win != win_id)
+ return ECORE_CALLBACK_RENEW;
+
+ if (ev && ev->type == ECORE_WL2_WINDOW_VISIBILITY_TYPE_PRE_UNOBSCURED) {
__manual_render_start();
- __iconified = false;
- } else if (ev->iconified == EINA_TRUE) {
- __iconified = true;
+ LOGD("[__WINDOW_PRE_VISIBILITY_CHANGE__] win_id(%u)",
+ (unsigned int)ev->win);
}
- return ECORE_CALLBACK_PASS_ON;
+ return ECORE_CALLBACK_RENEW;
}
static int __watch_viewer_init(Evas_Object *win)
__win_resized(NULL, NULL, win, NULL); /* init */
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, __win_resized, NULL);
- __iconify_change = ecore_event_handler_add(
- ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
- __iconify_state_changed, NULL);
+
+ __pre_visibility = ecore_event_handler_add(
+ ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
+ __window_on_pre_visibility, NULL);
+ if (!__pre_visibility)
+ _E("Failed to add pre visibility change handler");
+
__manual_render = false;
__watch_viewer_initialized = 1;
static void __watch_viewer_fini()
{
+ if (__pre_visibility) {
+ ecore_event_handler_del(__pre_visibility);
+ __pre_visibility = NULL;
+ }
+
if (__win) {
evas_object_event_callback_del(__win, EVAS_CALLBACK_RESIZE, __win_resized);
__win = NULL;
screen_connector_toolkit_evas_stop_visibility_notify();
screen_connector_toolkit_evas_fini(SCREEN_CONNECTOR_SCREEN_TYPE_WATCH);
- if (__iconify_change)
- ecore_event_handler_del(__iconify_change);
}
API int watch_manager_init(Evas_Object *win)