From 51b3a99c948dc83f3387f440702ab6e175b61e0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 14 Feb 2013 20:01:12 +0100 Subject: [PATCH] * gtkutil.c (tb_size_cb): New function. (xg_create_tool_bar): Connect size-allocate to tb_size_cb. Fixes: debbugs:13512 --- src/ChangeLog | 5 +++++ src/gtkutil.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 3c9ea256547..8b1c429e406 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-02-14 Jan Djärv + + * gtkutil.c (tb_size_cb): New function. + (xg_create_tool_bar): Connect size-allocate to tb_size_cb (Bug#13512). + 2013-02-14 Stefan Monnier * keyboard.c (active_maps): Fcurrent_active_maps expects a position, not diff --git a/src/gtkutil.c b/src/gtkutil.c index 4771d34b4a0..d6e4dcebcd3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4353,6 +4353,21 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) x->toolbar_is_packed = true; } +static bool xg_update_tool_bar_sizes (FRAME_PTR f); + +static void +tb_size_cb (GtkWidget *widget, + GdkRectangle *allocation, + gpointer user_data) +{ + /* When tool bar is created it has one preferred size. But when size is + allocated between widgets, it may get another. So we must update + size hints if tool bar size changes. Seen on Fedora 18 at least. */ + FRAME_PTR f = (FRAME_PTR) user_data; + if (xg_update_tool_bar_sizes (f)) + x_wm_set_size_hint (f, 0, 0); +} + /* Create a tool bar for frame F. */ static void @@ -4384,6 +4399,8 @@ xg_create_tool_bar (FRAME_PTR f) gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS); toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL); + g_signal_connect (x->toolbar_widget, "size-allocate", + G_CALLBACK (tb_size_cb), f); #if GTK_CHECK_VERSION (3, 3, 6) gsty = gtk_widget_get_style_context (x->toolbar_widget); gtk_style_context_add_class (gsty, "primary-toolbar"); -- 2.39.5