summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-05-17 16:02:53 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-05-19 12:41:17 -0400
commit55cfc974559d6688f6fcc5b242015252659a0b7f (patch)
treec0fdac18451500497ad9024f54ce4c8e7c12be0c
parent5ebdf8f3414d00d54d532dcfbe0e8236d8fe9898 (diff)
downloadefl-55cfc974559d6688f6fcc5b242015252659a0b7f.tar.gz
wayland: send focus in/out events when receiving/losing keyboard focus
since this is typically what efl defines as "focus" @fix
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c29
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h3
2 files changed, 15 insertions, 17 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 1cd8ea8ede..324edb2faf 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -418,14 +418,10 @@ _input_event_focus_cb_free(void *data, void *event)
free(event);
}
-void
-_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
+static void
+_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
{
Ecore_Wl2_Event_Focus_In *ev;
- Ecore_Wl2_Input *input;
-
- input = ecore_wl2_window_input_get(window);
- if (!input) return;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In));
if (!ev) return;
@@ -439,14 +435,10 @@ _ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
ev->dev);
}
-void
-_ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window)
+static void
+_ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
{
Ecore_Wl2_Event_Focus_Out *ev;
- Ecore_Wl2_Input *input;
-
- input = ecore_wl2_window_input_get(window);
- if (!input) return;
ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out));
if (!ev) return;
@@ -877,13 +869,14 @@ _keyboard_cb_enter(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
if (!window) return;
input->focus.keyboard = window;
- window->input = input;
+ _ecore_wl2_input_focus_in_send(window, input);
}
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;
@@ -895,7 +888,15 @@ _keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
input->repeat.time = 0;
if (input->repeat.timer) ecore_timer_del(input->repeat.timer);
input->repeat.timer = NULL;
+ window = _ecore_wl2_display_window_surface_find(input->display, surface);
+ if (window)
+ {
+ if (input->focus.keyboard != window)
+ ERR("Received keyboard.leave when keyboard did not have enter");
+ }
input->focus.keyboard = NULL;
+ if (window)
+ _ecore_wl2_input_focus_out_send(window, input);
}
static Eina_Bool
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 65972fc097..69c066cee2 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -483,9 +483,6 @@ void _ecore_wl_window_semi_free(Ecore_Wl2_Window *window);
void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
-void _ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window);
-void _ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window);
-
EAPI extern int _ecore_wl2_event_window_www;
EAPI extern int _ecore_wl2_event_window_www_drag;