Tk Source Code

View Ticket
Login
Ticket UUID: 041f2f1131893bd19cdc529f20c61621c767feaa
Title: Wayland branch: "wm geometry WxH" before a toplevel is mapped is ignored
Type: Bug Version: wayland
Submitter: serhiy.storchaka Created on: 2026-10-14 19:48:31
Subsystem: (unused) Assigned To: aku
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-10-22 17:22:33
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-10-14 20:25:33
Description:

On the wayland branch ([b5ff45d7dc]), a size set with wm geometry before the toplevel is mapped is ignored:

toplevel .p
wm geometry .p 300x200
pack [frame .p.a -width 20 -height 40]
update
winfo geometry .p

gives 20x40 instead of 300x200 under headless sway. A size set after the window is mapped works. About 70 tests in frame.test, grid.test, listbox.test and pack.test fail for this reason; more in other files which set the size of their toplevel before mapping it.

The GLFW window is created at the requested size, and the set size would be applied by UpdateGeometryInfo(), which postpones resizing until the window gets its first focus. A compositor need not focus a new window, and headless sway, without a keyboard, never does. Also every ConfigureNotify, which Tk sends itself when the window is mapped, reset the set size.

Proposed fix in branch wayland-initial-geometry, [0df8b09326]: the window is created at the set size, and ConfigureNotify no longer resets it. In frame.test, grid.test, listbox.test and pack.test the failures go from 115 to 46, with none newly failing. A size changed later, before the first focus, still waits for the focus.

User Comments: serhiy.storchaka added on 2026-10-14 20:25:33:

Thanks. Merged into wayland in [4bcd53fbf9].


kevin_walzer added on 2026-10-14 20:20:16:
Understood. This can be merged.

serhiy.storchaka added on 2026-10-14 20:17:40:

Under headless sway the window never gets the focus, so without this fix the size set before mapping was never applied, and the fix removed about 70 failures in frame.test, grid.test, listbox.test and pack.test. Under mutter, which focuses new windows, the size is applied later anyway, so the gain is smaller there; but it still matters when the compositor does not focus a new window.


kevin_walzer added on 2026-10-14 20:11:54:
pack.test's failures are reduced by 6 with this patch, and no crashes.