From c91493516963c1752ab92c6e5cc69f8d72f6a798 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 17 May 2021 20:52:21 +0100 Subject: [PATCH] app/internal/wm: implement ViewEvent for Windows Signed-off-by: Elias Naur --- app/internal/wm/os_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/internal/wm/os_windows.go b/app/internal/wm/os_windows.go index a393dd7d..ede985d6 100644 --- a/app/internal/wm/os_windows.go +++ b/app/internal/wm/os_windows.go @@ -28,7 +28,9 @@ import ( "gioui.org/io/system" ) -type ViewEvent struct{} +type ViewEvent struct { + HWND uintptr +} type winConstraints struct { minWidth, minHeight int32 @@ -117,6 +119,7 @@ func NewWindow(window Callbacks, opts *Options) error { defer winMap.Delete(w.hwnd) w.w = window w.w.SetDriver(w) + w.w.Event(ViewEvent{HWND: uintptr(w.hwnd)}) w.Option(opts) windows.ShowWindow(w.hwnd, windows.SW_SHOWDEFAULT) windows.SetForegroundWindow(w.hwnd) @@ -293,6 +296,7 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr case windows.WM_MOUSEHWHEEL: w.scrollEvent(wParam, lParam, true) case windows.WM_DESTROY: + w.w.Event(ViewEvent{}) w.w.Event(system.DestroyEvent{}) if w.hdc != 0 { windows.ReleaseDC(w.hdc)