mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3 windows] Support title bar button events
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,4 +143,5 @@ common:WindowZoomOut
|
||||
common:WindowZoomReset
|
||||
common:WindowFocus
|
||||
common:WindowShow
|
||||
common:WindowHide
|
||||
common:WindowHide
|
||||
common:WindowDPIChanged
|
||||
|
||||
Reference in New Issue
Block a user