From: Carsten Haitzler (Rasterman) Date: Tue, 15 Jul 2014 11:38:34 +0000 (+0900) Subject: fix mouse sticking when xkbmap changes whilst running X-Git-Tag: upstream/1.10.0+1149+ga3a15b1~195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20c8065da6e7090a5bb2dd02987d01d1deedc6df;p=platform%2Fupstream%2Fefl.git fix mouse sticking when xkbmap changes whilst running this fixes T1415 --- diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index e1469c8..db1cfa4 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -1714,9 +1714,8 @@ ecore_x_window_button_grab(Ecore_X_Window win, _ecore_window_grabs[_ecore_window_grabs_num - 1].any_mod = any_mod; } -void -_ecore_x_sync_magic_send(int val, - Ecore_X_Window swin) +static void +_ecore_x_sync_magic_send(int val, Ecore_X_Window swin, int b, int mod, int anymod) { XEvent xev; @@ -1728,10 +1727,10 @@ _ecore_x_sync_magic_send(int val, xev.xclient.format = 32; xev.xclient.message_type = 27777; xev.xclient.data.l[0] = 0x7162534; - xev.xclient.data.l[1] = 0x10000000 + val; + xev.xclient.data.l[1] = val | (anymod << 8); xev.xclient.data.l[2] = swin; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; + xev.xclient.data.l[3] = b; + xev.xclient.data.l[4] = mod; XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev); } @@ -1815,8 +1814,8 @@ ecore_x_window_button_ungrab(Ecore_X_Window win, int any_mod) { _ecore_x_window_button_ungrab_internal(win, button, mod, any_mod); - _ecore_x_sync_magic_send(1, win); - _ecore_x_window_grab_remove(win, button, mod, any_mod); + _ecore_x_sync_magic_send(1, win, button, mod, any_mod); +// _ecore_x_window_grab_remove(win, button, mod, any_mod); } void _ecore_x_window_grab_suspend(void) @@ -2025,8 +2024,8 @@ ecore_x_window_key_ungrab(Ecore_X_Window win, int any_mod) { _ecore_x_window_key_ungrab_internal(win, key, mod, any_mod); - _ecore_x_sync_magic_send(2, win); - _ecore_x_key_grab_remove(win, key, mod, any_mod); + _ecore_x_sync_magic_send(2, win, XStringToKeysym(key), mod, any_mod); +// _ecore_x_key_grab_remove(win, key, mod, any_mod); } void diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c index 9bb54fe..d4049d2 100644 --- a/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/src/lib/ecore_x/xlib/ecore_x_events.c @@ -1918,11 +1918,24 @@ _ecore_x_event_handle_client_message(XEvent *xevent) && (xevent->xclient.format == 32) && (xevent->xclient.window == _ecore_x_private_win)) { + int val = xevent->xclient.data.l[1] & 0xff; + int anymod = (xevent->xclient.data.l[1] >> 8) & 0xff; + int mod = xevent->xclient.data.l[4]; + int b = xevent->xclient.data.l[3]; + Ecore_X_Window swin = xevent->xclient.data.l[2]; + /* a grab sync marker */ - if (xevent->xclient.data.l[1] == 0x10000001) - _ecore_x_window_grab_remove(xevent->xclient.data.l[2], -1, 0, 0); - else if (xevent->xclient.data.l[1] == 0x10000002) - _ecore_x_key_grab_remove(xevent->xclient.data.l[2], NULL, 0, 0); + if (val == 1) + { + _ecore_x_window_grab_remove(swin, b, mod, anymod); + } + else if (val == 2) + { + const char *str; + + str = ecore_x_keysym_string_get(b); + if (str) _ecore_x_key_grab_remove(swin, str, mod, anymod); + } } else { diff --git a/src/lib/ecore_x/xlib/ecore_x_private.h b/src/lib/ecore_x/xlib/ecore_x_private.h index 10c7cb2..cbfa4f7 100644 --- a/src/lib/ecore_x/xlib/ecore_x_private.h +++ b/src/lib/ecore_x/xlib/ecore_x_private.h @@ -299,8 +299,6 @@ void *_ecore_x_selection_parse(const char *target, int size, int format); -void _ecore_x_sync_magic_send(int val, - Ecore_X_Window swin); int _ecore_x_window_grab_remove(Ecore_X_Window win, int button, int mod, int any_mod); int _ecore_x_key_grab_remove(Ecore_X_Window win, const char *key, int mod, int any_mod); void _ecore_x_window_grab_suspend(void);