mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Merge e2d480b0bf into 4d0abeb37c
This commit is contained in:
commit
aabdb1a8ca
2 changed files with 16 additions and 0 deletions
|
|
@ -951,6 +951,14 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC
|
|||
win32.ShowWindow(f.mainWindow.Handle())
|
||||
}
|
||||
|
||||
// Ensure initial keyboard focus goes into the WebView so typing works without a click.
|
||||
if !f.frontendOptions.StartHidden && f.frontendOptions.WindowStartState != options.Minimised {
|
||||
if ctrl := f.chromium.GetController(); ctrl != nil {
|
||||
_ = ctrl.MoveFocus(edge.COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC)
|
||||
// _ = ctrl.MoveFocus(0)
|
||||
}
|
||||
}
|
||||
|
||||
f.mainWindow.hasBeenShown = true
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,14 @@ func (w *Window) WndProc(msg uint32, wparam, lparam uintptr) uintptr {
|
|||
//}
|
||||
}
|
||||
|
||||
if w.isActive && w.chromium != nil {
|
||||
if ctrl := w.chromium.GetController(); ctrl != nil {
|
||||
// Push keyboard focus into WebView2 when activated
|
||||
_ = ctrl.MoveFocus(edge.COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC)
|
||||
// _ = ctrl.MoveFocus(0) // fallback if your bindings lack the constant
|
||||
}
|
||||
}
|
||||
|
||||
case 0x02E0: //w32.WM_DPICHANGED
|
||||
newWindowSize := (*w32.RECT)(unsafe.Pointer(lparam))
|
||||
w32.SetWindowPos(w.Handle(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue