ecore-wl2: Add client-side event for Window Deactivate

This patch adds and sends a client-side event for when a window gets
deactivated.

'#divergence'

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-06-27 09:46:55 -04:00
parent 640caf1d9c
commit 2f7f232582
3 changed files with 31 additions and 1 deletions

View File

@ -309,6 +309,13 @@ typedef struct _Ecore_Wl2_Event_Window_Activate
unsigned int event_win;
} Ecore_Wl2_Event_Window_Activate;
typedef struct _Ecore_Wl2_Event_Window_Deactivate
{
unsigned int win;
unsigned int parent_win;
unsigned int event_win;
} Ecore_Wl2_Event_Window_Deactivate;
typedef enum _Ecore_Wl2_Window_Type
{
ECORE_WL2_WINDOW_TYPE_NONE,
@ -365,6 +372,7 @@ EAPI extern int ECORE_WL2_EVENT_AUX_HINT_ALLOWED; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_SHOW; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */
EAPI extern int ECORE_WL2_EVENT_WINDOW_DEACTIVATE; /** @since 1.20 */
/**
* @file

View File

@ -49,6 +49,7 @@ EAPI int ECORE_WL2_EVENT_AUX_HINT_ALLOWED = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_SHOW = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0;
EAPI int ECORE_WL2_EVENT_WINDOW_DEACTIVATE = 0;
EAPI int _ecore_wl2_event_window_www = -1;
EAPI int _ecore_wl2_event_window_www_drag = -1;
@ -128,6 +129,7 @@ ecore_wl2_init(void)
ECORE_WL2_EVENT_WINDOW_SHOW = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_HIDE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
ECORE_WL2_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new();
}
if (!no_session_recovery)
no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
@ -194,7 +196,8 @@ ecore_wl2_shutdown(void)
ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
ECORE_WL2_EVENT_WINDOW_SHOW,
ECORE_WL2_EVENT_WINDOW_HIDE,
ECORE_WL2_EVENT_WINDOW_ACTIVATE);
ECORE_WL2_EVENT_WINDOW_ACTIVATE,
ECORE_WL2_EVENT_WINDOW_DEACTIVATE);
/* shutdown Ecore_Event */
ecore_event_shutdown();

View File

@ -68,6 +68,21 @@ _ecore_wl2_window_activate_send(Ecore_Wl2_Window *window)
ecore_event_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE, ev, NULL, NULL);
}
static void
_ecore_wl2_window_deactivate_send(Ecore_Wl2_Window *window)
{
Ecore_Wl2_Event_Window_Deactivate *ev;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Deactivate));
if (!ev) return;
ev->win = window->id;
if (window->parent)
ev->parent_win = window->parent->id;
ev->event_win = window->id;
ecore_event_add(ECORE_WL2_EVENT_WINDOW_DEACTIVATE, ev, NULL, NULL);
}
static void
_xdg_popup_cb_done(void *data, struct xdg_popup *xdg_popup EINA_UNUSED)
{
@ -136,6 +151,8 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
if (win->focused)
_ecore_wl2_window_activate_send(win);
else
_ecore_wl2_window_deactivate_send(win);
}
static void
@ -229,6 +246,8 @@ _zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel E
if (win->focused)
_ecore_wl2_window_activate_send(win);
else
_ecore_wl2_window_deactivate_send(win);
}
static void