[gtk+/gtk-3-22] Popover: Include window shadows in overshoot calcs
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] Popover: Include window shadows in overshoot calcs
- Date: Thu, 24 Aug 2017 20:43:01 +0000 (UTC)
commit 947bca195cddd645e36eb5fa040bd6bc57bde395
Author: Daniel Boles <dboles src gnome org>
Date: Wed Aug 23 21:44:10 2017 +0100
Popover: Include window shadows in overshoot calcs
.update_position() enforces that non-Wayland platforms must position a
Popover within its parent Window. We use the allocation of the Window
to translate the position and check for overshoot on each of its sides.
Calling Widget.get_allocation() of a CSD Window includes its shadows.
But shadows were not excluded from the area in which we can position.
Thus, Popovers could get positioned in the shadow of CSD windows, where,
at least on X11, no input is received. Therefore, positioning a Popover
over a shadow meant its child widgets within that area became unusable.
Fix by calling Window.get_shadow() and including it in the overshoot on
each side. This adjusts for how the allocation includes shadows, making
overshoots with and without shadows the same. Thus, we avoid considering
shadows as viable for positioning, favouring a side where input works.
https://bugzilla.gnome.org/show_bug.cgi?id=786209
gtk/gtkpopover.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 005adc7..b8818fe 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1042,6 +1042,7 @@ gtk_popover_update_position (GtkPopover *popover)
GtkPopoverPrivate *priv = popover->priv;
GtkWidget *widget = GTK_WIDGET (popover);
GtkAllocation window_alloc;
+ GtkBorder window_shadow;
GdkRectangle rect;
GtkRequisition req;
GtkPositionType pos;
@@ -1054,6 +1055,7 @@ gtk_popover_update_position (GtkPopover *popover)
gtk_widget_get_preferred_size (widget, NULL, &req);
gtk_widget_get_allocation (GTK_WIDGET (priv->window), &window_alloc);
+ _gtk_window_get_shadow_width (priv->window, &window_shadow);
priv->final_position = priv->preferred_position;
gtk_popover_get_pointing_to (popover, &rect);
@@ -1062,10 +1064,12 @@ gtk_popover_update_position (GtkPopover *popover)
pos = get_effective_position (popover, priv->preferred_position);
- overshoot[GTK_POS_TOP] = req.height - rect.y;
- overshoot[GTK_POS_BOTTOM] = rect.y + rect.height + req.height - window_alloc.height;
- overshoot[GTK_POS_LEFT] = req.width - rect.x;
- overshoot[GTK_POS_RIGHT] = rect.x + rect.width + req.width - window_alloc.width;
+ overshoot[GTK_POS_TOP] = req.height - rect.y + window_shadow.top;
+ overshoot[GTK_POS_BOTTOM] = rect.y + rect.height + req.height - window_alloc.height
+ + window_shadow.bottom;
+ overshoot[GTK_POS_LEFT] = req.width - rect.x + window_shadow.left;
+ overshoot[GTK_POS_RIGHT] = rect.x + rect.width + req.width - window_alloc.width
+ + window_shadow.right;
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)) &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]