Skip to content

Desktop: Mac fix keyboard input#3371

Merged
timon-schelling merged 20 commits intomasterfrom
desktop-mac-some-fixes-1
Nov 17, 2025
Merged

Desktop: Mac fix keyboard input#3371
timon-schelling merged 20 commits intomasterfrom
desktop-mac-some-fixes-1

Conversation

@timon-schelling
Copy link
Copy Markdown
Member

@timon-schelling timon-schelling commented Nov 12, 2025

and some other changes see commit messages

the texture import fix is only for mac.
they changed something about that while copying that code from us.
see tauri-apps/cef-rs#272 for details.

Closes #3336

tested on:

@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 12, 2025 15:15 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 12, 2025 15:34 Inactive
Comment thread desktop/src/cef/input.rs Outdated
Comment thread desktop/src/cef/input.rs Outdated
Comment thread desktop/src/cef/input.rs Outdated
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 02:48 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 03:01 Inactive
@csmoe
Copy link
Copy Markdown

csmoe commented Nov 13, 2025

Sending key event twice to cef on key press is already not that correct, isn't it? My webview wrapper just sent one event per press and it works fine on mac/windows. cefclient only does this whille handling ime related things https://github.com/chromiumembedded/cef/blob/7087113239f0ef0f929a9404b2807aa65d95b79e/tests/cefclient/browser/text_input_client_osr_mac.mm#L294.

@timon-schelling
Copy link
Copy Markdown
Member Author

I will take a look at your implementation.
Was never able to get cef to forward correct Inputs to the frontend without a key down event before any char event. (On windows)

Maybe I'm filling some fields differently (incorrect)?

But I'm pretty sure that there is a platform difference in some way. Especially with the option key on Mac.

Co-authored-by: csmoe <csmoe@msn.com>
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 16:54 Inactive
@timon-schelling
Copy link
Copy Markdown
Member Author

Hey @csmoe just finished reimplementing Keyboard input using your webview impl as a guide.

I gave you Co-author on that commit.

I realized afterward that your code doesn't specify a license. If you'd prefer that the portions I was able to draw from not be merged into Graphite, I'll absolutely respect that. It's probably fair use, but I still want to check with you first.

@timon-schelling
Copy link
Copy Markdown
Member Author

@csmoe Your implementation is mostly correct for Mac but doesn't work for win and linux.
On mac both char and key down get mapped to NSKeyDown (there is no NSChar AFAIK). On win and linux both key down and char events are needed.

@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 21:05 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 21:18 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 21:36 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 21:50 Inactive
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 13, 2025 22:03 Inactive
@timon-schelling timon-schelling force-pushed the desktop-mac-some-fixes-1 branch from c1b7907 to 0d104b4 Compare November 14, 2025 00:12
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 14, 2025 00:15 Inactive
@csmoe
Copy link
Copy Markdown

csmoe commented Nov 14, 2025

Thanks, I'll check my implementation. By the way, how can I run the desktop app locally? I tried days ago, but failed.

@timon-schelling
Copy link
Copy Markdown
Member Author

Thanks, I'll check my implementation. By the way, how can I run the desktop app locally? I tried days ago, but failed.

Command would be npm run start-desktop for now.
Maybe come ask in the desktop-app channel on discord so we don't derail this.

could you also answer my license/attribution question?

@csmoe
Copy link
Copy Markdown

csmoe commented Nov 14, 2025

Feel free to use the code, I'm quite flattered.

@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 14, 2025 02:40 Inactive
@inkreasing
Copy link
Copy Markdown

This isn't a regression in this PR, but the issue i mentioned in #3374, that on mac (with a german keyboard) the zoom in shortcut is cmd * still exists. It is correct in the way that the shown key and the key it reacts to are the same, but at some point this should probably be changed to + (while reacting to = physical code).

@timon-schelling
Copy link
Copy Markdown
Member Author

timon-schelling commented Nov 14, 2025

Also leaving this here for more context.

adding this in desktop wrapper fixes the not working CMD+'+' issue
but displays = like before.

Key::FakeKeyPlus => key = Some(KeyCode::Equal),

supporting custom display char requires one of three things

  • adding that as a feature to muda (lib used for menu creation on mac)
  • forking muda and using that
  • write custom NSMenu mapping code (interface with objc lib on mac directly, annoying but not impossible)

@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 15, 2025 19:22 Inactive
@timon-schelling timon-schelling enabled auto-merge (squash) November 17, 2025 11:37
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) November 17, 2025 11:43 Inactive
@timon-schelling timon-schelling merged commit e751979 into master Nov 17, 2025
4 checks passed
@timon-schelling timon-schelling deleted the desktop-mac-some-fixes-1 branch November 17, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac Alt+_ shortcuts don't work on desktop

4 participants