summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-01 22:38:31 -0500
committerDavid Robillard <d@drobilla.net>2024-12-01 22:40:20 -0500
commitb2c64e5a8f463ee47490bc1325924ea4bbc051cc (patch)
tree555b3d9f51e8cea9995d336f3d45e0958031e845
parentc8dc495b10e2b761624505f25397aa19e0c88dbf (diff)
downloadsuil-b2c64e5a8f463ee47490bc1325924ea4bbc051cc.tar.gz
suil-b2c64e5a8f463ee47490bc1325924ea4bbc051cc.tar.bz2
suil-b2c64e5a8f463ee47490bc1325924ea4bbc051cc.zip
Monitor UI window resizes for X11 in Gtk3
-rw-r--r--NEWS4
-rw-r--r--src/x11_in_gtk3.c27
2 files changed, 24 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index f608a94..de5b534 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,9 @@ suil (0.10.21) unstable; urgency=medium
* Add support for X11 in Qt6
* Fix library current_version on MacOS
- * Monitor size hints for X11 in Gtk3
+ * Monitor size hints and window resizes for X11 in Gtk3
- -- David Robillard <d@drobilla.net> Mon, 02 Dec 2024 03:05:37 +0000
+ -- David Robillard <d@drobilla.net> Mon, 02 Dec 2024 03:38:40 +0000
suil (0.10.20) stable; urgency=medium
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c
index 138fdcb..e3be7fb 100644
--- a/src/x11_in_gtk3.c
+++ b/src/x11_in_gtk3.c
@@ -110,12 +110,15 @@ suil_x11_wrapper_realize(GtkWidget* w)
gtk_widget_set_can_focus(GTK_WIDGET(wrap->plug), TRUE);
gtk_widget_grab_focus(GTK_WIDGET(wrap->plug));
+ // Request configure events for child windows
+ GdkWindow* gwindow = gtk_widget_get_window(GTK_WIDGET(wrap->plug));
+ Display* xdisplay = GDK_WINDOW_XDISPLAY(gwindow);
+ Window xwindow = GDK_WINDOW_XID(gwindow);
+ XSelectInput(xdisplay, xwindow, SubstructureRedirectMask);
+
// 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;
+ Atom xdnd_proxy_atom = gdk_x11_get_xatom_by_name("XdndProxy");
+ Window ui_window = (Window)wrap->instance->ui_widget;
while (xwindow) {
XChangeProperty(xdisplay,
@@ -407,6 +410,20 @@ suil_x11_wrapper_idle(void* data)
wrap->idle_iface->idle(wrap->instance->handle);
+ GdkWindow* const gwindow = gtk_widget_get_window(GTK_WIDGET(wrap->plug));
+ const Window window = GDK_WINDOW_XID(gwindow);
+ Display* const display = GDK_WINDOW_XDISPLAY(gwindow);
+ XEvent event = {0};
+ while (XCheckWindowEvent(display, window, SubstructureRedirectMask, &event)) {
+ if (event.type == MapRequest) {
+ XMapWindow(display, event.xmaprequest.window);
+ } else if (event.type == ConfigureRequest) {
+ wrap->size_hints.flags = 0;
+ wrap->size_hints_dirty = TRUE;
+ wrapper_resize(wrap, event.xconfigure.width, event.xconfigure.height);
+ }
+ }
+
return TRUE; // Continue calling
}