barrier: Add support for new barrier features in XInput 2.3

XInput 2.3 adds support for "barrier events", which let us know when
a pointer barrier has been hit, and when the pointer has stopped
hitting the barrier, and lets us "release" the barrier, temporarily
letting the pointer pass through the barrier. These features can be
combined to allow for certain pointer gestures, such as "pushing"
against the bottom of the screen, or stopping the pointer on monitor
edges while dragging slowly for increased edge precision.

This commit should allow graceful fallback if servers with
XInput 2.3 aren't supported.

https://bugzilla.gnome.org/show_bug.cgi?id=677215
This commit is contained in:
Jasper St. Pierre
2012-07-30 15:57:53 -03:00
parent 8b21df92f0
commit 57c31a56f4
7 changed files with 278 additions and 3 deletions

View File

@@ -758,6 +758,13 @@ meta_screen_new (MetaDisplay *display,
XISetMask (mask.mask, XI_FocusIn);
XISetMask (mask.mask, XI_FocusOut);
XISetMask (mask.mask, XI_Motion);
#ifdef HAVE_XI23
if (META_DISPLAY_HAS_XINPUT_23 (display))
{
XISetMask (mask.mask, XI_BarrierHit);
XISetMask (mask.mask, XI_BarrierLeave);
}
#endif /* HAVE_XI23 */
XISelectEvents (xdisplay, xroot, &mask, 1);
event_mask = (SubstructureRedirectMask | SubstructureNotifyMask |
@@ -1230,6 +1237,9 @@ meta_screen_foreach_window (MetaScreen *screen,
{
MetaWindow *window = tmp->data;
if (!META_IS_WINDOW (window))
continue;
if (window->screen == screen && !window->override_redirect)
(* func) (screen, window, data);
}