Skip to content

Add Window::setParentWindow (macOS child windows)#312

Open
bumfo wants to merge 1 commit into
HumbleUI:mainfrom
bumfo:set-parent-window
Open

Add Window::setParentWindow (macOS child windows)#312
bumfo wants to merge 1 commit into
HumbleUI:mainfrom
bumfo:set-parent-window

Conversation

@bumfo

@bumfo bumfo commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What

New API Window.setParentWindow(@Nullable Window parent), implemented on macOS via -[NSWindow addChildWindow:ordered:] (NSWindowAbove). A child window stays ordered above its parent within the application — unlike setZOrder(FLOATING/MODAL_PANEL), it does not float above other applications' windows. Passing null detaches.

Why

The floating ZOrder levels are global: a tool/palette window (robot consoles in my app's case) set to FLOATING/MODAL_PANEL stays above every other application too. Child windows are the native macOS mechanism for "always above one specific window only".

Notes / caveats

  • macOS semantics, documented in the javadoc: the child moves together with its parent, and hiding (orderOut) a child window detaches it automatically — callers should attach after setVisible(true) on every show.
  • Windows/X11 are TODO stubs following the existing setZOrder stub style (Win32 could later reuse the _nWinSetParent owner-window plumbing; X11 via XSetTransientForHint).
  • README feature matrix + CHANGELOG updated.
  • Built and exercised on macOS arm64 from a downstream app consuming target/classes.

🤖 Generated with Claude Code

Attaches a window as a child of another so it stays above its parent
within the application, without floating over other apps' windows
(unlike ZOrder.FLOATING/MODAL_PANEL). Pass null to detach; hiding a
child window detaches it automatically on macOS, so callers re-attach
on show. Windows/X11: TODO stubs matching setZOrder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant