mirror of
https://github.com/brl/mutter.git
synced 2025-08-09 18:04:44 +00:00
core: Add meta_input_event_get_source_device()
This function would return the slave device behind and event, this is mostly needed for touch passive grabs, as XIAllowTouchEvents() at the moment requires a slave device, this has changed in the latest drafts of the multitouch protocol.
This commit is contained in:
@@ -777,3 +777,46 @@ meta_input_event_get_device (MetaDisplay *display,
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaDevice *
|
||||||
|
meta_input_event_get_source_device (MetaDisplay *display,
|
||||||
|
XEvent *ev)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_XINPUT2
|
||||||
|
if (ev->type == GenericEvent &&
|
||||||
|
ev->xcookie.extension == display->xinput2_opcode)
|
||||||
|
{
|
||||||
|
XIEvent *xev;
|
||||||
|
|
||||||
|
g_assert (display->have_xinput2 == TRUE);
|
||||||
|
|
||||||
|
xev = (XIEvent *) ev->xcookie.data;
|
||||||
|
|
||||||
|
switch (xev->evtype)
|
||||||
|
{
|
||||||
|
case XI_Motion:
|
||||||
|
case XI_ButtonPress:
|
||||||
|
case XI_ButtonRelease:
|
||||||
|
case XI_KeyPress:
|
||||||
|
case XI_KeyRelease:
|
||||||
|
#ifdef HAVE_XTOUCH
|
||||||
|
case XI_TouchBegin:
|
||||||
|
case XI_TouchEnd:
|
||||||
|
case XI_TouchUpdate:
|
||||||
|
#endif /* HAVE_XTOUCH */
|
||||||
|
return meta_device_map_lookup (display->device_map,
|
||||||
|
((XIDeviceEvent *) xev)->sourceid);
|
||||||
|
case XI_FocusIn:
|
||||||
|
case XI_FocusOut:
|
||||||
|
case XI_Enter:
|
||||||
|
case XI_Leave:
|
||||||
|
return meta_device_map_lookup (display->device_map,
|
||||||
|
((XIEnterEvent *) xev)->sourceid);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -80,6 +80,7 @@ gboolean meta_input_event_get_crossing_details (MetaDisplay *display,
|
|||||||
|
|
||||||
MetaDevice *meta_input_event_get_device (MetaDisplay *display,
|
MetaDevice *meta_input_event_get_device (MetaDisplay *display,
|
||||||
XEvent *ev);
|
XEvent *ev);
|
||||||
|
MetaDevice *meta_input_event_get_source_device (MetaDisplay *display,
|
||||||
|
XEvent *ev);
|
||||||
|
|
||||||
#endif /* META_EVENT_H */
|
#endif /* META_EVENT_H */
|
||||||
|
Reference in New Issue
Block a user