don't use properties to get the default size for simple windows (GTK)

Wed, 17 Sep 2025 18:22:47 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 17 Sep 2025 18:22:47 +0200
changeset 770
521ecd0a0e7b
parent 769
cba744633584
child 771
155f8722b927

don't use properties to get the default size for simple windows (GTK)

ui/gtk/window.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/window.c	Tue Sep 16 15:56:05 2025 +0200
+++ b/ui/gtk/window.c	Wed Sep 17 18:22:47 2025 +0200
@@ -156,19 +156,24 @@
         g_object_set_data(G_OBJECT(obj->widget), "ui.appwindow", obj);
     }
     
-    const char *width = ui_get_property("ui.window.width");
-    const char *height = ui_get_property("ui.window.height");
-    if(width && height) {
-        gtk_window_set_default_size(
+    int window_width = window_default_width;
+    int window_height = window_default_height;
+    if(!simple) {
+        const char *width = ui_get_property("ui.window.width");
+        const char *height = ui_get_property("ui.window.height");
+        if(width && height) {
+            int w = atoi(width);
+            int h = atoi(height);
+            if(w > 0 && h > 0) {
+                window_width = w;
+                window_height = h;
+            }
+        }
+    }
+    gtk_window_set_default_size(
                 GTK_WINDOW(obj->widget),
-                atoi(width),
-                atoi(height));
-    } else {
-        gtk_window_set_default_size(
-                GTK_WINDOW(obj->widget),
-                window_default_width + sidebar*250,
-                window_default_height);
-    }
+                window_width,
+                window_height);
     
     obj->destroy = ui_window_widget_destroy;
     g_signal_connect(

mercurial