Replace XAllowEvents with meta_device_allow_events()

This commit is contained in:
Carlos Garnacho 2011-06-13 12:33:15 +02:00 committed by Jasper St. Pierre
parent b3ecd268f6
commit 9f06372e17
2 changed files with 16 additions and 10 deletions

View File

@ -1950,6 +1950,7 @@ event_callback (XEvent *event,
Time evtime = meta_input_event_get_time (display, event);
guint n_button, state, mode, detail;
gdouble ev_root_x, ev_root_y;
MetaDevice *device;
if (window && !window->override_redirect &&
((evtype == KeyPress) || (evtype == ButtonPress)))
@ -1970,7 +1971,9 @@ event_callback (XEvent *event,
sanity_check_timestamps (display, display->current_time);
}
}
device = meta_input_event_get_device (display, event);
switch (evtype)
{
case KeyPress:
@ -2170,8 +2173,7 @@ event_callback (XEvent *event,
mode == AsyncPointer ? "AsyncPointer" : "ReplayPointer",
(unsigned int) evtime);
XAllowEvents (display->xdisplay,
mode, evtime);
meta_device_allow_events (device, mode, evtime);
}
if (begin_move && window->has_move_func)
@ -4088,7 +4090,7 @@ meta_change_button_grab (MetaDisplay *display,
if (meta_is_debugging ())
meta_error_trap_push_with_return (display);
/* GrabModeSync means freeze until XAllowEvents */
/* GrabModeSync means freeze until X(I)AllowEvents */
if (grab)
XGrabButton (display->xdisplay, button, modmask | ignored_mask,

View File

@ -1462,6 +1462,7 @@ process_overlay_key (MetaDisplay *display,
XEvent *event,
KeySym keysym)
{
MetaDevice *keyboard;
guint evtype, keycode;
Time evtime;
@ -1469,6 +1470,7 @@ process_overlay_key (MetaDisplay *display,
!meta_input_event_get_keycode (display, event, &keycode))
return FALSE;
keyboard = meta_input_event_get_device (display, event);
evtime = meta_input_event_get_time (display, event);
if (display->overlay_key_only_pressed)
@ -1498,13 +1500,13 @@ process_overlay_key (MetaDisplay *display,
* binding, we unfreeze the keyboard but keep the grab
* (this is important for something like cycling
* windows */
XAllowEvents (display->xdisplay, AsyncKeyboard, evtime);
meta_device_allow_events (keyboard, AsyncKeyboard, evtime);
}
else
{
/* Replay the event so it gets delivered to our
* per-window key bindings or to the application */
XAllowEvents (display->xdisplay, ReplayKeyboard, evtime);
meta_device_allow_events (keyboard, ReplayKeyboard, evtime);
}
}
else if (evtype == KeyRelease)
@ -1512,7 +1514,7 @@ process_overlay_key (MetaDisplay *display,
display->overlay_key_only_pressed = FALSE;
/* We want to unfreeze events, but keep the grab so that if the user
* 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);
}
@ -1524,7 +1526,7 @@ process_overlay_key (MetaDisplay *display,
display->overlay_key_only_pressed = TRUE;
/* 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 */
XAllowEvents (display->xdisplay, SyncKeyboard, evtime);
meta_device_allow_events (keyboard, SyncKeyboard, evtime);
return TRUE;
}
@ -1558,6 +1560,7 @@ meta_display_process_key_event (MetaDisplay *display,
const char *str;
MetaScreen *screen;
guint evtype, keycode, state;
MetaDevice *keyboard;
Window xwindow;
Time evtime;
@ -1567,6 +1570,7 @@ meta_display_process_key_event (MetaDisplay *display,
return FALSE;
evtime = meta_input_event_get_time (display, event);
keyboard = meta_input_event_get_device (display, event);
if (all_bindings_disabled)
{
@ -1578,7 +1582,7 @@ meta_display_process_key_event (MetaDisplay *display,
* poorly defined how this mode is supposed to interact with
* plugins.
*/
XAllowEvents (display->xdisplay, ReplayKeyboard, evtime);
meta_device_allow_events (keyboard, ReplayKeyboard, evtime);
return FALSE;
}
@ -1619,7 +1623,7 @@ meta_display_process_key_event (MetaDisplay *display,
return TRUE;
}
XAllowEvents (display->xdisplay, AsyncKeyboard, event->xkey.time);
meta_device_allow_events (keyboard, AsyncKeyboard, evtime);
keep_grab = TRUE;
if (all_keys_grabbed)