mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 06:20:48 +08:00
Try to focus window when Show() is called. (#1212)
* Try to focus window when Show() is called. * Ensure Focus is regained by Webview2 when tabbing * Run restore code on main thread
This commit is contained in:
parent
60c6dce07d
commit
a278c9e164
@ -181,7 +181,7 @@ func (f *Frontend) WindowUnfullscreen() {
|
||||
|
||||
func (f *Frontend) WindowShow() {
|
||||
runtime.LockOSThread()
|
||||
f.mainWindow.Show()
|
||||
f.ShowWindow()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowHide() {
|
||||
@ -518,20 +518,31 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC
|
||||
} else {
|
||||
f.mainWindow.Show()
|
||||
}
|
||||
f.ShowWindow()
|
||||
|
||||
case options.Minimised:
|
||||
f.mainWindow.Minimise()
|
||||
case options.Fullscreen:
|
||||
f.mainWindow.Fullscreen()
|
||||
f.mainWindow.Show()
|
||||
f.ShowWindow()
|
||||
default:
|
||||
if f.frontendOptions.Fullscreen {
|
||||
f.mainWindow.Fullscreen()
|
||||
}
|
||||
f.mainWindow.Show()
|
||||
f.ShowWindow()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (f *Frontend) ShowWindow() {
|
||||
f.mainWindow.Invoke(func() {
|
||||
f.mainWindow.Restore()
|
||||
w32.SetForegroundWindow(f.mainWindow.Handle())
|
||||
w32.SetFocus(f.mainWindow.Handle())
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (f *Frontend) onFocus(arg *winc.Event) {
|
||||
f.chromium.Focus()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user