mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
app/internal/wm: implement ViewEvent for Windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -28,7 +28,9 @@ import (
|
|||||||
"gioui.org/io/system"
|
"gioui.org/io/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ViewEvent struct{}
|
type ViewEvent struct {
|
||||||
|
HWND uintptr
|
||||||
|
}
|
||||||
|
|
||||||
type winConstraints struct {
|
type winConstraints struct {
|
||||||
minWidth, minHeight int32
|
minWidth, minHeight int32
|
||||||
@@ -117,6 +119,7 @@ func NewWindow(window Callbacks, opts *Options) error {
|
|||||||
defer winMap.Delete(w.hwnd)
|
defer winMap.Delete(w.hwnd)
|
||||||
w.w = window
|
w.w = window
|
||||||
w.w.SetDriver(w)
|
w.w.SetDriver(w)
|
||||||
|
w.w.Event(ViewEvent{HWND: uintptr(w.hwnd)})
|
||||||
w.Option(opts)
|
w.Option(opts)
|
||||||
windows.ShowWindow(w.hwnd, windows.SW_SHOWDEFAULT)
|
windows.ShowWindow(w.hwnd, windows.SW_SHOWDEFAULT)
|
||||||
windows.SetForegroundWindow(w.hwnd)
|
windows.SetForegroundWindow(w.hwnd)
|
||||||
@@ -293,6 +296,7 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
|
|||||||
case windows.WM_MOUSEHWHEEL:
|
case windows.WM_MOUSEHWHEEL:
|
||||||
w.scrollEvent(wParam, lParam, true)
|
w.scrollEvent(wParam, lParam, true)
|
||||||
case windows.WM_DESTROY:
|
case windows.WM_DESTROY:
|
||||||
|
w.w.Event(ViewEvent{})
|
||||||
w.w.Event(system.DestroyEvent{})
|
w.w.Event(system.DestroyEvent{})
|
||||||
if w.hdc != 0 {
|
if w.hdc != 0 {
|
||||||
windows.ReleaseDC(w.hdc)
|
windows.ReleaseDC(w.hdc)
|
||||||
|
|||||||
Reference in New Issue
Block a user