Fixed expanders not contracting when -w > 1

This commit is contained in:
Scoopta 2020-06-14 01:24:37 -07:00
parent 1e63240dc8
commit b4b7d4be4e

View File

@ -97,6 +97,7 @@ static uint8_t konami_cycle;
static bool is_konami = false; static bool is_konami = false;
static GDBusProxy* dbus = NULL; static GDBusProxy* dbus = NULL;
static GdkRectangle resolution = {0}; static GdkRectangle resolution = {0};
static bool resize_expander = false;
static struct map* keys; 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) { static void expand(GtkExpander* expander, gpointer data) {
(void) data; (void) data;
GtkWidget* box = gtk_bin_get_child(GTK_BIN(expander)); 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) { 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) { static void widget_allocate(GtkWidget* widget, GdkRectangle* allocation, gpointer data) {
(void) data; (void) data;
if(GTK_IS_FLOW_BOX_CHILD(widget)) { if(resize_expander) {
GtkWidget* expander = gtk_bin_get_child(GTK_BIN(widget));
if(GTK_IS_EXPANDER(expander) && gtk_expander_get_expanded(GTK_EXPANDER(expander))) {
return; return;
} }
}
if(max_height > 0) { if(max_height > 0) {
if(allocation->height > max_height) { if(allocation->height > max_height) {
int64_t ratio = allocation->height / max_height; int64_t ratio = allocation->height / max_height;