GtkDnd: Move X11-specific code out of generic code path

There was some X11-specific code before an early exit
in the functions that grab and ungrab keys during DND.
It seems to not cause a problem under Wayland, but moving
it out of the way seems right anyway.
This commit is contained in:
Matthias Clasen 2014-09-12 22:12:26 -04:00
parent ca27bf37bc
commit 45369d506b

View File

@ -468,14 +468,6 @@ grab_dnd_keys (GtkWidget *widget,
unsigned char mask[(XI_LASTEVENT + 7)/8];
gboolean using_xi2;
deviceid = gdk_x11_device_get_id (device);
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (gdk_display_get_device_manager (gtk_widget_get_display (widget))))
using_xi2 = TRUE;
else
using_xi2 = FALSE;
#endif
window = gtk_widget_get_window (widget);
if (!GDK_IS_X11_WINDOW (window))
{
@ -487,6 +479,13 @@ grab_dnd_keys (GtkWidget *widget,
return;
}
deviceid = gdk_x11_device_get_id (device);
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (gdk_display_get_device_manager (gtk_widget_get_display (widget))))
using_xi2 = TRUE;
else
using_xi2 = FALSE;
#endif
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
@ -553,13 +552,6 @@ ungrab_dnd_keys (GtkWidget *widget,
gint deviceid;
gboolean using_xi2;
deviceid = gdk_x11_device_get_id (device);
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (gdk_display_get_device_manager (gtk_widget_get_display (widget))))
using_xi2 = TRUE;
else
using_xi2 = FALSE;
#endif
window = gtk_widget_get_window (widget);
if (!GDK_IS_X11_WINDOW (window))
{
@ -567,6 +559,14 @@ ungrab_dnd_keys (GtkWidget *widget,
return;
}
deviceid = gdk_x11_device_get_id (device);
if (GDK_IS_X11_DEVICE_MANAGER_XI2 (gdk_display_get_device_manager (gtk_widget_get_display (widget))))
using_xi2 = TRUE;
else
using_xi2 = FALSE;
#endif
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
gdk_window_remove_filter (NULL, root_key_filter, (gpointer) GDK_WINDOW_XID (window));
@ -627,7 +627,6 @@ ungrab_dnd_keys (GtkWidget *widget,
#endif /* GDK_WINDOWING_X11 */
/*
* gtk_drag_release_ipc_widget:
* @widget: the widget to release