[PR #7473] [MERGED] Select a world with the middle mouse button #7620

Closed
opened 2026-11-03 07:20:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7473
Author: @oxi-does-dev
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: middle-click-world-select


📝 Commits (1)

  • 81bea7a Select a world with the middle mouse button

📊 Changes

4 files changed (+93 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+19 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+16 -0)
📝 crates/horizon-client/src/title.rs (+24 -0)
📝 crates/horizon-client/src/title/tests.rs (+34 -0)

📄 Description

🤖 Opened by oxi-does-dev's AI agent (OpenCode, GLM 5.3), not by oxi-does-dev personally.

Fixes #7384

What broke

A middle click on the body of a world row in Singleplayer did nothing: the row was not selected, and Play, Edit and Delete stayed disabled. A left click on the same row selected it.

Why

Vanilla's ContainerEventHandler.mouseClicked focuses the clicked child whatever the button, and AbstractSelectionList.mouseClicked gives the click to the entry under the pointer; ObjectSelectionList.Entry.mouseClicked accepts every button by default. WorldSelectionList.setSelected then fires the selection callback that SelectWorldScreen.updateButtonStatus reads.

Horizon's title only listened for a left press: the game's mouse handler swallowed every other button while a title was open (WindowEvent::MouseInput { .. } if self.title.is_some() => {}), and the loading title handled MouseButton::Left alone.

What changed

  • Title::select_world_at: selects the row under the pointer (through world_row_at and the filtered view) without joining, as AbstractSelectionList.mouseClicked does. Only the left button joins, through its icon or through a click on the already-selected row.
  • game.rs: a middle press over the title routes there before the catch-all that used to swallow it.
  • startup_menu.rs: the title shown while resources load does the same.
  • Unit test middle_clicking_a_world_selects_it_without_joining: Edit starts disabled, a middle click selects row 0 and enables it, a second middle click still does not join, and a click outside the rows selects nothing.

Verification

End-to-end through the control socket on a scratch world, horizon-ctl ui/click ID middle (which synthesises the window's own mouse events at the widget's centre):

Step Result
Singleplayer, before the click one row e2e, edit disabled
click e2e middle {"clicked": "e2e", "screen": "title"}
After screen still title, edit enabled
Check Result
cargo build -p horizon-client --profile fast pass
cargo test -p horizon-client-lib --lib title::tests 65 passed
cargo test -p horizon-client --lib pad_menu 3 passed
cargo clippy -p horizon-client -p horizon-client-lib --lib -- -D warnings pass
cargo fmt --all -- --check pass

🔄 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/7473 **Author:** [@oxi-does-dev](https://github.com/oxi-does-dev) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `middle-click-world-select` --- ### 📝 Commits (1) - [`81bea7a`](https://github.com/horizon-rust/horizon/commit/81bea7acc553008dd1829a770c6274492338b5a8) Select a world with the middle mouse button ### 📊 Changes **4 files changed** (+93 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+19 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+16 -0) 📝 `crates/horizon-client/src/title.rs` (+24 -0) 📝 `crates/horizon-client/src/title/tests.rs` (+34 -0) </details> ### 📄 Description > 🤖 Opened by oxi-does-dev's AI agent (OpenCode, GLM 5.3), not by oxi-does-dev personally. Fixes #7384 ## What broke A middle click on the body of a world row in Singleplayer did nothing: the row was not selected, and Play, Edit and Delete stayed disabled. A left click on the same row selected it. ## Why Vanilla's `ContainerEventHandler.mouseClicked` focuses the clicked child whatever the button, and `AbstractSelectionList.mouseClicked` gives the click to the entry under the pointer; `ObjectSelectionList.Entry.mouseClicked` accepts every button by default. `WorldSelectionList.setSelected` then fires the selection callback that `SelectWorldScreen.updateButtonStatus` reads. Horizon's title only listened for a left press: the game's mouse handler swallowed every other button while a title was open (`WindowEvent::MouseInput { .. } if self.title.is_some() => {}`), and the loading title handled `MouseButton::Left` alone. ## What changed - `Title::select_world_at`: selects the row under the pointer (through `world_row_at` and the filtered view) without joining, as `AbstractSelectionList.mouseClicked` does. Only the left button joins, through its icon or through a click on the already-selected row. - `game.rs`: a middle press over the title routes there before the catch-all that used to swallow it. - `startup_menu.rs`: the title shown while resources load does the same. - Unit test `middle_clicking_a_world_selects_it_without_joining`: Edit starts disabled, a middle click selects row 0 and enables it, a second middle click still does not join, and a click outside the rows selects nothing. ## Verification End-to-end through the control socket on a scratch world, `horizon-ctl ui`/`click ID middle` (which synthesises the window's own mouse events at the widget's centre): | Step | Result | | --- | --- | | Singleplayer, before the click | one row `e2e`, `edit` disabled | | `click e2e middle` | `{"clicked": "e2e", "screen": "title"}` | | After | screen still `title`, `edit` enabled | | Check | Result | | --- | --- | | `cargo build -p horizon-client --profile fast` | pass | | `cargo test -p horizon-client-lib --lib title::tests` | 65 passed | | `cargo test -p horizon-client --lib pad_menu` | 3 passed | | `cargo clippy -p horizon-client -p horizon-client-lib --lib -- -D warnings` | pass | | `cargo fmt --all -- --check` | pass | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:20:58 +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#7620
No description provided.