summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
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 /src/lib/ecore_wl2/ecore_wl2_input.c
parent5ebdf8f3414d00d54d532dcfbe0e8236d8fe9898 (diff)
wayland: send focus in/out events when receiving/losing keyboard focus
since this is typically what efl defines as "focus" @fix
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c29
1 files changed, 15 insertions, 14 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)
418 free(event); 418 free(event);
419} 419}
420 420
421void 421static void
422_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window) 422_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
423{ 423{
424 Ecore_Wl2_Event_Focus_In *ev; 424 Ecore_Wl2_Event_Focus_In *ev;
425 Ecore_Wl2_Input *input;
426
427 input = ecore_wl2_window_input_get(window);
428 if (!input) return;
429 425
430 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In)); 426 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In));
431 if (!ev) return; 427 if (!ev) return;
@@ -439,14 +435,10 @@ _ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
439 ev->dev); 435 ev->dev);
440} 436}
441 437
442void 438static void
443_ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window) 439_ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
444{ 440{
445 Ecore_Wl2_Event_Focus_Out *ev; 441 Ecore_Wl2_Event_Focus_Out *ev;
446 Ecore_Wl2_Input *input;
447
448 input = ecore_wl2_window_input_get(window);
449 if (!input) return;
450 442
451 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out)); 443 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out));
452 if (!ev) return; 444 if (!ev) return;
@@ -877,13 +869,14 @@ _keyboard_cb_enter(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
877 if (!window) return; 869 if (!window) return;
878 870
879 input->focus.keyboard = window; 871 input->focus.keyboard = window;
880 window->input = input; 872 _ecore_wl2_input_focus_in_send(window, input);
881} 873}
882 874
883static void 875static void
884_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface EINA_UNUSED) 876_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface)
885{ 877{
886 Ecore_Wl2_Input *input; 878 Ecore_Wl2_Input *input;
879 Ecore_Wl2_Window *window;
887 880
888 input = data; 881 input = data;
889 if (!input) return; 882 if (!input) return;
@@ -895,7 +888,15 @@ _keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
895 input->repeat.time = 0; 888 input->repeat.time = 0;
896 if (input->repeat.timer) ecore_timer_del(input->repeat.timer); 889 if (input->repeat.timer) ecore_timer_del(input->repeat.timer);
897 input->repeat.timer = NULL; 890 input->repeat.timer = NULL;
891 window = _ecore_wl2_display_window_surface_find(input->display, surface);
892 if (window)
893 {
894 if (input->focus.keyboard != window)
895 ERR("Received keyboard.leave when keyboard did not have enter");
896 }
898 input->focus.keyboard = NULL; 897 input->focus.keyboard = NULL;
898 if (window)
899 _ecore_wl2_input_focus_out_send(window, input);
899} 900}
900 901
901static Eina_Bool 902static Eina_Bool