[gtk/popup-shadow-width] popover: Don't include shadow border in input region
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/popup-shadow-width] popover: Don't include shadow border in input region
- Date: Thu, 11 Feb 2021 08:52:31 +0000 (UTC)
commit f38a9df99de10da590f7aab7f52c198cc8700ac3
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Feb 11 09:50:26 2021 +0100
popover: Don't include shadow border in input region
This makes it possible to "click through" the shadow e.g. on the button
that opened a popover, to hide the popover. The popover shadow isn't
useful for anything, since it isn't used for triggering interactive
resize and the like.
gtk/gtkpopover.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 4fadbc1f0f..eef7d2ddde 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1309,7 +1309,31 @@ gtk_popover_update_shape (GtkPopover *popover)
cairo_region_destroy (region);
}
else
- gdk_surface_set_input_region (priv->surface, NULL);
+ {
+ GtkCssNode *content_css_node;
+ GtkCssStyle *style;
+ GtkBorder shadow_width;
+ cairo_rectangle_int_t input_rect;
+ cairo_region_t *region;
+
+ content_css_node =
+ gtk_widget_get_css_node (GTK_WIDGET (priv->contents_widget));
+ style = gtk_css_node_get_style (content_css_node);
+ gtk_css_shadow_value_get_extents (style->background->box_shadow, &shadow_width);
+
+ input_rect.x = shadow_width.left;
+ input_rect.y = shadow_width.top;
+ input_rect.width =
+ gdk_surface_get_width (priv->surface) -
+ (shadow_width.left + shadow_width.right);
+ input_rect.height =
+ gdk_surface_get_height (priv->surface) -
+ (shadow_width.top + shadow_width.bottom);
+
+ region = cairo_region_create_rectangle (&input_rect);
+ gdk_surface_set_input_region (priv->surface, region);
+ cairo_region_destroy (region);
+ }
}
static int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]