Platforms
Windows Implementation
The Windows backend is a Win32 implementation layered with GDI/GDI+ drawing and optional WebView2 support.
It uses the standard Win32 message model, a custom accelerator registry, and a window/control wrapper layer in osgui.
draw_win.cpp is built around Gdiplus.
Relevant Source Files
Application Lifecycle and Backend Startup
_osapp_init_imp(...) captures the module instance, converts the real command line with
CommandLineToArgvW, stores the app callbacks, and later uses SetTimer to drive the optional
frame/update callback. Termination posts WM_QUIT through PostQuitMessage and then runs the stored destroy/end callbacks.
Separately, _osgui_start_imp() registers the custom window/view/web classes, initializes common controls,
optionally initializes COM for web support, starts XP style helpers, loads dwmapi.dll conditionally,
starts GDI+, creates a default parent panel window, prepares shared cursors/brushes, loads the RichEdit control,
and builds the accelerator infrastructure.
Window System
The core wrapper type is OSWindow, which stores the real HWND, style flags, current popup menu,
tooltip window, cursor, panel attachment, resize state, role, close/move/resize listeners, tabstop state, and hotkeys.
Resize handling is split carefully across WM_SIZING and WM_SIZE. While the user drags borders,
i_resizing() converts frame size to client size, emits ekGUI_EVENT_WND_SIZING, and can constrain the new frame.
Once the size is accepted, the backend emits ekGUI_EVENT_WND_SIZE and redraws the child tree.
Keyboard behavior is window-centric: tab traversal, return/default-button behavior, escape-close semantics, and accelerator dispatch all run through the window message loop and tabstop machinery.
Modal Loops, Tooltips, and Accelerators
Modal windows use their own message loop and stop through a private message constant, 0x444, named
i_WM_MODAL_STOP. That is how oswindow_stop_modal(...) returns a modal result without depending on a separate dialog framework.
Tooltips are also handled explicitly. Each window lazily creates a tooltip HWND and updates it with
TTM_ADDTOOL/TTM_UPDATETIPTEXT. Keyboard accelerators are collected in arrays and materialized into a real
accelerator table via CreateAcceleratorTable.
Drawing and Imaging
draw_win.cpp uses Gdiplus::Graphics, Gdiplus::Bitmap, and related types for line/path/image operations,
font sizing helpers, and raster image drawing. The image layer in osimage.cpp also uses GDI+ for bitmap import/export,
scaling, palette inspection, and codec handling.
That means the Windows rendering story is still very much rooted in the classic Win32/GDI ecosystem, even though the API surface above it is portable.
WebView2 Integration
When NAPPGUI_WEB_SUPPORT is enabled, the Windows web wrapper creates a WebView2 environment asynchronously through
CreateCoreWebView2EnvironmentWithOptions. The controller callback stores the controller and core view,
enables basic settings, sizes it to the current client rect, and replays any navigation that was requested before initialization finished.
The public web commands map to Navigate, GoBack, and GoForward. If support is not compiled in,
the wrapper still exists as a focusable control shell but the browser actions are effectively no-ops.