Window ignores the size in the compositor's first configure, so a tiled or maximized window starts at its constructor size #166

Open
opened 2026-10-31 14:45:14 +00:00 by jorijnvdgraaf · 0 comments

Summary

xdg_surface_handle_configure applies a configure's size only once the window is configured, so the size in the first configure, the one the constructor waits for, is never used: the swapchain and the viewport are made from the constructor's width and height, whatever the compositor asked for. Line numbers refer to 670df31.

Details

  • implementations/Crafter.Graphics-Window.cpp:1761-1768: xdg_toplevel_configure stores the size in pendingLogicalWidth/pendingLogicalHeight.
  • :1781-1799: xdg_surface_handle_configure resizes only inside if (window->configured), then sets configured. For the first configure it only sets the flag.
  • :381: the constructor dispatches until configured, and nothing after the loop reads the pending size: the viewport destination (:395) and CreateSwapchain (:531) take the constructor's arguments.

A compositor with a size in mind says so in that first configure: a tiling compositor's tile, a maximized or fullscreen start, a window rule. The window maps at its own size instead and keeps it until a later configure carries a size, which the compositor need not send. For a maximized start that also breaks xdg-shell's rule that the configured geometry be obeyed.

Not reproduced. On KWin 6.8.0 the first configure of a new toplevel is (0, 0) (seen with WAYLAND_DEBUG=client), meaning no preference, for which the constructor's size is the right one.

Suggested fix

After the wait loop, when the configure carried a size, set width and height from the pending logical size times scale before the viewport and the swapchain are made; the constructor's arguments stay the size for a compositor without a preference. With the fix suggested in #165, which keeps the logical size as state, the first configure would simply set that state.

## Summary `xdg_surface_handle_configure` applies a configure's size only once the window is configured, so the size in the first configure, the one the constructor waits for, is never used: the swapchain and the viewport are made from the constructor's `width` and `height`, whatever the compositor asked for. Line numbers refer to `670df31`. ## Details - `implementations/Crafter.Graphics-Window.cpp:1761-1768`: `xdg_toplevel_configure` stores the size in `pendingLogicalWidth`/`pendingLogicalHeight`. - `:1781-1799`: `xdg_surface_handle_configure` resizes only inside `if (window->configured)`, then sets `configured`. For the first configure it only sets the flag. - `:381`: the constructor dispatches until `configured`, and nothing after the loop reads the pending size: the viewport destination (`:395`) and `CreateSwapchain` (`:531`) take the constructor's arguments. A compositor with a size in mind says so in that first configure: a tiling compositor's tile, a maximized or fullscreen start, a window rule. The window maps at its own size instead and keeps it until a later configure carries a size, which the compositor need not send. For a maximized start that also breaks xdg-shell's rule that the configured geometry be obeyed. Not reproduced. On KWin 6.8.0 the first configure of a new toplevel is `(0, 0)` (seen with `WAYLAND_DEBUG=client`), meaning no preference, for which the constructor's size is the right one. ## Suggested fix After the wait loop, when the configure carried a size, set `width` and `height` from the pending logical size times `scale` before the viewport and the swapchain are made; the constructor's arguments stay the size for a compositor without a preference. With the fix suggested in #165, which keeps the logical size as state, the first configure would simply set that state.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/Crafter.Graphics#166
No description provided.