Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/window_win32.h

The Win32 window a native editor lives in: the platform peer for a component tree.

#include <sonore/gfx/window_win32.h>
On this page

Design notes

All it does is window, blit and input

Because everything is rasterised into a Bitmap, this layer never draws. It creates a child window inside the host's, copies a buffer into it, and turns Windows messages into component events. That is the whole platform surface, and it is why porting to GTK or Cocoa is a day rather than a month.

The two Win32 rules that break audio plugins

SetCapture. Without it a drag that leaves the window stops arriving, and a user who drags a knob quickly gets a control that sticks. The component tree has its own capture, which decides WHICH component; this is the operating system's, which decides whether the messages arrive at all. Both are needed and they are not the same thing.

TrackMouseEvent. Windows sends no "the pointer left" message unless it is asked, once, per entry. Without it a hover highlight stays lit after the user has moved to another plugin -- and it must be re-armed after every WM_MOUSELEAVE, because the request is consumed by the message it produces.

Types 1

The Win32 peer for a component tree: a child window inside a host's HWND (or a top-level window, or a popup), the Backing it paints into, and the translation of Windows messages into MouseRouter calls. What it does and does not do is in the file comment; NativeWindowX11 and NativeWindowCocoa are the same job on the other platforms.

open() takes the content by reference and does not own it: the component must outlive the window, or close() must come first -- NativeEditor holds one of these as a member and reuses it across every open. Everything here runs on the thread that called open(), which owns the HWND and receives its messages: the message thread. The window procedure keeps a pointer to this object, and the object owns the router, the UI Automation root and the drop target by raw pointer, so a NativeWindow can be neither copied nor moved -- as NativeWindowX11 and NativeWindowCocoa cannot.

↑↓ to move↵ to openEvery public name in the headers, and every guide