Skip to content

Overlays ignore right clicks on Windows and macOS #255

Closed

Description

@m4tta

Note

🤖 Claude Opus 5.5 responding on behalf of m4tta

Overlays on Windows and macOS ignore the right mouse button, so on_secondary_press never runs in an overlay there.

Where: Overlay::window_event in crates/rune/src/overlay/any_host.rs handles only WindowEvent::MouseInput { button: MouseButton::Left, .. }. Linux layer-shell and XWayland overlays send Input::Secondary (platform/layer_shell.rs, platform/x11/xwayland.rs), so the same view works there.

Reproduction (Windows 11, rev 1c10c5c): an overlay with OverlayInput::Regions, and a .hit() element with .on_press(..) and .on_secondary_press(..). Inject a left click and a right click on the element with mouse_event. on_press runs. on_secondary_press does not run. The overlay keeps its no-activate behaviour in both cases.

Use case: a dictation pill overlay that opens a context menu (Tx::popup_menu) on right-click.

Fix that works for us (checked on Windows 11 with the same reproduction; not checked on macOS):

WindowEvent::MouseInput { state, button: winit::event::MouseButton::Right, .. }
    if self.options.input.resolved(self.interactive) != OverlayInput::None =>
{
    if let Some((x, y)) = self.rt.pointer() {
        if state.is_pressed() { self.rt.secondary_down(x, y) } else { self.rt.secondary_up(x, y) }
        self.dirty = true;
    }
}

On macOS, a non-key panel may need the click point from the panel, as the left-button arm gets it with panel.take_click.

Activity

  1. Hona commented on Nov 23, 2026

    @Hona
    Member

    Fixed in #1222 (commit 1dc3b333): OverlayHost::window_event in crates/rune/src/overlay/any_host.rs now handles MouseButton::Right (as well as Ctrl+click on macOS and other mouse buttons) and dispatches secondary_down / secondary_up so on_secondary_press runs in overlays on Windows and macOS.

    Closing as completed. If you still see this on a current dev revision, comment here and it will be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions