From 278b3116ded62f111cb5858239696e95547dcfe4 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 28 Apr 2017 14:15:25 +0200 Subject: [PATCH] Box::pack_start/pack_end(options): Avoid setting child properties when possible. PackOptions::SHRINK seems to correspond with the default behaviour of the new gtk_box_pack_start()/pack_end(), so in this case it seems wise to avoid the complication of setting the child properties unnecessarily. --- gtk/src/box.ccg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtk/src/box.ccg b/gtk/src/box.ccg index 218ca437..94a1abc8 100644 --- a/gtk/src/box.ccg +++ b/gtk/src/box.ccg @@ -25,6 +25,10 @@ namespace Gtk void Box::pack_start(Widget& child, PackOptions options) { + if (options == PackOptions::SHRINK) { + return pack_start(); + } + const bool expand = (options == PackOptions::EXPAND_PADDING) || (options == PackOptions::EXPAND_WIDGET); const bool fill = (options == PackOptions::EXPAND_WIDGET); @@ -38,6 +42,10 @@ void Box::pack_start(Widget& child, PackOptions options) void Box::pack_end(Widget& child, PackOptions options) { + if (options == PackOptions::SHRINK) { + return pack_start(); + } + const bool expand = (options == PackOptions::EXPAND_PADDING) || (options == PackOptions::EXPAND_WIDGET); const bool fill = (options == PackOptions::EXPAND_WIDGET); -- 2.11.0