Skip to content

キーボードルーティング API を追加#46

Closed
satoshi-assistant wants to merge 1 commit into
novonotes:novonotes-internalfrom
satoshi-assistant:codex/keyboard-routing-api
Closed

キーボードルーティング API を追加#46
satoshi-assistant wants to merge 1 commit into
novonotes:novonotes-internalfrom
satoshi-assistant:codex/keyboard-routing-api

Conversation

@satoshi-assistant

Copy link
Copy Markdown
Contributor

概要

WebView に届くキーボードイベントのうち、指定したキーだけを親ウィンドウへ透過する keyboard routing API を追加しました。

  • WxpKeyboardRouting / WxpKeyboardKey / with_keyboard_routing を追加
  • macOS では WKWebViewkeyDown: / keyUp: で対象キーを親 NSView へ転送
  • Windows では WebView2 配下 HWND の WM_KEYDOWN / WM_KEYUP / WM_SYSKEY* を対象キーだけ親 HWND へ転送
  • README に使用例を追加

背景

plugin host では Space などの transport/global shortcut をホスト側に残したい一方で、その他のキーは WebView 内 UI のショートカットとして使いたいケースがあります。全キーをホスト優先にする API では WebView 側のショートカットまで失われるため、製品側が選んだキーだけを native event の段階で親へ渡せるようにしました。

確認

  • cargo fmt --package host_window --package novonotes_run_loop --package run_loop_test_utils --package run_loop_timer --package wxp -- --check
  • cargo check --package wxp
  • cargo check --package wxp --target x86_64-pc-windows-msvc
  • cargo test --package wxp --lib

手動確認が必要な点

ユニットテストでは routing rule の platform key code 変換までは確認できますが、実際に plugin host / DAW が native key event を transport shortcut として受け取ることまでは保証できません。CI の 3OS build/test 後、macOS/Windows の実ホストで Space などの指定キーがホストへ届き、その他のキーが WebView 側に残ることを手動確認する想定です。

WebView 内の全キーをホストから奪うのではなく、製品側が選んだキーだけを親ウィンドウへ透過できるようにするため。
@satoshi-assistant

Copy link
Copy Markdown
Contributor Author

Closing this draft and recreating it.

The implementation direction is still useful, and CI passed on macOS, Windows, and Ubuntu, but this PR is not merge-ready for two reasons:

  • The commit message and PR text are in Japanese. This repository is OSS-facing, so they should be in English.
  • The embedded wry changes are too concentrated in upstream-tracked files. I will split the platform-specific keyboard passthrough implementation into dedicated helper modules so future upstream wry syncs have a smaller conflict surface.

I will open a replacement PR with an English commit/description and the refactored wry diff.

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.

1 participant