menuitem: really ignore horizontal-padding

This style property has been documented as been ignored for a long time,
but we were still reading it in some cases.
This commit is contained in:
Cosimo Cecchi 2015-12-17 17:46:31 -08:00
parent f792d20507
commit 35ed13ac54
2 changed files with 7 additions and 10 deletions

View File

@ -645,12 +645,11 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
GtkBorder padding; GtkBorder padding;
GtkRequisition child_requisition; GtkRequisition child_requisition;
GtkAllocation child_allocation; GtkAllocation child_allocation;
guint horizontal_padding, toggle_spacing; guint toggle_spacing;
gint toggle_size; gint toggle_size;
toggle_size = GTK_MENU_ITEM (image_menu_item)->priv->toggle_size; toggle_size = GTK_MENU_ITEM (image_menu_item)->priv->toggle_size;
gtk_widget_style_get (widget, gtk_widget_style_get (widget,
"horizontal-padding", &horizontal_padding,
"toggle-spacing", &toggle_spacing, "toggle-spacing", &toggle_spacing,
NULL); NULL);
@ -672,10 +671,10 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
{ {
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) == if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
(pack_dir == GTK_PACK_DIRECTION_LTR)) (pack_dir == GTK_PACK_DIRECTION_LTR))
x = offset + horizontal_padding + padding.left + x = offset + padding.left +
(toggle_size - toggle_spacing - child_requisition.width) / 2; (toggle_size - toggle_spacing - child_requisition.width) / 2;
else else
x = widget_allocation.width - offset - horizontal_padding - padding.right - x = widget_allocation.width - offset - padding.right -
toggle_size + toggle_spacing + toggle_size + toggle_spacing +
(toggle_size - toggle_spacing - child_requisition.width) / 2; (toggle_size - toggle_spacing - child_requisition.width) / 2;
@ -685,10 +684,10 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
{ {
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) == if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) ==
(pack_dir == GTK_PACK_DIRECTION_TTB)) (pack_dir == GTK_PACK_DIRECTION_TTB))
y = offset + horizontal_padding + padding.top + y = offset + padding.top +
(toggle_size - toggle_spacing - child_requisition.height) / 2; (toggle_size - toggle_spacing - child_requisition.height) / 2;
else else
y = widget_allocation.height - offset - horizontal_padding - padding.bottom - y = widget_allocation.height - offset - padding.bottom -
toggle_size + toggle_spacing + toggle_size + toggle_spacing +
(toggle_size - toggle_spacing - child_requisition.height) / 2; (toggle_size - toggle_spacing - child_requisition.height) / 2;

View File

@ -649,7 +649,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
guint offset; guint offset;
guint toggle_size; guint toggle_size;
guint toggle_spacing; guint toggle_spacing;
guint horizontal_padding;
guint indicator_size; guint indicator_size;
GtkStateFlags state; GtkStateFlags state;
GtkBorder padding; GtkBorder padding;
@ -662,7 +661,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
gtk_widget_style_get (widget, gtk_widget_style_get (widget,
"toggle-spacing", &toggle_spacing, "toggle-spacing", &toggle_spacing,
"horizontal-padding", &horizontal_padding,
"indicator-size", &indicator_size, "indicator-size", &indicator_size,
NULL); NULL);
@ -672,13 +670,13 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
{ {
x = offset + horizontal_padding + x = offset +
(toggle_size - toggle_spacing - indicator_size) / 2; (toggle_size - toggle_spacing - indicator_size) / 2;
} }
else else
{ {
x = allocation.width - x = allocation.width -
offset - horizontal_padding - toggle_size + toggle_spacing + offset - toggle_size + toggle_spacing +
(toggle_size - toggle_spacing - indicator_size) / 2; (toggle_size - toggle_spacing - indicator_size) / 2;
} }