[libhandy/wip/exalm/css: 15/17] title-bar: Account for box-shadow when clipping



commit 8cc9b8b2c98b7e52aaf6d9c783075afc08a6720a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu May 21 00:50:04 2020 +0500

    title-bar: Account for box-shadow when clipping

 src/hdy-title-bar.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/src/hdy-title-bar.c b/src/hdy-title-bar.c
index 7c6cb8c9..cdc8b392 100644
--- a/src/hdy-title-bar.c
+++ b/src/hdy-title-bar.c
@@ -164,6 +164,23 @@ hdy_title_bar_draw (GtkWidget *widget,
   return GTK_WIDGET_CLASS (hdy_title_bar_parent_class)->draw (widget, cr);
 }
 
+static void
+hdy_title_bar_size_allocate (GtkWidget     *widget,
+                             GtkAllocation *allocation)
+{
+  GtkAllocation clip;
+
+  gtk_render_background_get_clip (gtk_widget_get_style_context (widget),
+                                  allocation->x,
+                                  allocation->y,
+                                  allocation->width,
+                                  allocation->height,
+                                  &clip);
+
+  GTK_WIDGET_CLASS (hdy_title_bar_parent_class)->size_allocate (widget, allocation);
+  gtk_widget_set_clip (widget, &clip);
+}
+
 static void
 hdy_title_bar_class_init (HdyTitleBarClass *klass)
 {
@@ -175,6 +192,7 @@ hdy_title_bar_class_init (HdyTitleBarClass *klass)
   object_class->set_property = hdy_title_bar_set_property;
 
   widget_class->draw = hdy_title_bar_draw;
+  widget_class->size_allocate = hdy_title_bar_size_allocate;
 
   /**
    * HdyTitleBar:selection_mode:


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