diff --git a/v2/internal/frontend/desktop/windows/frontend.go b/v2/internal/frontend/desktop/windows/frontend.go index 381b96088..5c7c5c24f 100644 --- a/v2/internal/frontend/desktop/windows/frontend.go +++ b/v2/internal/frontend/desktop/windows/frontend.go @@ -116,6 +116,8 @@ func (f *Frontend) Run(ctx context.Context) error { f.WindowCenter() f.setupChromium() + f.mainWindow.notifyParentWindowPositionChanged = f.chromium.NotifyParentWindowPositionChanged + mainWindow.OnSize().Bind(func(arg *winc.Event) { f.chromium.Resize() }) @@ -133,7 +135,6 @@ func (f *Frontend) Run(ctx context.Context) error { f.frontendOptions.OnStartup(f.ctx) } }() - mainWindow.Run() mainWindow.Close() return nil diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go index 22b82a883..cdd277ad0 100644 --- a/v2/internal/frontend/desktop/windows/window.go +++ b/v2/internal/frontend/desktop/windows/window.go @@ -16,8 +16,9 @@ import ( type Window struct { winc.Form - frontendOptions *options.App - applicationMenu *menu.Menu + frontendOptions *options.App + applicationMenu *menu.Menu + notifyParentWindowPositionChanged func() error } func NewWindow(parent winc.Controller, appoptions *options.App) *Window { @@ -89,6 +90,16 @@ func (w *Window) Run() int { } func (w *Window) WndProc(msg uint32, wparam, lparam uintptr) uintptr { + + switch msg { + case w32.WM_NCLBUTTONDOWN: + w32.SetFocus(w.Handle()) + case w32.WM_MOVE, w32.WM_MOVING: + if w.notifyParentWindowPositionChanged != nil { + w.notifyParentWindowPositionChanged() + } + } + if w.frontendOptions.Frameless { switch msg { case w32.WM_ACTIVATE: