core: Add a helper function to grab the old event mask of a window

https://bugzilla.gnome.org/show_bug.cgi?id=690581
This commit is contained in:
Jasper St. Pierre 2013-02-07 17:37:57 -05:00
parent b33b4a8e2c
commit d794db876a
2 changed files with 25 additions and 4 deletions

View File

@ -775,3 +775,24 @@ meta_invalidate_default_icons (void)
g_slist_free (windows);
}
void
meta_core_add_old_event_mask (Display *xdisplay,
Window xwindow,
XIEventMask *mask)
{
XIEventMask *prev;
gint n_masks, i, j;
prev = XIGetSelectedEvents (xdisplay, xwindow, &n_masks);
for (i = 0; i < n_masks; i++)
{
if (prev[i].deviceid != XIAllMasterDevices)
continue;
for (j = 0; j < MIN (mask->mask_len, prev[i].mask_len); j++)
mask->mask[j] |= prev[i].mask[j];
}
XFree (prev);
}

View File

@ -205,8 +205,8 @@ void meta_core_increment_event_serial (Display *display);
void meta_invalidate_default_icons (void);
void meta_core_add_old_event_mask (Display *xdisplay,
Window xwindow,
XIEventMask *mask);
#endif