keygrabber: Handle XI2 key events, part of SL #3895
XInput2 events are coerced by active grabs on the alt-tab handling code in sugar shell, even if the keygrabber itself does core events. Signed-off-by: Carlos Garnacho <carlos@lanedo.com> Acked-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
parent
8a9d10cda7
commit
a22d4ee50d
@ -19,6 +19,7 @@
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
@ -138,6 +139,25 @@ filter_events(GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||
return GDK_FILTER_REMOVE;
|
||||
}
|
||||
|
||||
if (xev->type == GenericEvent) {
|
||||
XIDeviceEvent *ev;
|
||||
int return_value = FALSE;
|
||||
|
||||
ev = (XIDeviceEvent *) ((XGenericEventCookie *) xev)->data;
|
||||
|
||||
if (ev->evtype == XI_KeyPress) {
|
||||
g_signal_emit (grabber, signals[KEY_PRESSED], 0,
|
||||
ev->detail, ev->mods.effective, ev->time, &return_value);
|
||||
} else if (ev->evtype == XI_KeyRelease) {
|
||||
g_signal_emit (grabber, signals[KEY_RELEASED], 0,
|
||||
ev->detail, ev->mods.effective, ev->time, &return_value);
|
||||
}
|
||||
|
||||
if (return_value)
|
||||
return GDK_FILTER_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user