tiny gtkmenubar tweak



while I was trying to make a menubar that line wrapped, I noticed a
couple of things about the existing code (1.2.6).

- there's more space (3 pixels) between the right edge of the help
button and the right edge of the bar than between the left edge of the
file (or first) button and the left edge of the bar
- if you have more menu items than fit across the window, the right edge
of the menubar shadow is overwritten

Maybe this is too trivial :), but here's a patch.
--
--- gtkmenubar.original Wed Feb 23 15:48:18 2000
+++ gtkmenubar.c        Wed Feb 23 15:48:08 2000
@@ -245,12 +245,6 @@
 
              requisition->width += child_requisition.width;
              requisition->height = MAX (requisition->height,
child_requisition.height);
-             /* Support for the right justified help menu */
-             if ((children == NULL) && GTK_IS_MENU_ITEM(child) &&
-                 GTK_MENU_ITEM(child)->right_justify)
-               {
-                 requisition->width += CHILD_SPACING;
-               }
 
              nchildren += 1;
            }
@@ -318,11 +312,13 @@
              && (GTK_MENU_ITEM(child)->right_justify)) 
            {
              child_allocation.x = allocation->width -
-                 child_requisition.width - CHILD_SPACING - offset;
+                 child_requisition.width - offset;
            }
          if (GTK_WIDGET_VISIBLE (child))
            {
-             child_allocation.width = child_requisition.width;
+             child_allocation.width = MAX (1, MIN
((gint)allocation->width -
+                                           offset - child_allocation.x,
+                                           child_requisition.width));
 
              gtk_widget_size_allocate (child, &child_allocation);
--

John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)171 747 2570
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]