mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
input-events: Add meta_input_event_get_touch_id()
This function returns the touch ID generating an input event, if any.
This commit is contained in:
parent
6a03efe435
commit
bbc69c4220
@ -174,6 +174,35 @@ meta_input_event_ignore (MetaDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_input_event_get_touch_id (MetaDisplay *display,
|
||||
XEvent *ev,
|
||||
guint *touch_id)
|
||||
{
|
||||
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_TouchBegin:
|
||||
case XI_TouchEnd:
|
||||
case XI_TouchUpdate:
|
||||
if (touch_id)
|
||||
*touch_id = ((XIDeviceEvent *) xev)->detail;
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Window
|
||||
meta_input_event_get_window (MetaDisplay *display,
|
||||
XEvent *ev)
|
||||
|
@ -45,6 +45,10 @@ gboolean meta_input_event_is_type (MetaDisplay *display,
|
||||
gboolean meta_input_event_ignore (MetaDisplay *display,
|
||||
XEvent *ev);
|
||||
|
||||
gboolean meta_input_event_get_touch_id (MetaDisplay *display,
|
||||
XEvent *ev,
|
||||
guint *touch_id);
|
||||
|
||||
Window meta_input_event_get_window (MetaDisplay *display,
|
||||
XEvent *ev);
|
||||
Window meta_input_event_get_root_window (MetaDisplay *display,
|
||||
|
Loading…
Reference in New Issue
Block a user