summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-01 21:47:40 -0500
committerDavid Robillard <d@drobilla.net>2024-12-01 21:50:56 -0500
commit038c7bb05ad514bc69c43ec877d2e7b4dee90433 (patch)
tree13fd3ea2a27902555aa1f1074d0ccf0945660a15
parent929a84c06187eb362a76f473395b6edac8cbef14 (diff)
downloadsuil-038c7bb05ad514bc69c43ec877d2e7b4dee90433.tar.gz
suil-038c7bb05ad514bc69c43ec877d2e7b4dee90433.tar.bz2
suil-038c7bb05ad514bc69c43ec877d2e7b4dee90433.zip
Set up drag/drop proxy for X11 in Gtk3 like in Gtk2
-rw-r--r--src/x11_in_gtk3.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c
index c956fd5..0a1aaf9 100644
--- a/src/x11_in_gtk3.c
+++ b/src/x11_in_gtk3.c
@@ -12,6 +12,7 @@
#include <suil/suil.h>
#include <X11/X.h>
+#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -110,6 +111,26 @@ suil_x11_wrapper_realize(GtkWidget* w)
gtk_widget_set_sensitive(GTK_WIDGET(wrap->plug), TRUE);
gtk_widget_set_can_focus(GTK_WIDGET(wrap->plug), TRUE);
gtk_widget_grab_focus(GTK_WIDGET(wrap->plug));
+
+ // Setup drag/drop proxy from parent/grandparent window
+ GdkWindow* gwindow = gtk_widget_get_window(GTK_WIDGET(wrap->plug));
+ Display* xdisplay = GDK_WINDOW_XDISPLAY(gwindow);
+ Window xwindow = GDK_WINDOW_XID(gwindow);
+ Atom xdnd_proxy_atom = gdk_x11_get_xatom_by_name("XdndProxy");
+ Window ui_window = (Window)wrap->instance->ui_widget;
+
+ while (xwindow) {
+ XChangeProperty(xdisplay,
+ xwindow,
+ xdnd_proxy_atom,
+ XA_WINDOW,
+ 32,
+ PropModeReplace,
+ (unsigned char*)&ui_window,
+ 1);
+
+ xwindow = suil_x11_get_parent(xdisplay, xwindow);
+ }
}
static void