mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
app: [API] make ViewEvent an interface on all platforms
A uniform type allows convenient nil checks and for future window backends on platforms other than Linux (which already had ViewEvent as an interface). Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-4
@@ -31,7 +31,7 @@ import (
|
||||
"gioui.org/io/transfer"
|
||||
)
|
||||
|
||||
type ViewEvent struct {
|
||||
type Win32ViewEvent struct {
|
||||
HWND uintptr
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func newWindow(win *callbacks, options []Option) {
|
||||
}
|
||||
winMap.Store(w.hwnd, w)
|
||||
defer winMap.Delete(w.hwnd)
|
||||
w.ProcessEvent(ViewEvent{HWND: uintptr(w.hwnd)})
|
||||
w.ProcessEvent(Win32ViewEvent{HWND: uintptr(w.hwnd)})
|
||||
w.Configure(options)
|
||||
windows.SetForegroundWindow(w.hwnd)
|
||||
windows.SetFocus(w.hwnd)
|
||||
@@ -308,7 +308,7 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
|
||||
case windows.WM_MOUSEHWHEEL:
|
||||
w.scrollEvent(wParam, lParam, true, getModifiers())
|
||||
case windows.WM_DESTROY:
|
||||
w.ProcessEvent(ViewEvent{})
|
||||
w.ProcessEvent(Win32ViewEvent{})
|
||||
w.ProcessEvent(DestroyEvent{})
|
||||
if w.hdc != 0 {
|
||||
windows.ReleaseDC(w.hdc)
|
||||
@@ -1011,4 +1011,5 @@ func configForDPI(dpi int) unit.Metric {
|
||||
}
|
||||
}
|
||||
|
||||
func (_ ViewEvent) ImplementsEvent() {}
|
||||
func (Win32ViewEvent) implementsViewEvent() {}
|
||||
func (Win32ViewEvent) ImplementsEvent() {}
|
||||
|
||||
Reference in New Issue
Block a user