Use the client pointer for events with no device.

The core pointer is sort of meaningless in a multidevice environment,
the client pointer is used instead to fake a GdkDevice on events that
don't have one.
This commit is contained in:
Carlos Garnacho 2010-10-28 23:01:16 +02:00 committed by Tristan Van Berkom
parent 2d65bd08c3
commit 18797dfa9a

View File

@ -1032,20 +1032,22 @@ gdk_event_get_device (const GdkEvent *event)
case GDK_KEY_RELEASE:
{
GdkDisplay *display;
GdkDevice *core_pointer;
GdkDeviceManager *device_manager;
GdkDevice *client_pointer;
g_warning ("Event with type %d not holding a GdkDevice. "
"It is most likely synthesized outside Gdk/GTK+\n",
event->type);
display = gdk_window_get_display (event->any.window);
core_pointer = gdk_display_get_core_pointer (display);
device_manager = gdk_display_get_device_manager (display);
client_pointer = gdk_device_manager_get_client_pointer (device_manager);
if (event->type == GDK_KEY_PRESS ||
event->type == GDK_KEY_RELEASE)
return gdk_device_get_associated_device (core_pointer);
return gdk_device_get_associated_device (client_pointer);
else
return core_pointer;
return client_pointer;
}
break;
default: