gdk/wayland: Always configured size when resizing

GTK4 doesn't support arbitrary constraints when resizing a window (e.g.
steps, or aspect ratio), so we don't need to care about the result from
compute-size when doing interactive resizing.
This commit is contained in:
Jonas Ådahl 2020-12-02 11:38:17 +01:00
parent 64f6118af4
commit 048a0172a0

View File

@ -162,6 +162,7 @@ struct _GdkWaylandSurface
int width;
int height;
GdkToplevelState state;
gboolean is_resizing;
} toplevel;
struct {
@ -1435,16 +1436,21 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkToplevelState new_state;
int width, height;
gboolean is_resizing;
gboolean fixed_size;
gboolean saved_size;
new_state = impl->pending.toplevel.state;
impl->pending.toplevel.state = 0;
is_resizing = impl->pending.toplevel.is_resizing;
impl->pending.toplevel.is_resizing = FALSE;
fixed_size =
new_state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_TILED);
GDK_TOPLEVEL_STATE_TILED) ||
is_resizing;
width = impl->pending.toplevel.width;
height = impl->pending.toplevel.height;
@ -1473,6 +1479,10 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
/* Save size for next time we get 0x0 */
_gdk_wayland_surface_save_size (surface);
}
else if (is_resizing)
{
impl->next_layout.toplevel.should_constrain = TRUE;
}
else
{
impl->next_layout.toplevel.should_constrain = FALSE;
@ -1679,9 +1689,12 @@ xdg_toplevel_configure (void *data,
struct wl_array *states)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
uint32_t *p;
GdkToplevelState pending_state = 0;
impl->pending.toplevel.is_resizing = FALSE;
wl_array_for_each (p, states)
{
uint32_t state = *p;
@ -1698,6 +1711,7 @@ xdg_toplevel_configure (void *data,
pending_state |= GDK_TOPLEVEL_STATE_FOCUSED;
break;
case XDG_TOPLEVEL_STATE_RESIZING:
impl->pending.toplevel.is_resizing = TRUE;
break;
default:
/* Unknown state */
@ -1768,9 +1782,12 @@ zxdg_toplevel_v6_configure (void *data,
struct wl_array *states)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
uint32_t *p;
GdkToplevelState pending_state = 0;
impl->pending.toplevel.is_resizing = FALSE;
wl_array_for_each (p, states)
{
uint32_t state = *p;
@ -1787,6 +1804,7 @@ zxdg_toplevel_v6_configure (void *data,
pending_state |= GDK_TOPLEVEL_STATE_FOCUSED;
break;
case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
impl->pending.toplevel.is_resizing = TRUE;
break;
default:
/* Unknown state */