Skip to content

Conversation

@PatTheMav
Copy link
Member

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 QCefWidgetInternal owning the QWindow to handle all events sent to the window. If the window itself is the target of the event and it's of type FocusIn, 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

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant