forked from AuroraMiddleware/gtk
wayland: Postpone window resize requests until configured
An application may want to set a fallback size of a window while still mapping maximized. This is done by calling gtk_window_resize() before gtk_window_maximize() and before gtk_window_show(). When the window is mapped, it should have a maximized size, and if it eventually is unmaximized, it should fall back to the size from the earlier gtk_window_resize() call. What happens before this commit is that the initial window size ends up respecting the first gtk_window_resize() dimensions, and not the window dimension configured by the Wayland display server (i.e. maximized dimensions). Fix this by postponing any configure events until we received our configuration from the display server. If we got one with a fixed size (e.g. we're maximized, tiled etc), we use that, otherwise we look at the one that was previously configured by gtk which corresponds to the "preferred" size when not being maximized. This fixes Firefox being started in a maximized state when using the Wayland backend. Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2538
This commit is contained in:
parent
f5b393fef0
commit
7f12dc2b66
@ -203,6 +203,9 @@ struct _GdkWindowImplWayland
|
||||
int saved_width;
|
||||
int saved_height;
|
||||
|
||||
int unconfigured_width;
|
||||
int unconfigured_height;
|
||||
|
||||
gulong parent_surface_committed_handler;
|
||||
|
||||
struct {
|
||||
@ -1083,6 +1086,13 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
|
||||
impl->scale == scale)
|
||||
return;
|
||||
|
||||
if (!impl->initial_configure_received)
|
||||
{
|
||||
impl->unconfigured_width = width;
|
||||
impl->unconfigured_height = height;
|
||||
return;
|
||||
}
|
||||
|
||||
/* For xdg_popup using an xdg_positioner, there is a race condition if
|
||||
* the application tries to change the size after it's mapped, but before
|
||||
* the initial configure is received, so hide and show the surface again
|
||||
@ -1578,6 +1588,14 @@ gdk_wayland_window_handle_configure (GdkWindow *window,
|
||||
|
||||
gdk_wayland_window_configure (window, width, height, impl->scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_wayland_window_configure (window,
|
||||
impl->unconfigured_width,
|
||||
impl->unconfigured_height,
|
||||
impl->scale);
|
||||
}
|
||||
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("configure, window %p %dx%d,%s%s%s%s",
|
||||
|
Loading…
Reference in New Issue
Block a user