[libhandy] stackable-box: Ensure shadow caching for child transitions
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] stackable-box: Ensure shadow caching for child transitions
- Date: Thu, 25 Jun 2020 14:28:41 +0000 (UTC)
commit 1b15009faf09f02188ee31c3db18e9a2c1b053c8
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu Jun 25 17:49:41 2020 +0500
stackable-box: Ensure shadow caching for child transitions
This got lost in the rewrite, have the shadow partially end offscreen.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-stackable-box.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index eba62d6d..d230b255 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -2120,6 +2120,8 @@ hdy_stackable_box_draw (HdyStackableBox *self,
} else {
GtkPanDirection direction = self->child_transition.active_direction;
GtkPanDirection left_or_right = is_rtl ? GTK_PAN_DIRECTION_RIGHT : GTK_PAN_DIRECTION_LEFT;
+ gint width = gtk_widget_get_allocated_width (widget);
+ gint height = gtk_widget_get_allocated_height (widget);
if (direction == GTK_PAN_DIRECTION_UP || direction == left_or_right)
shadow_progress = self->child_transition.progress;
@@ -2128,6 +2130,15 @@ hdy_stackable_box_draw (HdyStackableBox *self,
if (is_over)
shadow_progress = 1 - shadow_progress;
+
+ /* Normalize the shadow rect size so that we can cache the shadow */
+ if (shadow_direction == GTK_PAN_DIRECTION_RIGHT)
+ shadow_rect.x -= (width - shadow_rect.width);
+ else if (shadow_direction == GTK_PAN_DIRECTION_DOWN)
+ shadow_rect.y -= (height - shadow_rect.height);
+
+ shadow_rect.width = width;
+ shadow_rect.height = height;
}
cairo_rectangle (cr, shadow_rect.x, shadow_rect.y, shadow_rect.width, shadow_rect.height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]