forked from AuroraMiddleware/gtk
wayland: Do not constrain saved window size
Under Wayland, an xdg_surface.configure with size 0x0 means it's up to the client to set its size. When transitioning from maximized state to un-maximized, the Wayland compositor will send such an 0x0 configure so that the client can restore its original size. However, the original size was already constrained, so re-applying size constrains can lead to a smaller size when using size increments. Avoid this caveat by not applying size constrains when we are restoring the original size. https://bugzilla.gnome.org/show_bug.cgi?id=777072
This commit is contained in:
parent
07beb6dba2
commit
028e39d6ee
@ -1351,6 +1351,7 @@ xdg_surface_configure (void *data,
|
||||
int width = impl->pending.width;
|
||||
int height = impl->pending.height;
|
||||
gboolean fixed_size;
|
||||
gboolean saved_size;
|
||||
|
||||
if (!impl->initial_configure_received)
|
||||
{
|
||||
@ -1370,6 +1371,7 @@ xdg_surface_configure (void *data,
|
||||
fixed_size =
|
||||
new_state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_TILED);
|
||||
|
||||
saved_size = (width == 0 && height == 0);
|
||||
/* According to xdg_shell, an xdg_surface.configure with size 0x0
|
||||
* should be interpreted as that it is up to the client to set a
|
||||
* size.
|
||||
@ -1378,7 +1380,7 @@ xdg_surface_configure (void *data,
|
||||
* the client should configure its size back to what it was before
|
||||
* being maximize or fullscreen.
|
||||
*/
|
||||
if (width == 0 && height == 0 && !fixed_size)
|
||||
if (saved_size && !fixed_size)
|
||||
{
|
||||
width = impl->saved_width;
|
||||
height = impl->saved_height;
|
||||
@ -1391,16 +1393,19 @@ xdg_surface_configure (void *data,
|
||||
/* Ignore size increments for maximized/fullscreen windows */
|
||||
if (fixed_size)
|
||||
geometry_mask &= ~GDK_HINT_RESIZE_INC;
|
||||
if (!saved_size)
|
||||
{
|
||||
/* Do not reapply contrains if we are restoring original size */
|
||||
gdk_window_constrain_size (&impl->geometry_hints,
|
||||
geometry_mask,
|
||||
width + impl->margin_left + impl->margin_right,
|
||||
height + impl->margin_top + impl->margin_bottom,
|
||||
&width,
|
||||
&height);
|
||||
|
||||
gdk_window_constrain_size (&impl->geometry_hints,
|
||||
geometry_mask,
|
||||
width + impl->margin_left + impl->margin_right,
|
||||
height + impl->margin_top + impl->margin_bottom,
|
||||
&width,
|
||||
&height);
|
||||
|
||||
/* Save size for next time we get 0x0 */
|
||||
_gdk_wayland_window_save_size (window);
|
||||
/* Save size for next time we get 0x0 */
|
||||
_gdk_wayland_window_save_size (window);
|
||||
}
|
||||
|
||||
gdk_wayland_window_configure (window, width, height, impl->scale);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user