panel: Propagate "focus-in" event to browser host #508
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes the issue of a browser window not regaining keyboard input focus when a user switched away from and back to OBS Studio as their active application.
Motivation and Context
The CEF instance is wrapped in another QWindow instance for Windows and Linux and thus consumes any focus events that are propagated through the application.
To ensure that a wrapped CEF instance regains focus after its wrapping window receives focus, the event needs to be explicitly sent to the browser host instance it wraps.
The least-intrusive way to achieve this within the current code architecture is to install the instance of
QCefWidgetInternalowning theQWindowto handle all events sent to the window. If the window itself is the target of the event and it's of typeFocusIn, the focus state of the browser host window is set explicitly.In tests this has shown that it allows keyboard input fields on a loaded website to regain input focus.
How Has This Been Tested?
Tested on macOS 26 (which did not require the fix) and Windows 11 (which did).
Types of changes
Checklist: