5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-15 16:39:32 +08:00

Fix focus calls when window is disabled or minimised.

Fixes #3759 and #4168
This commit is contained in:
Lea Anthony 2025-04-09 21:50:48 +10:00
parent d658ddd8b4
commit b90c815ee9
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -788,6 +788,14 @@ func (w *windowsWebviewWindow) setFullscreenButtonEnabled(_ bool) {
func (w *windowsWebviewWindow) focus() { func (w *windowsWebviewWindow) focus() {
w32.SetForegroundWindow(w.hwnd) w32.SetForegroundWindow(w.hwnd)
if w.isDisabled() {
return
}
if w.isMinimised() {
w.unminimise()
}
w.focusingChromium = true w.focusingChromium = true
w.chromium.Focus() w.chromium.Focus()
w.focusingChromium = false w.focusingChromium = false
@ -1041,6 +1049,11 @@ func (w *windowsWebviewWindow) disableIcon() {
) )
} }
func (w *windowsWebviewWindow) isDisabled() bool {
style := uint32(w32.GetWindowLong(w.hwnd, w32.GWL_STYLE))
return style&w32.WS_DISABLED != 0
}
func (w *windowsWebviewWindow) updateTheme(isDarkMode bool) { func (w *windowsWebviewWindow) updateTheme(isDarkMode bool) {
if w32.IsCurrentlyHighContrastMode() { if w32.IsCurrentlyHighContrastMode() {