From b4b7d4be4e947d56f29bfb49b995b8311388481a Mon Sep 17 00:00:00 2001 From: Scoopta Date: Sun, 14 Jun 2020 01:24:37 -0700 Subject: [PATCH] Fixed expanders not contracting when -w > 1 --- src/wofi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wofi.c b/src/wofi.c index 2d7034e..857a633 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -97,6 +97,7 @@ static uint8_t konami_cycle; static bool is_konami = false; static GDBusProxy* dbus = NULL; static GdkRectangle resolution = {0}; +static bool resize_expander = false; static struct map* keys; @@ -440,7 +441,8 @@ static void activate_item(GtkFlowBox* flow_box, GtkFlowBoxChild* row, gpointer d static void expand(GtkExpander* expander, gpointer data) { (void) data; GtkWidget* box = gtk_bin_get_child(GTK_BIN(expander)); - gtk_widget_set_visible(box, !gtk_expander_get_expanded(expander)); + resize_expander = !gtk_expander_get_expanded(expander); + gtk_widget_set_visible(box, resize_expander); } static void update_surface_size(void) { @@ -456,12 +458,10 @@ static void update_surface_size(void) { static void widget_allocate(GtkWidget* widget, GdkRectangle* allocation, gpointer data) { (void) data; - if(GTK_IS_FLOW_BOX_CHILD(widget)) { - GtkWidget* expander = gtk_bin_get_child(GTK_BIN(widget)); - if(GTK_IS_EXPANDER(expander) && gtk_expander_get_expanded(GTK_EXPANDER(expander))) { - return; - } + if(resize_expander) { + return; } + if(max_height > 0) { if(allocation->height > max_height) { int64_t ratio = allocation->height / max_height;