[gnome-builder] layout: avoid jumps in natural size
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] layout: avoid jumps in natural size
- Date: Tue, 13 Mar 2018 23:51:38 +0000 (UTC)
commit 552b63046e5023f688d9e37e4c0972f11a25e6b4
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 13 16:50:07 2018 -0700
layout: avoid jumps in natural size
This helps reduce size jitter in the grid due to changes of natural
size in the stack header (such as from our "modified asterisk").
src/libide/layout/ide-layout-stack-header.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/libide/layout/ide-layout-stack-header.c b/src/libide/layout/ide-layout-stack-header.c
index 782cfd094..faa754511 100644
--- a/src/libide/layout/ide-layout-stack-header.c
+++ b/src/libide/layout/ide-layout-stack-header.c
@@ -470,6 +470,25 @@ ide_layout_stack_header_add (GtkContainer *container,
update_widget_providers (widget, self);
}
+static void
+ide_layout_stack_header_get_preferred_width (GtkWidget *widget,
+ gint *min_width,
+ gint *nat_width)
+{
+ g_assert (IDE_IS_LAYOUT_STACK_HEADER (widget));
+ g_assert (min_width != NULL);
+ g_assert (nat_width != NULL);
+
+ GTK_WIDGET_CLASS (ide_layout_stack_header_parent_class)->get_preferred_width (widget, min_width,
nat_width);
+
+ /*
+ * We don't want changes to the natural width to influence our positioning of
+ * the grid separators (unless necessary). So instead, we always return our
+ * minimum position as our natural size and let the grid expand as necessary.
+ */
+ *nat_width = *min_width;
+}
+
static void
ide_layout_stack_header_destroy (GtkWidget *widget)
{
@@ -561,6 +580,7 @@ ide_layout_stack_header_class_init (IdeLayoutStackHeaderClass *klass)
object_class->set_property = ide_layout_stack_header_set_property;
widget_class->destroy = ide_layout_stack_header_destroy;
+ widget_class->get_preferred_width = ide_layout_stack_header_get_preferred_width;
container_class->add = ide_layout_stack_header_add;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]