* xterm.h (struct x_output): New member, toolbar_detached.
authorJan Djärv <jan.h.d@swipnet.se>
Sat, 8 Jan 2005 16:49:14 +0000 (16:49 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Sat, 8 Jan 2005 16:49:14 +0000 (16:49 +0000)
* gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to
38.
(xg_tool_bar_detach_callback): Set toolbar_detached to 1.
(xg_tool_bar_attach_callback): Set toolbar_detached to 0.
(xg_create_tool_bar): Initialize toolbar_detached.
(update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if
toolbar_detached is zero.

src/ChangeLog
src/gtkutil.c
src/xterm.h

index 8a267b4..2326957 100644 (file)
@@ -1,3 +1,15 @@
+2005-01-08  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
+
+       * xterm.h (struct x_output): New member, toolbar_detached.
+
+       * gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to
+       38.
+       (xg_tool_bar_detach_callback): Set toolbar_detached to 1.
+       (xg_tool_bar_attach_callback): Set toolbar_detached to 0.
+       (xg_create_tool_bar): Initialize toolbar_detached.
+       (update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if
+       toolbar_detached is zero.
+
 2005-01-07  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * xmenu.c (create_and_show_popup_menu): Pass zero as button to
index 686168b..39d5e76 100644 (file)
@@ -756,7 +756,7 @@ xg_create_frame_widgets (f)
      So we cheat a bit by setting a height that is what it will have
      later on when tool bar items are added.  */
   if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0)
-    FRAME_TOOLBAR_HEIGHT (f) = 34;
+    FRAME_TOOLBAR_HEIGHT (f) = 38;
 
 
   /* We don't want this widget double buffered, because we draw on it
@@ -3156,6 +3156,8 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
 
   if (f)
     {
+      FRAME_X_OUTPUT (f)->toolbar_detached = 1;
+
       /* When detaching a tool bar, not everything dissapear.  There are
          a few pixels left that are used to drop the tool bar back into
          place.  */
@@ -3187,11 +3189,13 @@ xg_tool_bar_attach_callback (wbox, w, client_data)
     {
       GtkRequisition req;
 
+      FRAME_X_OUTPUT (f)->toolbar_detached = 0;
+
       gtk_widget_size_request (w, &req);
       FRAME_TOOLBAR_HEIGHT (f) = req.height;
 
       /* The height has changed, resize outer widget and set columns
-         rows to what we had before detaching the tool bar.  */
+         rows to what we had before attaching the tool bar.  */
       xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
     }
 }
@@ -3305,6 +3309,8 @@ xg_create_tool_bar (f)
 
   x->toolbar_widget = gtk_toolbar_new ();
   x->handlebox_widget = gtk_handle_box_new ();
+  x->toolbar_detached = 0;
+
   gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
                      x->toolbar_widget);
 
@@ -3537,7 +3543,8 @@ update_frame_tool_bar (f)
     }
 
   gtk_widget_size_request (x->toolbar_widget, &new_req);
-  if (old_req.height != new_req.height)
+  if (old_req.height != new_req.height
+      && ! FRAME_X_OUTPUT (f)->toolbar_detached)
     {
       FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
       xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f));
index 2f71f64..2c24dcd 100644 (file)
@@ -499,6 +499,8 @@ struct x_output
   GtkWidget *toolbar_widget;
   /* The handle box that makes the tool bar detachable.  */
   GtkWidget *handlebox_widget;
+  /* Non-zero if the tool bar is detached.  */
+  int toolbar_detached;
 
   /* The last size hints set.  */
   GdkGeometry size_hints;