mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
compositor: use meta_device_grab() for pointer/keyboard grabs
These happen invariably on the VCP/VCK pair.
This commit is contained in:
parent
972a9d231f
commit
f5334dd6cf
@ -359,11 +359,10 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
|||||||
* merge the two.
|
* merge the two.
|
||||||
*/
|
*/
|
||||||
MetaDisplay *display = meta_screen_get_display (screen);
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
Display *xdpy = meta_display_get_xdisplay (display);
|
|
||||||
MetaCompositor *compositor = display->compositor;
|
MetaCompositor *compositor = display->compositor;
|
||||||
gboolean pointer_grabbed = FALSE;
|
gboolean pointer_grabbed = FALSE;
|
||||||
gboolean keyboard_grabbed = FALSE;
|
gboolean keyboard_grabbed = FALSE;
|
||||||
int result;
|
gboolean result;
|
||||||
MetaDevice *device;
|
MetaDevice *device;
|
||||||
MetaGrabInfo *grab_info;
|
MetaGrabInfo *grab_info;
|
||||||
|
|
||||||
@ -379,15 +378,15 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
|||||||
|
|
||||||
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
|
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
|
||||||
{
|
{
|
||||||
result = XGrabPointer (xdpy, grab_window,
|
result = meta_device_grab (device,
|
||||||
False, /* owner_events */
|
grab_window,
|
||||||
(ButtonPressMask | ButtonReleaseMask |
|
(ButtonPressMask | ButtonReleaseMask |
|
||||||
EnterWindowMask | LeaveWindowMask | PointerMotionMask),
|
EnterWindowMask | LeaveWindowMask | PointerMotionMask),
|
||||||
GrabModeAsync, GrabModeAsync,
|
cursor,
|
||||||
None, /* confine to */
|
FALSE,
|
||||||
cursor,
|
FALSE,
|
||||||
timestamp);
|
timestamp);
|
||||||
if (result != Success)
|
if (!result)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
pointer_grabbed = TRUE;
|
pointer_grabbed = TRUE;
|
||||||
@ -395,12 +394,13 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
|||||||
|
|
||||||
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
|
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
|
||||||
{
|
{
|
||||||
result = XGrabKeyboard (xdpy, grab_window,
|
result = meta_device_grab (meta_device_get_paired_device (device),
|
||||||
False, /* owner_events */
|
grab_window,
|
||||||
GrabModeAsync, GrabModeAsync,
|
(KeyPressMask | KeyReleaseMask),
|
||||||
timestamp);
|
META_CURSOR_DEFAULT,
|
||||||
|
FALSE, FALSE,
|
||||||
if (result != Success)
|
timestamp);
|
||||||
|
if (!result)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
keyboard_grabbed = TRUE;
|
keyboard_grabbed = TRUE;
|
||||||
@ -420,9 +420,9 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (pointer_grabbed)
|
if (pointer_grabbed)
|
||||||
XUngrabPointer (xdpy, timestamp);
|
meta_device_ungrab (device, timestamp);
|
||||||
if (keyboard_grabbed)
|
if (keyboard_grabbed)
|
||||||
XUngrabKeyboard (xdpy, timestamp);
|
meta_device_ungrab (meta_device_get_paired_device (device), timestamp);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -433,7 +433,6 @@ meta_end_modal_for_plugin (MetaScreen *screen,
|
|||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_screen_get_display (screen);
|
MetaDisplay *display = meta_screen_get_display (screen);
|
||||||
Display *xdpy = meta_display_get_xdisplay (display);
|
|
||||||
MetaCompositor *compositor = display->compositor;
|
MetaCompositor *compositor = display->compositor;
|
||||||
MetaDevice *device;
|
MetaDevice *device;
|
||||||
|
|
||||||
@ -443,8 +442,8 @@ meta_end_modal_for_plugin (MetaScreen *screen,
|
|||||||
device = meta_device_map_lookup (display->device_map,
|
device = meta_device_map_lookup (display->device_map,
|
||||||
META_CORE_POINTER_ID);
|
META_CORE_POINTER_ID);
|
||||||
|
|
||||||
XUngrabPointer (xdpy, timestamp);
|
meta_device_ungrab (device, timestamp);
|
||||||
XUngrabKeyboard (xdpy, timestamp);
|
meta_device_ungrab (meta_device_get_paired_device (device), timestamp);
|
||||||
|
|
||||||
meta_display_remove_grab_info (display, device);
|
meta_display_remove_grab_info (display, device);
|
||||||
compositor->modal_plugin = NULL;
|
compositor->modal_plugin = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user