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:
Carlos Garnacho 2011-08-02 19:19:00 +02:00
parent 46ef055da5
commit e73a566eeb
2 changed files with 33 additions and 0 deletions

View File

@ -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)

View File

@ -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,