GtkMenuBar patch
- From: Jacob Berkman <jacob helixcode com>
- To: gtk-devel-list redhat com
- Cc: federico helixcode com
- Subject: GtkMenuBar patch
- Date: 26 Jan 2000 17:56:51 -0500
Hello,
This patch (against -1-2) eliminates some pixels around the menu bar
if no shadow is selected.
It seems logical that if you don't want a shadow, then you probably
don't want the extra pixels.
Jacob
--
"Beware of bugs in the above code; I have only
proved it correct, not tried it." -- D. Knuth
Index: gtkmenubar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenubar.c,v
retrieving revision 1.18
diff -u -r1.18 gtkmenubar.c
--- gtkmenubar.c 1999/02/24 07:35:24 1.18
+++ gtkmenubar.c 2000/01/26 00:49:18
@@ -217,6 +217,8 @@
GList *children;
gint nchildren;
GtkRequisition child_requisition;
+ gint xthickness;
+ gint ythickness;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -256,12 +258,21 @@
}
}
+ if (menu_bar->shadow_type == GTK_SHADOW_NONE)
+ {
+ xthickness = 0;
+ ythickness = 0;
+ }
+ else
+ {
+ xthickness = widget->style->klass->xthickness;
+ ythickness = widget->style->klass->ythickness;
+ }
+
requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING) * 2;
+ xthickness + BORDER_SPACING) * 2;
requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
- BORDER_SPACING) * 2;
+ ythickness + BORDER_SPACING) * 2;
if (nchildren > 0)
requisition->width += 2 * CHILD_SPACING * (nchildren - 1);
@@ -279,6 +290,8 @@
GtkAllocation child_allocation;
GtkRequisition child_requisition;
guint offset;
+ gint xthickness;
+ gint ythickness;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -295,14 +308,23 @@
if (menu_shell->children)
{
+ if (menu_bar->shadow_type == GTK_SHADOW_NONE)
+ {
+ xthickness = 0;
+ ythickness = 0;
+ }
+ else
+ {
+ xthickness = widget->style->klass->xthickness;
+ ythickness = widget->style->klass->ythickness;
+ }
+
child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING);
+ xthickness + BORDER_SPACING);
offset = child_allocation.x; /* Window edge to menubar start */
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
- BORDER_SPACING);
+ ythickness + BORDER_SPACING);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
children = menu_shell->children;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]