frames: Disable XDND support on the frame window

All X11 surfaces created by gtk4 claim to support XDND via the XdndAware
property. This was leading some clients, e.g. Qt, to consider the frame
window as drop target instead of the client window.

Avoid this issue by removing the XdndAware property again after gtk has
created the surface.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2715
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2978>
This commit is contained in:
Sebastian Keller 2023-04-28 12:20:11 +02:00
parent 28a6447ff0
commit d643eb5c6f

View File

@ -504,6 +504,7 @@ frame_sync_wm_state (MetaFrame *frame,
GtkWidget * GtkWidget *
meta_frame_new (Window window) meta_frame_new (Window window)
{ {
GdkDisplay *display;
GtkWidget *frame, *header, *content; GtkWidget *frame, *header, *content;
GdkSurface *surface; GdkSurface *surface;
int frame_height = 0; int frame_height = 0;
@ -549,6 +550,13 @@ meta_frame_new (Window window)
frame_sync_motif_wm_hints (GTK_WINDOW (frame), window); frame_sync_motif_wm_hints (GTK_WINDOW (frame), window);
frame_sync_wm_normal_hints (GTK_WINDOW (frame), window); frame_sync_wm_normal_hints (GTK_WINDOW (frame), window);
/* Disable XDND support on the frame window, because it can cause some clients
* to try use it instead of the client window as drop target */
display = gtk_widget_get_display (GTK_WIDGET (frame));
XDeleteProperty (gdk_x11_display_get_xdisplay (display),
gdk_x11_surface_get_xid (surface),
gdk_x11_get_xatom_by_name_for_display (display, "XdndAware"));
return frame; return frame;
} }