summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-02-08 11:51:21 -0500
committerChris Michael <cp.michael@samsung.com>2017-02-08 11:54:07 -0500
commit4b2188103d22b591a062c25c5154636bac727616 (patch)
tree840c7dda6e57edd5a6070f667abb5650e37946ba
parent62a22fd401128affb4f9bdca6d6db35a90dd6e19 (diff)
ecore-wl2: Don't send focus in/out events based on keyboard enter/leave
We should not be sending focus events based on keyboard behaviour, but rather send them according to xdg shell activate status. This makes our focus behaviour more "standards" compliant. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c29
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c19
3 files changed, 33 insertions, 18 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 96665b9091..636ddf93ba 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -408,10 +408,14 @@ _ecore_wl2_input_mouse_up_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window,
408 _input_event_cb_free, ev->dev); 408 _input_event_cb_free, ev->dev);
409} 409}
410 410
411static void 411void
412_ecore_wl2_input_focus_in_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window) 412_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
413{ 413{
414 Ecore_Wl2_Event_Focus_In *ev; 414 Ecore_Wl2_Event_Focus_In *ev;
415 Ecore_Wl2_Input *input;
416
417 input = ecore_wl2_window_input_get(window);
418 if (!input) return;
415 419
416 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In)); 420 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_In));
417 if (!ev) return; 421 if (!ev) return;
@@ -423,10 +427,14 @@ _ecore_wl2_input_focus_in_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window)
423 ev->dev); 427 ev->dev);
424} 428}
425 429
426static void 430void
427_ecore_wl2_input_focus_out_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window) 431_ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window)
428{ 432{
429 Ecore_Wl2_Event_Focus_Out *ev; 433 Ecore_Wl2_Event_Focus_Out *ev;
434 Ecore_Wl2_Input *input;
435
436 input = ecore_wl2_window_input_get(window);
437 if (!input) return;
430 438
431 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out)); 439 ev = calloc(1, sizeof(Ecore_Wl2_Event_Focus_Out));
432 if (!ev) return; 440 if (!ev) return;
@@ -846,15 +854,12 @@ _keyboard_cb_enter(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
846 854
847 input->focus.keyboard = window; 855 input->focus.keyboard = window;
848 window->input = input; 856 window->input = input;
849
850 _ecore_wl2_input_focus_in_send(input, window);
851} 857}
852 858
853static void 859static void
854_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface) 860_keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, struct wl_surface *surface EINA_UNUSED)
855{ 861{
856 Ecore_Wl2_Input *input; 862 Ecore_Wl2_Input *input;
857 Ecore_Wl2_Window *window;
858 863
859 input = data; 864 input = data;
860 if (!input) return; 865 if (!input) return;
@@ -866,13 +871,6 @@ _keyboard_cb_leave(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigne
866 input->repeat.time = 0; 871 input->repeat.time = 0;
867 if (input->repeat.timer) ecore_timer_del(input->repeat.timer); 872 if (input->repeat.timer) ecore_timer_del(input->repeat.timer);
868 input->repeat.timer = NULL; 873 input->repeat.timer = NULL;
869
870 /* find the window which this surface belongs to */
871 window = _ecore_wl2_display_window_surface_find(input->display, surface);
872 if (!window) return;
873
874 _ecore_wl2_input_focus_out_send(input, window);
875
876 input->focus.keyboard = NULL; 874 input->focus.keyboard = NULL;
877} 875}
878 876
@@ -1582,7 +1580,6 @@ ecore_wl2_input_seat_get(Ecore_Wl2_Input *input)
1582EAPI Ecore_Wl2_Seat_Capabilities 1580EAPI Ecore_Wl2_Seat_Capabilities
1583ecore_wl2_input_seat_capabilities_get(Ecore_Wl2_Input *input) 1581ecore_wl2_input_seat_capabilities_get(Ecore_Wl2_Input *input)
1584{ 1582{
1585
1586 Ecore_Wl2_Seat_Capabilities cap = ECORE_WL2_SEAT_CAPABILITIES_NONE; 1583 Ecore_Wl2_Seat_Capabilities cap = ECORE_WL2_SEAT_CAPABILITIES_NONE;
1587 1584
1588 EINA_SAFETY_ON_NULL_RETURN_VAL(input, cap); 1585 EINA_SAFETY_ON_NULL_RETURN_VAL(input, cap);
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index c601e59c00..c44420ad14 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -472,6 +472,9 @@ void _ecore_wl_window_semi_free(Ecore_Wl2_Window *window);
472 472
473void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer); 473void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
474 474
475void _ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window);
476void _ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window);
477
475EAPI extern int _ecore_wl2_event_window_www; 478EAPI extern int _ecore_wl2_event_window_www;
476EAPI extern int _ecore_wl2_event_window_www_drag; 479EAPI extern int _ecore_wl2_event_window_www_drag;
477 480
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 6d50ca34c4..fb75bf5517 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -146,6 +146,11 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
146 } 146 }
147 } 147 }
148 148
149 if (win->focused)
150 _ecore_wl2_input_focus_in_send(win);
151 else
152 _ecore_wl2_input_focus_out_send(win);
153
149 win->configure_serial = serial; 154 win->configure_serial = serial;
150 if ((win->geometry.w == w) && (win->geometry.h == h)) 155 if ((win->geometry.w == w) && (win->geometry.h == h))
151 w = h = 0; 156 w = h = 0;
@@ -238,6 +243,11 @@ _zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel E
238 } 243 }
239 } 244 }
240 245
246 if (win->focused)
247 _ecore_wl2_input_focus_in_send(win);
248 else
249 _ecore_wl2_input_focus_out_send(win);
250
241 win->configure_serial = wl_display_get_serial(win->display->wl.display); 251 win->configure_serial = wl_display_get_serial(win->display->wl.display);
242 if ((win->geometry.w == width) && (win->geometry.h == height)) 252 if ((win->geometry.w == width) && (win->geometry.h == height))
243 width = height = 0; 253 width = height = 0;
@@ -1298,11 +1308,16 @@ ecore_wl2_window_input_get(Ecore_Wl2_Window *window)
1298 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); 1308 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
1299 EINA_SAFETY_ON_NULL_RETURN_VAL(window->display, NULL); 1309 EINA_SAFETY_ON_NULL_RETURN_VAL(window->display, NULL);
1300 1310
1301 if (window->input) return window->input; 1311 if (window->input)
1312 return window->input;
1313 else if ((window->parent) && (window->parent->input))
1314 return window->parent->input;
1302 1315
1303 EINA_INLIST_FOREACH(window->display->inputs, input) 1316 EINA_INLIST_FOREACH(window->display->inputs, input)
1304 { 1317 {
1305 if (input->focus.pointer) return input; 1318 if ((input->wl.pointer) || (input->wl.keyboard) ||
1319 (input->wl.touch))
1320 return input;
1306 } 1321 }
1307 1322
1308 return NULL; 1323 return NULL;