From 3e5b2ba96ac79bfe3042c9dc7be1ae810f9086a4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 22 Jan 2015 15:45:16 -0500 Subject: [PATCH] move more grabinput code to not fail in wl #barrel --- src/bin/e_grabinput.c | 49 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c index 449dcd6c8..980fde59a 100644 --- a/src/bin/e_grabinput.c +++ b/src/bin/e_grabinput.c @@ -36,49 +36,55 @@ e_grabinput_shutdown(void) EAPI int e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) { - if (e_comp->comp_type != E_PIXMAP_TYPE_X) return 1; if (grab_mouse_win) { #ifndef HAVE_WAYLAND_ONLY - ecore_x_pointer_ungrab(); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + ecore_x_pointer_ungrab(); #endif grab_mouse_win = 0; } if (grab_key_win) { #ifndef HAVE_WAYLAND_ONLY - ecore_x_keyboard_ungrab(); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + ecore_x_keyboard_ungrab(); #endif grab_key_win = 0; focus_win = 0; } if (mouse_win) { - int ret = 0; - #ifndef HAVE_WAYLAND_ONLY - if (confine_mouse) - ret = ecore_x_pointer_confine_grab(mouse_win); - else - ret = ecore_x_pointer_grab(mouse_win); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + { + int ret = 0; + if (confine_mouse) + ret = ecore_x_pointer_confine_grab(mouse_win); + else + ret = ecore_x_pointer_grab(mouse_win); + if (!ret) return 0; + } #endif - if (!ret) return 0; grab_mouse_win = mouse_win; } if (key_win) { #ifndef HAVE_WAYLAND_ONLY - int ret = 0; - - ret = ecore_x_keyboard_grab(key_win); - if (!ret) + if (e_comp->comp_type == E_PIXMAP_TYPE_X) { - if (grab_mouse_win) + int ret = 0; + + ret = ecore_x_keyboard_grab(key_win); + if (!ret) { - ecore_x_pointer_ungrab(); - grab_mouse_win = 0; + if (grab_mouse_win) + { + ecore_x_pointer_ungrab(); + grab_mouse_win = 0; + } + return 0; } - return 0; } #endif grab_key_win = key_win; @@ -92,18 +98,19 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) EAPI void e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) { - if (e_comp->comp_type != E_PIXMAP_TYPE_X) return; if (mouse_win == grab_mouse_win) { #ifndef HAVE_WAYLAND_ONLY - ecore_x_pointer_ungrab(); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + ecore_x_pointer_ungrab(); #endif grab_mouse_win = 0; } if (key_win == grab_key_win) { #ifndef HAVE_WAYLAND_ONLY - ecore_x_keyboard_ungrab(); + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + ecore_x_keyboard_ungrab(); #endif grab_key_win = 0; if (focus_win != 0)