mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
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:
parent
2d65bd08c3
commit
18797dfa9a
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user