mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
wayland: Avoid directly accessing shadow property of parent surface
This commit is contained in:
parent
5e53c0473a
commit
5bbdf3a807
@ -1570,7 +1570,7 @@ static void
|
|||||||
gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
||||||
{
|
{
|
||||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||||
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (surface->parent);
|
GdkRectangle parent_geometry;
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
if (impl->display_server.xdg_popup)
|
if (impl->display_server.xdg_popup)
|
||||||
@ -1610,8 +1610,9 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
|||||||
width = impl->pending.popup.width;
|
width = impl->pending.popup.width;
|
||||||
height = impl->pending.popup.height;
|
height = impl->pending.popup.height;
|
||||||
|
|
||||||
x += parent_impl->shadow_left;
|
gdk_wayland_surface_get_window_geometry (surface->parent, &parent_geometry);
|
||||||
y += parent_impl->shadow_top;
|
x += parent_geometry.x;
|
||||||
|
y += parent_geometry.y;
|
||||||
|
|
||||||
update_popup_layout_state (surface,
|
update_popup_layout_state (surface,
|
||||||
x, y,
|
x, y,
|
||||||
@ -2518,6 +2519,7 @@ create_dynamic_positioner (GdkSurface *surface,
|
|||||||
GdkGravity rect_anchor;
|
GdkGravity rect_anchor;
|
||||||
GdkGravity surface_anchor;
|
GdkGravity surface_anchor;
|
||||||
GdkAnchorHints anchor_hints;
|
GdkAnchorHints anchor_hints;
|
||||||
|
GdkRectangle parent_geometry;
|
||||||
int shadow_left;
|
int shadow_left;
|
||||||
int shadow_right;
|
int shadow_right;
|
||||||
int shadow_top;
|
int shadow_top;
|
||||||
@ -2535,9 +2537,11 @@ create_dynamic_positioner (GdkSurface *surface,
|
|||||||
.height = height - (shadow_top + shadow_bottom),
|
.height = height - (shadow_top + shadow_bottom),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gdk_wayland_surface_get_window_geometry (surface->parent, &parent_geometry);
|
||||||
|
|
||||||
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
|
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
|
||||||
real_anchor_rect_x = anchor_rect->x - parent_impl->shadow_left;
|
real_anchor_rect_x = anchor_rect->x - parent_geometry.x;
|
||||||
real_anchor_rect_y = anchor_rect->y - parent_impl->shadow_top;
|
real_anchor_rect_y = anchor_rect->y - parent_geometry.y;
|
||||||
|
|
||||||
anchor_rect_width = MAX (anchor_rect->width, 1);
|
anchor_rect_width = MAX (anchor_rect->width, 1);
|
||||||
anchor_rect_height = MAX (anchor_rect->height, 1);
|
anchor_rect_height = MAX (anchor_rect->height, 1);
|
||||||
@ -2596,17 +2600,9 @@ create_dynamic_positioner (GdkSurface *surface,
|
|||||||
xdg_positioner_get_version (positioner) >=
|
xdg_positioner_get_version (positioner) >=
|
||||||
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
|
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
|
||||||
{
|
{
|
||||||
int parent_width;
|
|
||||||
int parent_height;
|
|
||||||
|
|
||||||
parent_width = parent->width - (parent_impl->shadow_left +
|
|
||||||
parent_impl->shadow_right);
|
|
||||||
parent_height = parent->height - (parent_impl->shadow_top +
|
|
||||||
parent_impl->shadow_bottom);
|
|
||||||
|
|
||||||
xdg_positioner_set_parent_size (positioner,
|
xdg_positioner_set_parent_size (positioner,
|
||||||
parent_width,
|
parent_geometry.width,
|
||||||
parent_height);
|
parent_geometry.height);
|
||||||
xdg_positioner_set_parent_configure (positioner,
|
xdg_positioner_set_parent_configure (positioner,
|
||||||
parent_impl->last_configure_serial);
|
parent_impl->last_configure_serial);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user