[libadwaita/wip/exalm/leaflet-shadow: 5/5] leaflet: Clip the over child during transition too




commit 6165020ef6f92fbc44824fa1e56baf5590c194f0
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Mar 30 00:01:11 2022 +0400

    leaflet: Clip the over child during transition too
    
    Avoid widgets bleeding into the shadow, e.g. headerbars.

 src/adw-leaflet.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-leaflet.c b/src/adw-leaflet.c
index 989557f1..de478fcb 100644
--- a/src/adw-leaflet.c
+++ b/src/adw-leaflet.c
@@ -1969,12 +1969,39 @@ adw_leaflet_snapshot (GtkWidget   *widget,
   for (l = stacked_children; l; l = l->next) {
     AdwLeafletPage *page = l->data;
 
-    if (page == overlap_child)
+    if (page == overlap_child) {
       gtk_snapshot_pop (snapshot);
 
+      if (is_vertical) {
+        if (!is_over) {
+          shadow_rect.height = shadow_rect.y;
+          shadow_rect.y = 0;
+        } else {
+          shadow_rect.y = shadow_rect.height;
+          shadow_rect.height = overlap_child->alloc.height - shadow_rect.height;
+        }
+      } else {
+        if (is_over == is_rtl) {
+          shadow_rect.width = shadow_rect.x;
+          shadow_rect.x = 0;
+        } else {
+          shadow_rect.x = shadow_rect.width;
+          shadow_rect.width = overlap_child->alloc.width - shadow_rect.width;
+        }
+      }
+
+      gtk_snapshot_push_clip (snapshot,
+                              &GRAPHENE_RECT_INIT (shadow_rect.x,
+                                                   shadow_rect.y,
+                                                   shadow_rect.width,
+                                                   shadow_rect.height));
+    }
+
     gtk_widget_snapshot_child (widget, page->widget, snapshot);
   }
 
+  gtk_snapshot_pop (snapshot);
+
   adw_shadow_helper_snapshot (self->shadow_helper, snapshot);
 }
 


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