changeset 2295:2a208d5400c5

GTK4: "size-allocate" signal is gone, so switch to using "realize". This fixes the splitbar/paned widget from not using the requested position.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 07 Feb 2021 11:39:24 +0000
parents 19242334712f
children 5dd3108db1a5
files gtk4/dw.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gtk4/dw.c	Sun Feb 07 10:17:54 2021 +0000
+++ b/gtk4/dw.c	Sun Feb 07 11:39:24 2021 +0000
@@ -8587,12 +8587,12 @@
 }
 
 /* Reposition the bar according to the percentage */
-static gint _splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data)
+static gint _splitbar_realize(GtkWidget *widget, gpointer data)
 {
    float *percent = (float *)g_object_get_data(G_OBJECT(widget), "_dw_percent");
 
    /* Prevent infinite recursion ;) */
-   if(!percent || event->width < 20 || event->height < 20)
+   if(!percent)
       return FALSE;
 
    g_idle_add(_splitbar_set_percent, widget);
@@ -8623,7 +8623,7 @@
    g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id));
    *percent = 50.0;
    g_object_set_data(G_OBJECT(tmp), "_dw_percent", (gpointer)percent);
-   g_signal_connect(G_OBJECT(tmp), "size-allocate", G_CALLBACK(_splitbar_size_allocate), NULL);
+   g_signal_connect(G_OBJECT(tmp), "realize", G_CALLBACK(_splitbar_realize), NULL);
    gtk_widget_show(tmp);
    return tmp;
 }