mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
Replace XAllowEvents with meta_device_allow_events()
This commit is contained in:
parent
ad911d6cce
commit
199395a395
@ -1740,6 +1740,7 @@ event_callback (XEvent *event,
|
|||||||
Time evtime = meta_input_event_get_time (display, event);
|
Time evtime = meta_input_event_get_time (display, event);
|
||||||
guint n_button, state, mode, detail;
|
guint n_button, state, mode, detail;
|
||||||
gdouble ev_root_x, ev_root_y;
|
gdouble ev_root_x, ev_root_y;
|
||||||
|
MetaDevice *device;
|
||||||
|
|
||||||
if (window && !window->override_redirect &&
|
if (window && !window->override_redirect &&
|
||||||
((evtype == KeyPress) || (evtype == ButtonPress)))
|
((evtype == KeyPress) || (evtype == ButtonPress)))
|
||||||
@ -1761,6 +1762,8 @@ event_callback (XEvent *event,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device = meta_input_event_get_device (display, event);
|
||||||
|
|
||||||
switch (evtype)
|
switch (evtype)
|
||||||
{
|
{
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
@ -1959,8 +1962,7 @@ event_callback (XEvent *event,
|
|||||||
mode == AsyncPointer ? "AsyncPointer" : "ReplayPointer",
|
mode == AsyncPointer ? "AsyncPointer" : "ReplayPointer",
|
||||||
(unsigned int) evtime);
|
(unsigned int) evtime);
|
||||||
|
|
||||||
XAllowEvents (display->xdisplay,
|
meta_device_allow_events (device, mode, evtime);
|
||||||
mode, evtime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (begin_move && window->has_move_func)
|
if (begin_move && window->has_move_func)
|
||||||
@ -3891,7 +3893,7 @@ meta_change_button_grab (MetaDisplay *display,
|
|||||||
if (meta_is_debugging ())
|
if (meta_is_debugging ())
|
||||||
meta_error_trap_push_with_return (display);
|
meta_error_trap_push_with_return (display);
|
||||||
|
|
||||||
/* GrabModeSync means freeze until XAllowEvents */
|
/* GrabModeSync means freeze until X(I)AllowEvents */
|
||||||
|
|
||||||
if (grab)
|
if (grab)
|
||||||
XGrabButton (display->xdisplay, button, modmask | ignored_mask,
|
XGrabButton (display->xdisplay, button, modmask | ignored_mask,
|
||||||
|
@ -1369,6 +1369,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
KeySym keysym)
|
KeySym keysym)
|
||||||
{
|
{
|
||||||
guint evtype, keycode;
|
guint evtype, keycode;
|
||||||
|
MetaDevice *keyboard;
|
||||||
Time evtime;
|
Time evtime;
|
||||||
|
|
||||||
if (!meta_input_event_get_type (display, event, &evtype) ||
|
if (!meta_input_event_get_type (display, event, &evtype) ||
|
||||||
@ -1376,6 +1377,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
evtime = meta_input_event_get_time (display, event);
|
evtime = meta_input_event_get_time (display, event);
|
||||||
|
keyboard = meta_input_event_get_device (display, event);
|
||||||
|
|
||||||
if (display->overlay_key_only_pressed)
|
if (display->overlay_key_only_pressed)
|
||||||
{
|
{
|
||||||
@ -1404,13 +1406,13 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
* binding, we unfreeze the keyboard but keep the grab
|
* binding, we unfreeze the keyboard but keep the grab
|
||||||
* (this is important for something like cycling
|
* (this is important for something like cycling
|
||||||
* windows */
|
* windows */
|
||||||
XAllowEvents (display->xdisplay, AsyncKeyboard, evtime);
|
meta_device_allow_events (keyboard, AsyncKeyboard, evtime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Replay the event so it gets delivered to our
|
/* Replay the event so it gets delivered to our
|
||||||
* per-window key bindings or to the application */
|
* per-window key bindings or to the application */
|
||||||
XAllowEvents (display->xdisplay, ReplayKeyboard, evtime);
|
meta_device_allow_events (keyboard, ReplayKeyboard, evtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (evtype == KeyRelease)
|
else if (evtype == KeyRelease)
|
||||||
@ -1418,7 +1420,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
display->overlay_key_only_pressed = FALSE;
|
display->overlay_key_only_pressed = FALSE;
|
||||||
/* We want to unfreeze events, but keep the grab so that if the user
|
/* We want to unfreeze events, but keep the grab so that if the user
|
||||||
* starts typing into the overlay we get all the keys */
|
* starts typing into the overlay we get all the keys */
|
||||||
XAllowEvents (display->xdisplay, AsyncKeyboard, evtime);
|
meta_device_allow_events (keyboard, AsyncKeyboard, evtime);
|
||||||
meta_display_overlay_key_activate (display);
|
meta_display_overlay_key_activate (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,7 +1432,7 @@ process_overlay_key (MetaDisplay *display,
|
|||||||
display->overlay_key_only_pressed = TRUE;
|
display->overlay_key_only_pressed = TRUE;
|
||||||
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
|
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
|
||||||
* on the next event if it's not the release of the overlay key */
|
* on the next event if it's not the release of the overlay key */
|
||||||
XAllowEvents (display->xdisplay, SyncKeyboard, evtime);
|
meta_device_allow_events (keyboard, SyncKeyboard, evtime);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1464,6 +1466,7 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
const char *str;
|
const char *str;
|
||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
guint evtype, keycode, state;
|
guint evtype, keycode, state;
|
||||||
|
MetaDevice *keyboard;
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
Time evtime;
|
Time evtime;
|
||||||
|
|
||||||
@ -1473,6 +1476,7 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
evtime = meta_input_event_get_time (display, event);
|
evtime = meta_input_event_get_time (display, event);
|
||||||
|
keyboard = meta_input_event_get_device (display, event);
|
||||||
|
|
||||||
if (all_bindings_disabled)
|
if (all_bindings_disabled)
|
||||||
{
|
{
|
||||||
@ -1484,7 +1488,7 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
* poorly defined how this mode is supposed to interact with
|
* poorly defined how this mode is supposed to interact with
|
||||||
* plugins.
|
* plugins.
|
||||||
*/
|
*/
|
||||||
XAllowEvents (display->xdisplay, ReplayKeyboard, evtime);
|
meta_device_allow_events (keyboard, ReplayKeyboard, evtime);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1525,7 +1529,7 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XAllowEvents (display->xdisplay, AsyncKeyboard, evtime);
|
meta_device_allow_events (keyboard, AsyncKeyboard, evtime);
|
||||||
|
|
||||||
keep_grab = TRUE;
|
keep_grab = TRUE;
|
||||||
if (all_keys_grabbed)
|
if (all_keys_grabbed)
|
||||||
|
Loading…
Reference in New Issue
Block a user