[libhandy/wip/exalm/css: 14/17] avatar: Account for box-shadow when clipping
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/css: 14/17] avatar: Account for box-shadow when clipping
- Date: Wed, 27 May 2020 11:01:40 +0000 (UTC)
commit 3a8d2456f51f59bbde1220d3ffc57c2782a940e5
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu May 21 00:45:42 2020 +0500
avatar: Account for box-shadow when clipping
src/hdy-avatar.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/src/hdy-avatar.c b/src/hdy-avatar.c
index 588ab7a3..324292e7 100644
--- a/src/hdy-avatar.c
+++ b/src/hdy-avatar.c
@@ -461,6 +461,23 @@ hdy_avatar_get_request_mode (GtkWidget *widget)
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
+static void
+hdy_avatar_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_avatar_parent_class)->size_allocate (widget, allocation);
+ gtk_widget_set_clip (widget, &clip);
+}
+
static void
hdy_avatar_class_init (HdyAvatarClass *klass)
{
@@ -478,6 +495,7 @@ hdy_avatar_class_init (HdyAvatarClass *klass)
widget_class->get_preferred_height = hdy_avatar_get_preferred_height;
widget_class->get_preferred_width_for_height = hdy_avatar_get_preferred_width_for_height;
widget_class->get_preferred_height_for_width = hdy_avatar_get_preferred_height_for_width;
+ widget_class->size_allocate = hdy_avatar_size_allocate;
/**
* HdyAvatar:size:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]