ecore-wl2: Raise focus in/out events when we get wayland events for
authorChris Michael <cp.michael@samsung.com>
Wed, 23 Sep 2015 16:42:49 +0000 (12:42 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 3 Dec 2015 17:02:40 +0000 (12:02 -0500)
keyboard enter/leave

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

index f7db267..7058040 100644 (file)
@@ -214,6 +214,32 @@ _ecore_wl2_input_mouse_up_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window,
    ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
 }
 
+static void
+_ecore_wl2_input_focus_in_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window)
+{
+   Ecore_Wl2_Event_Focus_In *ev;
+
+   ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In));
+   if (!ev) return;
+
+   ev->timestamp = input->timestamp;
+   ev->window = window->id;
+   ecore_event_add(ECORE_WL2_EVENT_FOCUS_IN, ev, NULL, NULL);
+}
+
+static void
+_ecore_wl2_input_focus_out_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window)
+{
+   Ecore_Wl2_Event_Focus_Out *ev;
+
+   ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out));
+   if (!ev) return;
+
+   ev->timestamp = input->timestamp;
+   ev->window = window->id;
+   ecore_event_add(ECORE_WL2_EVENT_FOCUS_OUT, ev, NULL, NULL);
+}
+
 void
 _ecore_wl2_input_grab(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, unsigned int button)
 {
@@ -460,7 +486,7 @@ _keyboard_cb_enter(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
 
    input->focus.keyboard = window;
 
-   /* TODO: Send keyboard enter event (focus in) */
+   _ecore_wl2_input_focus_in_send(input, window);
 }
 
 static void
@@ -484,7 +510,7 @@ _keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
    window = _ecore_wl2_display_window_surface_find(input->display, surface);
    if (!window) return;
 
-   /* TODO: Send keyboard leave event (focus out) */
+   _ecore_wl2_input_focus_out_send(input, window);
 
    input->focus.keyboard = NULL;
 }