summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-04-26 21:38:02 +0200
committerDavid Robillard <d@drobilla.net>2020-04-26 21:38:02 +0200
commit3b1bf5093f998efc31d10c44c38f609f7c4ef4ad (patch)
tree2f1611ac187273db5f86d0b18c1b09a19be264fd
parent7f8737eb332aaa2a0b5a4b73096770f1478af9c7 (diff)
downloadsuil-3b1bf5093f998efc31d10c44c38f609f7c4ef4ad.tar.gz
suil-3b1bf5093f998efc31d10c44c38f609f7c4ef4ad.tar.bz2
suil-3b1bf5093f998efc31d10c44c38f609f7c4ef4ad.zip
Use initial size as fallback base size for X11 in Gtk3
-rw-r--r--src/x11_in_gtk3.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/x11_in_gtk3.c b/src/x11_in_gtk3.c
index ad6a95b..9f6e928 100644
--- a/src/x11_in_gtk3.c
+++ b/src/x11_in_gtk3.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2016 David Robillard <http://drobilla.net>
+ Copyright 2011-2020 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -39,6 +39,8 @@ struct _SuilX11Wrapper {
const LV2UI_Idle_Interface* idle_iface;
guint idle_id;
guint idle_ms;
+ int initial_width;
+ int initial_height;
int req_width;
int req_height;
};
@@ -271,7 +273,7 @@ suil_x11_wrapper_get_preferred_width(GtkWidget* widget,
&hints,
&supplied);
*natural_width = ((hints.flags & PBaseSize) ? hints.base_width
- : self->req_width);
+ : self->initial_width);
*minimum_width = ((hints.flags & PMinSize) ? hints.min_width
: self->req_width);
} else {
@@ -295,7 +297,7 @@ suil_x11_wrapper_get_preferred_height(GtkWidget* widget,
&hints,
&supplied);
*natural_height = ((hints.flags & PBaseSize) ? hints.base_height
- : self->req_height);
+ : self->initial_height);
*minimum_height = ((hints.flags & PMinSize) ? hints.min_height
: self->req_height);
} else {
@@ -376,6 +378,18 @@ wrapper_wrap(SuilWrapper* wrapper,
wrap->wrapper = wrapper;
wrap->instance = instance;
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(wrap->plug));
+ GdkDisplay* display = gdk_window_get_display(window);
+ Display* xdisplay = GDK_WINDOW_XDISPLAY(window);
+ Window xwindow = (Window)instance->ui_widget;
+
+ gdk_display_sync(display);
+
+ XWindowAttributes attrs;
+ XGetWindowAttributes(xdisplay, xwindow, &attrs);
+ wrap->initial_width = attrs.width;
+ wrap->initial_height = attrs.height;
+
const LV2UI_Idle_Interface* idle_iface = NULL;
if (instance->descriptor->extension_data) {
idle_iface = (const LV2UI_Idle_Interface*)