mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 06:10:15 +00:00
Deal with events from wrong display
GtkInspector is opening a separate display connection, which makes it more likely that gtk_get_current_event() returns an event from the "wrong" display.
This commit is contained in:
parent
002699402d
commit
e367c4baa0
@ -1535,20 +1535,24 @@ gtk_menu_popup_for_device (GtkMenu *menu,
|
||||
gboolean grab_keyboard;
|
||||
GtkWidget *parent_toplevel;
|
||||
GdkDevice *keyboard, *pointer, *source_device = NULL;
|
||||
GdkDisplay *display;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
g_return_if_fail (device == NULL || GDK_IS_DEVICE (device));
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (menu));
|
||||
|
||||
if (device == NULL)
|
||||
device = gtk_get_current_event_device ();
|
||||
|
||||
if (device && gdk_device_get_display (device) != display)
|
||||
device = NULL;
|
||||
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDeviceManager *device_manager;
|
||||
GList *devices;
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (menu));
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
|
||||
|
||||
|
@ -398,7 +398,8 @@ popup_menu (GtkMenuButton *menu_button,
|
||||
break;
|
||||
}
|
||||
|
||||
if (event)
|
||||
if (event != NULL &&
|
||||
gdk_event_get_screen (event) == gtk_widget_get_screen (GTK_WIDGET (menu_button)))
|
||||
{
|
||||
device = gdk_event_get_device (event);
|
||||
gdk_event_get_button (event, &button);
|
||||
|
Loading…
Reference in New Issue
Block a user