Skip to content

decoration: onMiddleClick on decoration nodes - #244

Open
sachahjkl wants to merge 2 commits into
bea4dev:mainfrom
sachahjkl:feat/decoration-middle-click
Open

sachahjkl wants to merge 2 commits into
bea4dev:mainfrom
sachahjkl:feat/decoration-middle-click

Conversation

@sachahjkl

Copy link
Copy Markdown
Contributor

Problem

Decoration nodes accept onClick, onHoverChange and onActiveChange, but nothing reacts to the middle button. A config that draws tabs in the decoration cannot close a tab on a middle click, as a browser does.

Fix

  • packages/shoji_wm/src/types.ts: ComponentProps.onMiddleClick?: () => void, documented in English and Japanese.
  • packages/shoji_wm/src/serialize.ts: onMiddleClick is serialized as a runtime handler, with the same path naming as the other handlers.
  • ssd/bridge.rs: WireProps.on_middle_click; only the runtime-handler kind is accepted, other kinds give UnsupportedNodeKind.
  • ssd/mod.rs: DecorationInteractionHandlers.middle_click: Option<String>; has_any counts it, so a node with only onMiddleClick is tracked as an interaction target.
  • input.rs: on a press of button 274 (BTN_MIDDLE), middle_click_decoration_target finds the tracked decoration target under the pointer and invokes its handler. The left-button paths are unchanged.
  • shojiwm_rs/src/view.rs: Element::on_middle_click(f) for the Rust SDK. It registers the handler as {id}#middle_click and fills middle_click, so the Rust and TypeScript configs behave the same.

Tests

No test is added.

cargo test --workspace passes, except two tests that also fail on upstream main in our environment: evaluator::tests::embedded_runtime_ipc_does_not_leak_fds_across_reloads and input_method_keyboard_grab_gets_the_keymap_of_the_keys_it_is_sent.

This change has been running daily in the author's own session (a Windows-7-like desktop on ShojiWM), where a middle click closes a tab.

…onInteractionHandlers with its middle_click and matches the TypeScript onMiddleClick

This branch has not been deployed

No deployments
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