summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-02-13 20:48:15 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-02-14 10:11:17 -0500
commitaec738745a014925899611e333a35aac796ab895 (patch)
treeca70befcce516733ac6a33fcad1cce1babddc092
parentea19f7c360c82091c00b900d6bc00508a02f90e8 (diff)
downloadgtk+-aec738745a014925899611e333a35aac796ab895.tar.gz
wayland: Set shadow width on popup surfaces
Take the shadow width from the popup layout into account.
-rw-r--r--gdk/wayland/gdksurface-wayland.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index d31e4ae6ee..2f95339fb0 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -630,12 +630,19 @@ static void
configure_popup_geometry (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
+ int x, y;
+ int width, height;
+
+ x = impl->next_layout.popup.x - impl->shadow_left;
+ y = impl->next_layout.popup.y - impl->shadow_top;
+ width =
+ impl->next_layout.configured_width +
+ (impl->shadow_left + impl->shadow_right);
+ height =
+ impl->next_layout.configured_height +
+ (impl->shadow_top + impl->shadow_bottom);
- gdk_wayland_surface_move_resize (surface,
- impl->next_layout.popup.x,
- impl->next_layout.popup.y,
- impl->next_layout.configured_width,
- impl->next_layout.configured_height);
+ gdk_wayland_surface_move_resize (surface, x, y, width, height);
}
static void
@@ -2289,12 +2296,17 @@ calculate_popup_rect (GdkSurface *surface,
int width, height;
GdkRectangle anchor_rect;
int dx, dy;
+ int shadow_left, shadow_right, shadow_top, shadow_bottom;
int x = 0, y = 0;
- width = (impl->popup.unconstrained_width -
- (impl->shadow_left + impl->shadow_right));
- height = (impl->popup.unconstrained_height -
- (impl->shadow_top + impl->shadow_bottom));
+ gdk_popup_layout_get_shadow_width (layout,
+ &shadow_left,
+ &shadow_right,
+ &shadow_top,
+ &shadow_bottom);
+
+ width = (impl->popup.unconstrained_width - (shadow_left + shadow_right));
+ height = (impl->popup.unconstrained_height - (shadow_top + shadow_bottom));
anchor_rect = *gdk_popup_layout_get_anchor_rect (layout);
gdk_popup_layout_get_offset (layout, &dx, &dy);
@@ -2478,7 +2490,6 @@ create_dynamic_positioner (GdkSurface *surface,
GdkPopupLayout *layout,
gboolean ack_parent_configure)
{
- GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkSurface *parent = surface->parent;
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
GdkWaylandDisplay *display =
@@ -2493,12 +2504,21 @@ create_dynamic_positioner (GdkSurface *surface,
GdkGravity rect_anchor;
GdkGravity surface_anchor;
GdkAnchorHints anchor_hints;
+ int shadow_left;
+ int shadow_right;
+ int shadow_top;
+ int shadow_bottom;
+ gdk_popup_layout_get_shadow_width (layout,
+ &shadow_left,
+ &shadow_right,
+ &shadow_top,
+ &shadow_bottom);
geometry = (GdkRectangle) {
- .x = impl->shadow_left,
- .y = impl->shadow_top,
- .width = width - (impl->shadow_left + impl->shadow_right),
- .height = height - (impl->shadow_top + impl->shadow_bottom),
+ .x = shadow_left,
+ .y = shadow_top,
+ .width = width - (shadow_left + shadow_right),
+ .height = height - (shadow_top + shadow_bottom),
};
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
@@ -2724,6 +2744,12 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
g_assert_not_reached ();
}
+ gdk_popup_layout_get_shadow_width (layout,
+ &impl->shadow_left,
+ &impl->shadow_right,
+ &impl->shadow_top,
+ &impl->shadow_bottom);
+
if (grab_input_seat)
{
struct wl_seat *seat;