[gtk+/wip/clip: 5/6] widget: Include box-shadow in the clip



commit eb076c884add43b89c6dd819f08236912349e515
Author: Benjamin Otte <otte redhat com>
Date:   Fri May 23 15:52:16 2014 +0200

    widget: Include box-shadow in the clip
    
    This allows all widgets that implement clip to use box shadows.

 gtk/gtkcssstylepropertyimpl.c |    2 +-
 gtk/gtkwidget.c               |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 4bb8547..f1acf9a 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -1013,7 +1013,7 @@ _gtk_css_style_property_init_properties (void)
   gtk_css_style_property_register        ("box-shadow",
                                           GTK_CSS_PROPERTY_BOX_SHADOW,
                                           G_TYPE_NONE,
-                                          GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
+                                          GTK_STYLE_PROPERTY_ANIMATED,
                                           shadow_value_parse,
                                           NULL,
                                           NULL,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index bf608b3..46815c8 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -39,6 +39,7 @@
 #include "gtkclipboard.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkcssnumbervalueprivate.h"
+#include "gtkcssshadowsvalueprivate.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkselectionprivate.h"
@@ -15020,10 +15021,22 @@ union_with_clip (GtkWidget *widget,
 void
 _gtk_widget_set_css_clip (GtkWidget *widget)
 {
+  GtkStyleContext *context;
   GtkAllocation clip;
+  GtkBorder extents;
+
+  context = gtk_widget_get_style_context (widget);
 
   gtk_widget_get_allocation (widget, &clip);
 
+  _gtk_css_shadows_value_get_extents (_gtk_style_context_peek_property (context,
+                                                                        GTK_CSS_PROPERTY_BOX_SHADOW),
+                                      &extents);
+  clip.x -= extents.left;
+  clip.y -= extents.top;
+  clip.width += extents.left + extents.right;
+  clip.height += extents.top + extents.bottom;
+
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip);
 


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