You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case for wry is using it to implement a toggleable web interface over an existing winit application. The winit application listens for WindowEvent::KeyboardInput but this event is only fired when the webview is not focused. The problem is, there is no method to unfocus the webview once it is focused so while I can show/hide the web interface using webview.set_visible, I cannot stop the webview from capturing all keyboard events once it has been focused.
I have created a test repo which showcases the problem.
By creating a webview with .with_visible(false).with_focused(false) winit keyboard events work fine. Once .focus() is called on the webview, the winit events are never executed again. I poked around the WebView2 docs and from my understanding, there is simply no blur method so if anyone has any ideas they would be welcome.
Note
I have only tested this on Windows 11, I do not know if this works on macOS/Linux but I am interested in finding a solution that works on all platforms.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My use case for wry is using it to implement a toggleable web interface over an existing winit application. The winit application listens for
WindowEvent::KeyboardInput
but this event is only fired when the webview is not focused. The problem is, there is no method to unfocus the webview once it is focused so while I can show/hide the web interface usingwebview.set_visible
, I cannot stop the webview from capturing all keyboard events once it has been focused.I have created a test repo which showcases the problem.
By creating a webview with
.with_visible(false).with_focused(false)
winit keyboard events work fine. Once.focus()
is called on the webview, the winit events are never executed again. I poked around the WebView2 docs and from my understanding, there is simply no blur method so if anyone has any ideas they would be welcome.Note
I have only tested this on Windows 11, I do not know if this works on macOS/Linux but I am interested in finding a solution that works on all platforms.
Beta Was this translation helpful? Give feedback.
All reactions