From 05bf4eec5d10295f9a25071d1af715124f6557fc Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 26 Nov 2015 19:47:16 +0900 Subject: [PATCH] ecore wayland/ecore_evas wayland: support to handle iconify_change event Change-Id: I3afd10f6e2040c68f93ed421851bd03868461407 --- src/lib/ecore_wayland/Ecore_Wayland.h | 9 ++++++++ src/lib/ecore_wayland/ecore_wl.c | 25 ++++++++++++++++++++ .../engines/wayland/ecore_evas_wayland_common.c | 27 +++++++++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index c41595f..2263663 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -75,6 +75,7 @@ typedef struct _Ecore_Wl_Event_Selection_Data_Ready Ecore_Wl_Event_Selection_Dat typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound; typedef struct _Ecore_Wl_Event_Conformant_Change Ecore_Wl_Event_Conformant_Change; typedef struct _Ecore_Wl_Event_Aux_Hint_Allowed Ecore_Wl_Event_Aux_Hint_Allowed; +typedef struct _Ecore_Wl_Event_Window_Iconify_State_Change Ecore_Wl_Event_Window_Iconify_State_Change; enum _Ecore_Wl_Window_Type { @@ -353,6 +354,13 @@ struct _Ecore_Wl_Event_Aux_Hint_Allowed int id; }; +struct _Ecore_Wl_Event_Window_Iconify_State_Change +{ + unsigned int win; + int iconified; + int force; +}; + /** * @file * @brief Ecore functions for dealing with the Wayland window system @@ -398,6 +406,7 @@ EAPI extern int ECORE_WL_EVENT_SELECTION_DATA_READY; /** @since 1.7 */ EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND; EAPI extern int ECORE_WL_EVENT_CONFORMANT_CHANGE; EAPI extern int ECORE_WL_EVENT_AUX_HINT_ALLOWED; +EAPI extern int ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE; /** * @defgroup Ecore_Wl_Init_Group Wayland Library Init and Shutdown Functions diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index 78ec7e2..18246fa 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -47,6 +47,7 @@ static void _ecore_wl_cb_conformant_area(void *data EINA_UNUSED, struct tizen_po static void _ecore_wl_cb_notification_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, int32_t level, uint32_t state); static void _ecore_wl_cb_transient_for_done(void *data, struct tizen_policy *tizen_policy, uint32_t child_id); static void _ecore_wl_cb_scr_mode_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t mode, uint32_t state); +static void _ecore_wl_cb_iconify_state_changed(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, uint32_t iconified, uint32_t force); static void _ecore_wl_cb_supported_aux_hints(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints); static void _ecore_wl_cb_allowed_aux_hint(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, int id); static void _ecore_wl_window_conformant_area_send(Ecore_Wl_Window *win, uint32_t conformant_part, uint32_t state); @@ -96,6 +97,7 @@ static const struct tizen_policy_listener _ecore_tizen_policy_listener = _ecore_wl_cb_notification_done, _ecore_wl_cb_transient_for_done, _ecore_wl_cb_scr_mode_done, + _ecore_wl_cb_iconify_state_changed, _ecore_wl_cb_supported_aux_hints, _ecore_wl_cb_allowed_aux_hint, }; @@ -151,6 +153,7 @@ EAPI int ECORE_WL_EVENT_DATA_SOURCE_CANCELLED = 0; EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0; EAPI int ECORE_WL_EVENT_CONFORMANT_CHANGE = 0; EAPI int ECORE_WL_EVENT_AUX_HINT_ALLOWED = 0; +EAPI int ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE = 0; static void _ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t serial EINA_UNUSED) @@ -236,6 +239,7 @@ ecore_wl_init(const char *name) ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new(); ECORE_WL_EVENT_CONFORMANT_CHANGE = ecore_event_type_new(); ECORE_WL_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new(); + ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE = ecore_event_type_new(); } if (!(_ecore_wl_disp = calloc(1, sizeof(Ecore_Wl_Display)))) @@ -1382,6 +1386,27 @@ _ecore_wl_cb_scr_mode_done(void *data EINA_UNUSED, struct tizen_policy *tizen_po } static void +_ecore_wl_cb_iconify_state_changed(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, uint32_t iconified, uint32_t force) +{ + struct wl_surface *surface = surface_resource; + Ecore_Wl_Window *win = NULL; + Ecore_Wl_Event_Window_Iconify_State_Change *ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!surface) return; + win = ecore_wl_window_surface_find(surface); + if (!win) return; + + if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Window_Iconify_State_Change)))) return; + ev->win = win->id; + ev->iconified = iconified; + ev->force = force; + + ecore_event_add(ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, ev, NULL, NULL); +} + +static void _ecore_wl_cb_supported_aux_hints(void *data EINA_UNUSED, struct tizen_policy *tizen_policy EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints) { struct wl_surface *surface = surface_resource; diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 1f5b07b..758e193 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -34,7 +34,7 @@ EVAS_SMART_SUBCLASS_NEW(_smart_frame_type, _ecore_evas_wl_frame, /* local variables */ static int _ecore_evas_wl_init_count = 0; -static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[8]; +static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[9]; static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); @@ -272,6 +272,28 @@ _ecore_evas_wl_common_cb_aux_hint_allowed(void *data EINA_UNUSED, int type EINA } static Eina_Bool +_ecore_evas_wl_common_cb_window_iconify_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Window_Iconify_State_Change *ev; + + ev = event; + ee = ecore_event_window_match(ev->win); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + if (!ev->force) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + if (ee->prop.iconified == ev->iconified) + return ECORE_CALLBACK_PASS_ON; + + ee->prop.iconified = ev->iconified; + _ecore_evas_wl_common_state_update(ee); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool _ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Evas *ee; @@ -526,6 +548,9 @@ _ecore_evas_wl_common_init(void) _ecore_evas_wl_event_hdls[7] = ecore_event_handler_add(ECORE_WL_EVENT_AUX_HINT_ALLOWED, _ecore_evas_wl_common_cb_aux_hint_allowed, NULL); + _ecore_evas_wl_event_hdls[8] = + ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, + _ecore_evas_wl_common_cb_window_iconify_change, NULL); ecore_event_evas_init(); -- 2.7.4