gdk: Get the right filter window for XI2 events

GdkDeviceManagerXI2 now implements GdkEventTranslator::get_window,
retrieving the right window from the contained XIEvent.
This commit is contained in:
Carlos Garnacho 2011-05-18 21:32:22 +02:00
parent 55cc9f3339
commit a529568f79

View File

@ -91,7 +91,8 @@ static GdkEventMask gdk_x11_device_manager_xi2_get_handled_events (GdkEventTra
static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
static GdkWindow * gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
XEvent *xevent);
enum {
PROP_0,
@ -561,6 +562,7 @@ gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface
iface->translate_event = gdk_x11_device_manager_xi2_translate_event;
iface->get_handled_events = gdk_x11_device_manager_xi2_get_handled_events;
iface->select_window_events = gdk_x11_device_manager_xi2_select_window_events;
iface->get_window = gdk_x11_device_manager_xi2_get_window;
}
static void
@ -1348,6 +1350,24 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
g_free (event_mask.mask);
}
static GdkWindow *
gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
XEvent *xevent)
{
GdkX11DeviceManagerXI2 *device_manager;
XIEvent *ev;
device_manager = (GdkX11DeviceManagerXI2 *) translator;
if (xevent->type != GenericEvent ||
xevent->xcookie.extension != device_manager->opcode)
return NULL;
ev = (XIEvent *) xevent->xcookie.data;
return get_event_window (translator, ev);
}
#else /* XINPUT_2 */
static void