Repository navigation
Fix editing shortcuts in browser docks on macOS - #557
Closed
Michael-Liendo wants to merge 1 commit into
Closed
Michael-Liendo wants to merge 1 commit into
Michael-Liendo wants to merge 1 commit into
Conversation
On macOS, CEF relies on the application's Edit menu to send the standard editing selectors (cut:, copy:, paste:, selectAll:, undo:, redo:) to the focused browser view. OBS's Edit menu uses its own actions instead, so Cmd+V and the other editing shortcuts do nothing in browser docks, e.g. when pasting a password into the YouTube Live Control Panel sign-in page. Handle these shortcuts in OnPreKeyEvent, as is already done for Cmd+R, and forward them to the focused frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Handle the standard editing shortcuts (Cmd+X, Cmd+C, Cmd+V, Cmd+A, Cmd+Z and Shift+Cmd+Z) in
QCefBrowserClient::OnPreKeyEventon macOS and forward them to the focused frame. If no frame has focus, they go to the main frame.Motivation and Context
On macOS, CEF relies on the application's Edit menu to send the standard editing selectors (
cut:,copy:,paste:,selectAll:,undo:,redo:) to the focused browser view. OBS's Edit menu uses its own actions instead, such as Paste Reference and Paste Duplicate. As a result, Cmd+V and the other editing shortcuts do nothing in browser docks.A concrete case is the YouTube Live Control Panel: you can't paste a password into the Google sign-in page.
This follows the approach the same function already uses for Cmd+R (reload). The new code is wrapped in
#ifdef __APPLE__, so Windows and Linux behave as before.Related issues
Partially addresses #365. This PR covers browser docks; the Browser Source "Interact" window uses a different code path and is not changed here.
It also covers the dock cases reported in #421 (pasting a password into the YouTube Live Control Panel) and #382 (keyboard copy and paste in the Twitch "Stream Info" dock), which were closed as duplicates of #365.
On the concern raised in #365 that CEF is bad at telling OBS when it has focus: this approach doesn't need OBS to know.
OnPreKeyEventis only called for key events that CEF itself receives, which means the browser view already has keyboard focus. Shortcuts pressed anywhere else in OBS still go to the Edit menu as before.How Has This Been Tested?
Types of changes
Checklist:
🤖 Generated with Claude Code