ecore-wl2: Support sending focus for wl_shell
authorChris Michael <cp.michael@samsung.com>
Wed, 8 Feb 2017 17:30:10 +0000 (12:30 -0500)
committerChris Michael <cp.michael@samsung.com>
Wed, 8 Feb 2017 17:30:10 +0000 (12:30 -0500)
wl_shell does not use a surface state for activation, so we still need
to send the focus in/out for that based on keyboard enter/leave.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wl2/ecore_wl2_input.c

index 636ddf9..4d810a6 100644 (file)
@@ -854,12 +854,16 @@ _keyboard_cb_enter(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
 
    input->focus.keyboard = window;
    window->input = input;
+
+   if (window->wl_shell_surface)
+     _ecore_wl2_input_focus_in_send(window);
 }
 
 static void
-_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface EINA_UNUSED)
+_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface)
 {
    Ecore_Wl2_Input *input;
+   Ecore_Wl2_Window *window;
 
    input = data;
    if (!input) return;
@@ -872,6 +876,11 @@ _keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
    if (input->repeat.timer) ecore_timer_del(input->repeat.timer);
    input->repeat.timer = NULL;
    input->focus.keyboard = NULL;
+
+   /* find the window which this surface belongs to */
+   window = _ecore_wl2_display_window_surface_find(input->display, surface);
+   if ((window) && (window->wl_shell_surface))
+     _ecore_wl2_input_focus_out_send(window);
 }
 
 static Eina_Bool