From a889f55c34a3184a6a780f76f7b7dab243222797 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 29 Jan 2015 09:54:43 -0500 Subject: [PATCH] start making e_grabinput work for wayland (nb: not finished yet) Signed-off-by: Chris Michael --- src/bin/e_grabinput.c | 55 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c index 980fde59a..16cd27690 100644 --- a/src/bin/e_grabinput.c +++ b/src/bin/e_grabinput.c @@ -41,6 +41,9 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) ecore_x_pointer_ungrab(); +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + ecore_wl_input_ungrab(ecore_wl_input_get()); #endif grab_mouse_win = 0; } @@ -49,7 +52,11 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) ecore_x_keyboard_ungrab(); +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + ecore_wl_input_ungrab(ecore_wl_input_get()); #endif + grab_key_win = 0; focus_win = 0; } @@ -65,6 +72,14 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) ret = ecore_x_pointer_grab(mouse_win); if (!ret) return 0; } +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + Ecore_Wl_Window *wl_win; + + if ((wl_win = ecore_wl_window_find(mouse_win))) + ecore_wl_input_grab(ecore_wl_input_get(), mouse_win, 0); + } #endif grab_mouse_win = mouse_win; } @@ -86,6 +101,14 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) return 0; } } +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + Ecore_Wl_Window *wl_win; + + if ((wl_win = ecore_wl_window_find(key_win))) + ecore_wl_input_grab(ecore_wl_input_get(), key_win, 0); + } #endif grab_key_win = key_win; } @@ -103,7 +126,11 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) ecore_x_pointer_ungrab(); +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + ecore_wl_input_ungrab(ecore_wl_input_get()); #endif + grab_mouse_win = 0; } if (key_win == grab_key_win) @@ -111,7 +138,11 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) ecore_x_keyboard_ungrab(); +#else + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + ecore_wl_input_ungrab(ecore_wl_input_get()); #endif + grab_key_win = 0; if (focus_win != 0) { @@ -126,7 +157,6 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) EAPI void e_grabinput_focus(Ecore_Window win, E_Focus_Method method) { - if (e_comp->comp_type != E_PIXMAP_TYPE_X) return; if (grab_key_win != 0) { /* fprintf(stderr, "while grabbed focus changed to %x\n", win); */ @@ -175,6 +205,10 @@ _e_grabinput_focus_check(void *data __UNUSED__) static void _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method) { +#ifdef HAVE_WAYLAND_ONLY + Ecore_Wl_Window *wl_win; +#endif + /* fprintf(stderr, "focus to %x method %i\n", win, method); */ switch (method) { @@ -185,27 +219,39 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method) #ifndef HAVE_WAYLAND_ONLY ecore_x_window_focus_at_time(win, ecore_x_current_time_get()); ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get()); +#else + if ((wl_win = ecore_wl_window_find(key_win))) + { + /* FIXME: Need to add an ecore_wl_window_focus function */ + } #endif break; case E_FOCUS_METHOD_GLOBALLY_ACTIVE: #ifndef HAVE_WAYLAND_ONLY ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get()); +#else + if ((wl_win = ecore_wl_window_find(key_win))) + { + /* FIXME: Need to add an ecore_wl_window_focus function */ + } #endif break; case E_FOCUS_METHOD_PASSIVE: #ifndef HAVE_WAYLAND_ONLY ecore_x_window_focus_at_time(win, ecore_x_current_time_get()); +#else + if ((wl_win = ecore_wl_window_find(key_win))) + { + /* FIXME: Need to add an ecore_wl_window_focus function */ + } #endif break; default: break; } -#ifdef HAVE_WAYLAND_ONLY - (void)win; -#endif } static void @@ -222,4 +268,3 @@ _e_grabinput_focus(Ecore_Window win, E_Focus_Method method) focus_fix_timer = ecore_timer_add(0.2, _e_grabinput_focus_check, NULL); #endif } -