diff options
author | Benjamin Otte <otte@redhat.com> | 2014-08-14 04:43:45 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-08-15 16:35:37 +0200 |
commit | 528b7ef8e984bb8df539e5f645db771ffd368caf (patch) | |
tree | 40ee69ee4689df9844a5df8b3a76fcc86858e9e4 | |
parent | 5085422c9e6eb6a6f2c0f4b3ef97524033508f12 (diff) | |
download | gtk+-528b7ef8e984bb8df539e5f645db771ffd368caf.tar.gz |
button: Don't honor child-displacement anymore
It doesn't make sense to support child displacement in a world where
pseudoclasses behave different from the actual displacement states.
Nobody would ever understand why a widget is displaced.
It is easily possible to simulate child displacement by using padding
CSS properties.
-rw-r--r-- | gtk/gtkbutton.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 5a9e4e9aca..3d90b8075e 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -518,7 +518,7 @@ gtk_button_class_init (GtkButtonClass *klass) G_MININT, G_MAXINT, 0, - GTK_PARAM_READABLE)); + GTK_PARAM_READABLE|G_PARAM_DEPRECATED)); gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("child-displacement-y", P_("Child Y Displacement"), @@ -526,7 +526,7 @@ gtk_button_class_init (GtkButtonClass *klass) G_MININT, G_MAXINT, 0, - GTK_PARAM_READABLE)); + GTK_PARAM_READABLE|G_PARAM_DEPRECATED)); /** * GtkButton:displace-focus: @@ -541,7 +541,7 @@ gtk_button_class_init (GtkButtonClass *klass) P_("Displace focus"), P_("Whether the child_displacement_x/_y properties should also affect the focus rectangle"), FALSE, - GTK_PARAM_READABLE)); + GTK_PARAM_READABLE|G_PARAM_DEPRECATED)); /** * GtkButton:inner-border: @@ -1770,21 +1770,6 @@ gtk_button_size_allocate (GtkWidget *widget, if (baseline != -1) baseline -= border.top; - if (priv->depressed) - { - gint child_displacement_x; - gint child_displacement_y; - - gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (button)), - "child-displacement-x", &child_displacement_x, - "child-displacement-y", &child_displacement_y, - NULL); - child_allocation.x += child_displacement_x; - child_allocation.y += child_displacement_y; - if (baseline != -1) - baseline -= child_displacement_y; - } - child_allocation.width = MAX (1, child_allocation.width); child_allocation.height = MAX (1, child_allocation.height); @@ -1838,16 +1823,8 @@ gtk_button_draw (GtkWidget *widget, if (gtk_widget_has_visible_focus (widget)) { - gint child_displacement_x; - gint child_displacement_y; - gboolean displace_focus; GtkBorder border; - gtk_style_context_get_style (context, - "child-displacement-y", &child_displacement_y, - "child-displacement-x", &child_displacement_x, - "displace-focus", &displace_focus, - NULL); gtk_style_context_get_border (context, state, &border); x += border.left; @@ -1855,12 +1832,6 @@ gtk_button_draw (GtkWidget *widget, width -= border.left + border.right; height -= border.top + border.bottom; - if (priv->depressed && displace_focus) - { - x += child_displacement_x; - y += child_displacement_y; - } - gtk_render_focus (context, cr, x, y, width, height); } |