]> git.eshelyaron.com Git - emacs.git/commitdiff
* gtkutil.c (tb_size_cb): New function.
authorJan Djärv <jan.h.d@swipnet.se>
Thu, 14 Feb 2013 19:01:12 +0000 (20:01 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Thu, 14 Feb 2013 19:01:12 +0000 (20:01 +0100)
(xg_create_tool_bar): Connect size-allocate to tb_size_cb.

Fixes: debbugs:13512
src/ChangeLog
src/gtkutil.c

index 3c9ea256547ed0d16a08898df672771de4479bf2..8b1c429e4069ea591dea49f6c4a70b7a5c6218f3 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * 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  <monnier@iro.umontreal.ca>
 
        * keyboard.c (active_maps): Fcurrent_active_maps expects a position, not
index 4771d34b4a032840389bc078787c4c37615db354..d6e4dcebcd3663950fced41fbb8de971326304fc 100644 (file)
@@ -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");