[v3 windows] Support title bar button events

This commit is contained in:
Lea Anthony
2023-06-13 17:42:14 +10:00
parent f855b30c9f
commit dc4daaebac
3 changed files with 14 additions and 2 deletions
+10 -1
View File
@@ -647,6 +647,7 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
case w32.WM_ACTIVATE:
if wparam == w32.WA_ACTIVE || wparam == w32.WA_CLICKACTIVE {
getNativeApplication().currentWindowID = w.parent.id
w.parent.emit(events.Common.WindowFocus)
}
case w32.WM_CLOSE:
if w.parent.options.HideOnClose {
@@ -662,6 +663,14 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
case w32.WM_MOVE, w32.WM_MOVING:
_ = w.chromium.NotifyParentWindowPositionChanged()
case w32.WM_SIZE:
switch wparam {
case w32.SIZE_MAXIMIZED:
w.parent.emit(events.Common.WindowMaximise)
case w32.SIZE_RESTORED:
w.parent.emit(events.Common.WindowRestore)
case w32.SIZE_MINIMIZED:
w.parent.emit(events.Common.WindowMinimise)
}
if w.parent.options.Frameless && wparam == w32.SIZE_MINIMIZED {
// If the window is frameless, and we are minimizing, then we need to suppress the Resize on the
// WebView2. If we don't do this, restoring does not work as expected and first restores with some wrong
@@ -715,7 +724,7 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
int(newWindowSize.Right-newWindowSize.Left),
int(newWindowSize.Bottom-newWindowSize.Top),
w32.SWP_NOZORDER|w32.SWP_NOACTIVATE)
w.parent.emit(events.Common.WindowDPIChanged)
}
if w.parent.options.Windows.WindowMask != nil {
+2
View File
@@ -26,6 +26,7 @@ type commonEvents struct {
WindowFocus WindowEventType
WindowShow WindowEventType
WindowHide WindowEventType
WindowDPIChanged WindowEventType
}
func newCommonEvents() commonEvents {
@@ -46,6 +47,7 @@ func newCommonEvents() commonEvents {
WindowFocus: 1167,
WindowShow: 1168,
WindowHide: 1169,
WindowDPIChanged: 1170,
}
}
+2 -1
View File
@@ -143,4 +143,5 @@ common:WindowZoomOut
common:WindowZoomReset
common:WindowFocus
common:WindowShow
common:WindowHide
common:WindowHide
common:WindowDPIChanged