[gtk/shortcuts-sizing] Fix shortcuts window sizing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/shortcuts-sizing] Fix shortcuts window sizing
- Date: Wed, 29 May 2019 21:12:49 +0000 (UTC)
commit e0cc72e94fce3044afe5df97c1df065e9deae5c0
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 29 17:06:27 2019 -0400
Fix shortcuts window sizing
We were deferring the reflow until map, but this
leads to the section initially having an enormous
height and the window picks up that size before
we have a chance to reflow, This could be seen
in the "Builder" demo in gtk4-demo.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/11
gtk/gtkshortcutssection.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index e597b20be9..1837660a01 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -70,7 +70,6 @@ struct _GtkShortcutsSection
GList *groups;
gboolean has_filtered_group;
- gboolean need_reflow;
};
struct _GtkShortcutsSectionClass
@@ -111,7 +110,6 @@ static void gtk_shortcuts_section_add_group (GtkShortcutsSection *self,
static void gtk_shortcuts_section_show_all (GtkShortcutsSection *self);
static void gtk_shortcuts_section_filter_groups (GtkShortcutsSection *self);
static void gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self);
-static void gtk_shortcuts_section_maybe_reflow (GtkShortcutsSection *self);
static gboolean gtk_shortcuts_section_change_current_page (GtkShortcutsSection *self,
gint offset);
@@ -180,9 +178,6 @@ gtk_shortcuts_section_map (GtkWidget *widget)
{
GtkShortcutsSection *self = GTK_SHORTCUTS_SECTION (widget);
- if (self->need_reflow)
- gtk_shortcuts_section_reflow_groups (self);
-
GTK_WIDGET_CLASS (gtk_shortcuts_section_parent_class)->map (widget);
map_child (GTK_WIDGET (self->stack));
@@ -485,7 +480,7 @@ gtk_shortcuts_section_set_max_height (GtkShortcutsSection *self,
self->max_height = max_height;
- gtk_shortcuts_section_maybe_reflow (self);
+ gtk_shortcuts_section_reflow_groups (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MAX_HEIGHT]);
}
@@ -520,7 +515,7 @@ gtk_shortcuts_section_add_group (GtkShortcutsSection *self,
gtk_container_add (GTK_CONTAINER (column), GTK_WIDGET (group));
self->groups = g_list_append (self->groups, group);
- gtk_shortcuts_section_maybe_reflow (self);
+ gtk_shortcuts_section_reflow_groups (self);
}
static void
@@ -568,15 +563,6 @@ gtk_shortcuts_section_filter_groups (GtkShortcutsSection *self)
gtk_widget_get_visible (GTK_WIDGET (self->switcher)));
}
-static void
-gtk_shortcuts_section_maybe_reflow (GtkShortcutsSection *self)
-{
- if (gtk_widget_get_mapped (GTK_WIDGET (self)))
- gtk_shortcuts_section_reflow_groups (self);
- else
- self->need_reflow = TRUE;
-}
-
static void
adjust_page_buttons (GtkWidget *widget,
gpointer data)
@@ -761,8 +747,6 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
/* clean up */
g_list_free (groups);
g_list_free (pages);
-
- self->need_reflow = FALSE;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]