[gtk+/wip/checked: 4/6] button: Don't honor child-displacement anymore



commit 3c74a84c33f020225bb24fe85159a1fc0d75b709
Author: Benjamin Otte <otte redhat com>
Date:   Thu Aug 14 04:43:45 2014 +0200

    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.

 gtk/gtkbutton.c |   35 +++--------------------------------
 1 files changed, 3 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 5a9e4e9..3d90b80 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);
     }
 


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