window/wayland: Reset position when hiding popup

When a popup is remapped, if the GdkWindow::x/y position is negative,
some best-effort hueristics used to ignore internal X11-style hackery
windows incorrectly scooped up remapped popup windows.

Avoid these hueristics by resetting the x and y fields of GdkWindow to 0
whe hiding a popup. It'll then appear as if it was newly initialized,
and escape the mentioned hueristics.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4071
This commit is contained in:
Jonas Ådahl 2021-09-02 09:58:52 +02:00
parent 9ff2a9ab9b
commit d74b01636b

View File

@ -3330,6 +3330,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.xdg_popup = NULL;
display_wayland->current_popups =
g_list_remove (display_wayland->current_popups, window);
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
{
window->x = 0;
window->y = 0;
}
}
if (impl->display_server.xdg_surface)
{
@ -3352,6 +3358,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.zxdg_popup_v6 = NULL;
display_wayland->current_popups =
g_list_remove (display_wayland->current_popups, window);
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
{
window->x = 0;
window->y = 0;
}
}
if (impl->display_server.zxdg_surface_v6)
{