mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
input-events: Add meta_input_event_ignored()
This function tells whether an input event should be ignored, the only current reason being the duplication of touch events and their emulated XI2 pointer event counterparts.
This commit is contained in:
parent
46ef055da5
commit
e73a566eeb
@ -148,6 +148,36 @@ meta_input_event_is_type (MetaDisplay *display,
|
||||
return (type == ev_type);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_input_event_ignore (MetaDisplay *display,
|
||||
XEvent *ev)
|
||||
{
|
||||
#if defined(HAVE_XINPUT2) && defined(HAVE_XTOUCH)
|
||||
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:
|
||||
if (((XIDeviceEvent *) xev)->flags & XIPointerEmulated)
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_XINPUT2 && HAVE_XTOUCH */
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Window
|
||||
meta_input_event_get_window (MetaDisplay *display,
|
||||
XEvent *ev)
|
||||
|
@ -42,6 +42,9 @@ gboolean meta_input_event_is_type (MetaDisplay *display,
|
||||
XEvent *ev,
|
||||
guint ev_type);
|
||||
|
||||
gboolean meta_input_event_ignore (MetaDisplay *display,
|
||||
XEvent *ev);
|
||||
|
||||
Window meta_input_event_get_window (MetaDisplay *display,
|
||||
XEvent *ev);
|
||||
Window meta_input_event_get_root_window (MetaDisplay *display,
|
||||
|
Loading…
x
Reference in New Issue
Block a user