5 ex_gui_detach_8c example
gullradriel edited this page 2026-10-09 00:51:57 +02:00

ex_gui_detach.c

Interactive N_GUI native (detached) window demo. Three ordinary pop-up windows, each with a button that promotes it to a real OS window and back. One panel uses the window manager's chrome (the default), one keeps N_GUI's own chrome inside a frameless native window (N_GUI_DETACH_OWN_CHROME), and one scales its widgets as the native window is resized (N_GUI_DETACH_SCALE_CONTENT).

The point of the demo is that nothing about the widgets changes: the same buttons, slider, text area and list keep working, and the same widget ids keep addressing them, whether the panel is a pop-up or its own window.

Keys: ESC quits, F5 saves the layout, F9 loads it back.

Options: -a detaches every panel at startup, -q SECONDS quits on its own. Together they give the demo a smoke-test mode that exercises the detach, draw and teardown paths under a sanitizer without a user at the keyboard.