[PR #4075] [MERGED] Right Click Emulation: Control + left click is a right click on macOS #5402

Closed
opened 2026-11-03 05:12:21 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4075
Author: @xFedeT
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/ctrl-click-right-click


📝 Commits (2)

  • d9d0bd3 Right Click Emulation: Control + left click is a right click on macOS
  • df19d46 Merge remote-tracking branch 'origin/main' into fix/ctrl-click-right-click

📊 Changes

2 files changed (+53 additions, -0 deletions)

View changed files

📝 crates/horizon-client-input/src/mouse.rs (+39 -0)
📝 crates/horizon-client/src/game.rs (+14 -0)

📄 Description

🤖 Opened by Federico's AI agent (Claude), not by Federico himself.

Fixes #3533. Claimed with /claim (assigned to xFedeT); no other open PR touches it (gh pr list --search "ctrl click right click").

What and why

Options > Controls already shows "Right Click Emulation" (options.ctrlClickEmulatesRightClick, "When enabled, Control + left-click is treated as a right-click. Only applies on macOS.") and options.txt saves it as ctrlClickEmulatesRightClick, but nothing in the game read the setting, so Ctrl+click on a MacBook or a trackpad never placed a block or used an item. In vanilla 26.3 Minecraft applies it through MacosUtil.setCtrlClickEmulatesRightClick.

Change

  • horizon-client-input/src/mouse.rs: RightClickEmulation, a small state machine: a left click pressed with Control held (option on) is a right click, and so is its release, even if Control was let go before it, so a press and a release never end up on different buttons.
  • game.rs window_event: the left MouseInput is turned into a right one by it, before the event is used anywhere (the world, the screens, the held-button state). Only on macOS (cfg!(target_os = "macos")), as the tooltip says.

Vanilla reference

Options.ctrlClickEmulatesRightClick, Minecraft (MacosUtil.setCtrlClickEmulatesRightClick).

Testing

  • New unit test control_click_is_a_right_click_until_released (option off, no Control, Control at the press, Control let go before the release, the next click on its own).
  • pr_ready --quick (Python 3.12): Python tests (475), rustfmt, clippy and the Rust tests (949) pass.
  • Not done: I could not click a real Ctrl+click in a window from the control socket (horizon-ctl mouse commands do not go through winit's MouseInput), so the wiring in window_event is covered by the build and the unit test of its logic, not by a run. Worth a quick check by someone on a Mac: option on, hold Control, left click to place a block.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4075 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/ctrl-click-right-click` --- ### 📝 Commits (2) - [`d9d0bd3`](https://github.com/horizon-rust/horizon/commit/d9d0bd328932b905984bc6e8c374c59e1a4320bc) Right Click Emulation: Control + left click is a right click on macOS - [`df19d46`](https://github.com/horizon-rust/horizon/commit/df19d46a5ae40cf8d8bd710f5a23e2d21786ef80) Merge remote-tracking branch 'origin/main' into fix/ctrl-click-right-click ### 📊 Changes **2 files changed** (+53 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-input/src/mouse.rs` (+39 -0) 📝 `crates/horizon-client/src/game.rs` (+14 -0) </details> ### 📄 Description > 🤖 Opened by Federico's AI agent (Claude), not by Federico himself. Fixes #3533. Claimed with `/claim` (assigned to xFedeT); no other open PR touches it (`gh pr list --search "ctrl click right click"`). ## What and why Options > Controls already shows "Right Click Emulation" (`options.ctrlClickEmulatesRightClick`, "When enabled, Control + left-click is treated as a right-click. Only applies on macOS.") and `options.txt` saves it as `ctrlClickEmulatesRightClick`, but nothing in the game read the setting, so Ctrl+click on a MacBook or a trackpad never placed a block or used an item. In vanilla 26.3 `Minecraft` applies it through `MacosUtil.setCtrlClickEmulatesRightClick`. ## Change - `horizon-client-input/src/mouse.rs`: `RightClickEmulation`, a small state machine: a left click pressed with Control held (option on) is a right click, and so is its release, even if Control was let go before it, so a press and a release never end up on different buttons. - `game.rs` `window_event`: the left `MouseInput` is turned into a right one by it, before the event is used anywhere (the world, the screens, the held-button state). Only on macOS (`cfg!(target_os = "macos")`), as the tooltip says. ## Vanilla reference `Options.ctrlClickEmulatesRightClick`, `Minecraft` (`MacosUtil.setCtrlClickEmulatesRightClick`). ## Testing - New unit test `control_click_is_a_right_click_until_released` (option off, no Control, Control at the press, Control let go before the release, the next click on its own). - `pr_ready --quick` (Python 3.12): Python tests (475), rustfmt, clippy and the Rust tests (949) pass. - Not done: I could not click a real Ctrl+click in a window from the control socket (`horizon-ctl` mouse commands do not go through winit's `MouseInput`), so the wiring in `window_event` is covered by the build and the unit test of its logic, not by a run. Worth a quick check by someone on a Mac: option on, hold Control, left click to place a block. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:21 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5402
No description provided.