Account for the fact that the border width is _outside_ the allocation.

Thu May 31 12:43:57 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkoptionmenu.c: Account for the fact that the border
	width is _outside_ the allocation. (Fixes #54585)
This commit is contained in:
Owen Taylor
2001-05-31 18:22:24 +00:00
committed by Owen Taylor
parent 4e966d0f97
commit 2b78a9abc9
8 changed files with 49 additions and 16 deletions

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -1,3 +1,8 @@
Thu May 31 12:43:57 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c: Account for the fact that the border
width is _outside_ the allocation. (Fixes #54585)
2001-04-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus_filter): Only consider

View File

@@ -342,30 +342,26 @@ gtk_option_menu_size_allocate (GtkWidget *widget,
GtkWidget *child;
GtkAllocation child_allocation;
GtkOptionMenuProps props;
gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
g_return_if_fail (allocation != NULL);
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
border_width = GTK_CONTAINER (widget)->border_width;
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
allocation->x + border_width, allocation->y + border_width,
allocation->width - 2 * border_width, allocation->height - 2 * border_width);
child = GTK_BIN (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->xthickness) + 1;
child_allocation.y = (GTK_CONTAINER (widget)->border_width +
GTK_WIDGET (widget)->style->klass->ythickness) + 1;
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2 -
child_allocation.x = GTK_WIDGET (widget)->style->klass->xthickness + 1;
child_allocation.y = GTK_WIDGET (widget)->style->klass->ythickness + 1;
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2 - border_width * 2 -
props.indicator_width - props.indicator_left_spacing - props.indicator_right_spacing -
CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING - 2);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2 -
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2 - border_width * 2 -
CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING - 2);
child_allocation.x += CHILD_LEFT_SPACING;
child_allocation.y += CHILD_TOP_SPACING;
@@ -380,6 +376,7 @@ gtk_option_menu_paint (GtkWidget *widget,
{
GdkRectangle button_area;
GtkOptionMenuProps props;
gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_OPTION_MENU (widget));
@@ -388,11 +385,12 @@ gtk_option_menu_paint (GtkWidget *widget,
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
border_width = GTK_CONTAINER (widget)->border_width;
button_area.x = GTK_CONTAINER (widget)->border_width + 1;
button_area.y = GTK_CONTAINER (widget)->border_width + 1;
button_area.width = widget->allocation.width - button_area.x * 2;
button_area.height = widget->allocation.height - button_area.y * 2;
button_area.x = 1;
button_area.y = 1;
button_area.width = widget->allocation.width - button_area.x * 2 - border_width * 2;
button_area.height = widget->allocation.height - button_area.y * 2 - border_width * 2;
/* This is evil, and should be elimated here and in the button
* code. The point is to clear the focus, and make it