Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac: osr: cefclient: Some key presses do not work as expected in text fields #3857

Open
TroikaTronix opened this issue Dec 12, 2024 · 0 comments
Labels
bug Bug report cefclient Related to the cefclient sample app macos MacOS platform osr Related to off-screen rendering

Comments

@TroikaTronix
Copy link

TroikaTronix commented Dec 12, 2024

Describe the bug
When running cefclient on macOS Mojave 12.7 on an M1 MacBook Pro, and while using Offscreen Rendering to OpenGL (command line options: --off-screen-rendering-enabled, --shared-texture-enabled) pressing the following keys have undesired results:

d = Attempts to Enable Dictation
e = Shows the Emoji Selector View
f = Puts the current Window in fullscreen

To Reproduce
Steps to reproduce the behavior:

  1. Compile CEF on macOS
  2. Ensure the command line arguments are include --off-screen-rendering-enabled and --shared-texture-enabled
  3. Navigate to Google.com
  4. Click in the text input box to enter your search text
  5. Enter the letters 'a', 's', 'k' -- all of these work as expected.
  6. Now type the letter 'd' -- macOS will ask you if you wish to enable dictation (if it isn't already enabled)
  7. Now type the letter 'e' -- macOS will show the Emoji and Symbols Character Viewer
  8. Now type the letter 'f' -- the main CEF window will go fullscreen

Expected behavior
When you type the letters 'd', 'e', and 'f' without any modifiers, the text should be inserted into the currently selected text input field.

Screenshots

e-shows-emojis d-starts-dictation

Versions
cef_binary_131.3.1+gcb062df+chromium-131.0.6778.109_macosarm64
macOS Mojave 12.7
MacBook Pro M1

Additional context
A clue to the solution: in the file text_input_client_osr_mac.mm
in the function HandleKeyEventBeforeTextInputClient:(NSEvent*)keyEvent
if you change the first instance of this code

browser_->GetHost()->SendKeyEvent(keyEvent);

to

if (keyEvent.unmodified_character == 'd' || keyEvent.unmodified_character == 'e' || keyEvent.unmodified_character == 'f')
    keyEvent.unmodified_character = 0;
browser_->GetHost()->SendKeyEvent(keyEvent);

the problem no longer happens.

Does the problem reproduce with Google Chrome at the same version?
No.

@TroikaTronix TroikaTronix added the bug Bug report label Dec 12, 2024
@magreenblatt magreenblatt added macos MacOS platform cefclient Related to the cefclient sample app osr Related to off-screen rendering labels Dec 12, 2024
@magreenblatt magreenblatt changed the title OSR Enabled/Texture Sharing - Pressing 'd', 'e', and 'f' Enable Dictation, Emoji Selector, and Full Screen Mode mac: osr: cefclient: Some key presses do not work as expected in text fields Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report cefclient Related to the cefclient sample app macos MacOS platform osr Related to off-screen rendering
Projects
None yet
Development

No branches or pull requests

2 participants