Skip to content

Make wm manage and wm forget work - #1101

Open
beetlebugorg wants to merge 1 commit into
mainfrom
wm-manage
Open

beetlebugorg wants to merge 1 commit into
mainfrom
wm-manage

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

Summary

  • wm manage FRAME: a frame or a labelframe leaves the geometry manager of its parent and gets a window of the platform, at its requested size, with its name as the title.
    • Its path name, its children, their bindings, and their options stay.
    • Then the subcommands of wm work on it, and winfo toplevel of a child gives it.
    • A second wm manage, and wm manage ., change nothing.
    • Another widget, also a ttk::frame, gives the error of wish: window ".b" is not manageable: must be a frame, labelframe or toplevel.
  • wm forget WINDOW: the window of a managed frame, or of a widget of toplevel, closes.
    • The widget is then a frame of its parent, unmapped until pack, grid, or place places it.
    • A toplevel keeps its class Toplevel, and wm manage makes it a toplevel again.
    • Other widgets and . change nothing and give no error, as in wish.
  • Events: the widget and its mapped children get <Unmap>, then <Map> in the new window. wish 8.6.14 under Xvfb gives the same events and no <Reparent>.
  • Code:
    • Widget.wm_top is a new field, and each check of a toplevel goes through Widget.isToplevel.
    • toplevel.openWindow and toplevel.closeWindow hold the window code, and wm.zig calls them.
    • The menu bar reads -menu only when the widget has the option.
    • winfo manager gives wm for each toplevel.
  • Docs: the reference of wm (docs/reference/wm.tcl) loses the difference line. It describes the two subcommands and has an example of a panel that tears off and docks again.

Part of #1092. The web is not in this PR. A second toplevel on the web has no canvas (docs/differences.md), so a managed frame there gets the state but no canvas. A canvas for each toplevel on the web is #1100.

Tests

  • zig build test passes, with two new tests in src/tests/toplevel.zig:
    • A frame with a button through manage, forget, and pack. Each step checks the toplevel, the manager, the size of the window, the geometry of the child, a click on the button in each window, and the events.
    • The errors and the no-ops, a labelframe, a toplevel through forget and manage, and destroy of a managed frame.
  • sh tools/ref-check.sh passes: 7132 examples and errors, no failures. This includes the tear-off example.
  • The behavior matches wish 8.6.14 under Xvfb (8.6.16 has no package here).
  • X11 on Xvfb: xwininfo shows the window "Panel" at 64x51, viewable, and the frame packs back after wm forget.
  • macOS, Windows, and Wayland use the same createWindow path as toplevel. They did not run here.

@beetlebugorg beetlebugorg added this to the v1.0.0-beta.10 milestone Dec 4, 2026
`wm manage FRAME` takes a frame or a labelframe out of the manager of
its parent and gives it a window of the platform, at its requested
size, with its path name, its children, and their bindings. Then the
subcommands of wm work on it, and `winfo toplevel` of a child gives
it. `wm forget` closes the window of a managed frame or of a toplevel,
and the widget is a frame of its parent, unmapped until pack, grid, or
place places it. The widget and its mapped children get <Unmap>, then
<Map> in the new window, as in wish 8.6.14.

A widget has a new field wm_top, and each check of a toplevel goes
through Widget.isToplevel. The window code of toplevel.zig is now
openWindow and closeWindow, which wm.zig also calls. A frame has no
-menu, so the menu bar reads the option only when the widget has it.
`winfo manager` gives wm for each toplevel, not only for ".".

The reference of wm has the two subcommands and an example of a panel
that tears off and docks again. On the web, the window of a managed
frame has no canvas, as for a second toplevel.

Part of #1092 (the web part is #1100)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant