You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add Win32Window, DialogEx, Monitor, and fix control ID allocation
I refactored some common (but very basic) HWND operations into Win32Window.
One reason I did this was to allow the default WndProc to be overridden.
I added two new types of PreTranslateHandler managed by the Application.
Global PreTranslateHandlers are always run first, regardless of the HWND.
If no global handlers processed the message, we then run HWND-specific
PreTranslateHandlers, which are associated with a specific HWND and may
be added and removed as necessary. If the message is still unprocessed,
we then fall through to the existing implementation. Global handlers
are not used yet (they are needed for WinUI), but since I was already
adding HWND-specific handlers, I put them in anyway.
I added Monitor, an abstraction for various HMONITOR operations.
I decided that some of the walk stuff around dialog management was too
fargone to fix without breaking a lot of existing code. Instead I wrote a
new component called DialogEx. It essentially creates a dialog using the
Win32 dialog manager (via CreateDialogIndirectParam) but is still able to
act as a Form and work with walk's layout code. We use a custom window
class for this stuff essentially to indicate to the system that the dialog
is nonstandard. The point of DialogEx is to leverage the existing dialog
management functionality instead of pushing back on it or trying to
reimplement it. Note that because DialogEx implements a dialog procedure,
we need to override FormBase's default WndProc with a no-op (courtesy of
the Win32Window refactoring).
I changed how keyboard focus is set in Form so that DialogEx can override.
I updated PushButton and ContainerBase such that, when running within a
DialogEx, they skip some of their walk-specific message processing.
This skips a bunch of code that is essentially trying to do a bad job of
reimplementing dialog management.
I updated PushButton to allow reserved control IDs to be explicitly set. We
also update PushButton to allow itself to be declaratively set as the default
pushbutton within a DialogEx.
I removed control ID allocation from ContainerBase. Instead, Widgets request
an IDAllocator from their owning FormBase, ensuring uniqueness across all
Widgets in the Form's widget hierarchy, not just the ones residing within
a specific container.
I also updated go.mod to pick up the latest win.
Fixes#96
Signed-off-by: Aaron Klotz <aaron@tailscale.com>
0 commit comments