Skip to content

fix(input): a release over a window no longer leaves the left button held - #1287

Open
openmubr wants to merge 1 commit into
Mutizens:mainfrom
openmubr:pr/left-button-release
Open

openmubr wants to merge 1 commit into
Mutizens:mainfrom
openmubr:pr/left-button-release

Conversation

@openmubr

@openmubr openmubr commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

What

Press the left button on the ground and release it over an RmlUi window (the skill bar, the MU Helper window, the inventory). The release never reaches HandleMouseButton: Core::Input::RouteToUi reports it consumed, MouseLButton stays true, and as soon as the cursor leaves the window ZzzInterface's held-button move (if (MouseLButton) Success = true;) keeps sending the hero to whatever ground is under the cursor, every frame, with no button down. The hero follows the mouse across the map (a player walked from Lorencia to Devias this way) until the next left click.

The right button already had this exception (PassesRightButtonToGame: "a right release does while the game holds the button, so it can't stick"). The left and middle buttons did not.

This PR generalizes it: any mouse-button release that the UI consumed still reaches the game while the game holds that button. The check lives in Core::Input::IsReleaseOfHeldButton (next to RecordPressEdge, so it can be unit tested), and PassesRightButtonToGame becomes PassesButtonToGame (the party-card right press is unchanged).

A press the UI took never set the game's button, so its release still stays with the UI: clicking a window's buttons works as before and does not click the world. Gameplay keeps its own IsMouseOverUI() gates, so the passed release does not act on the world under the window either; it only clears the held state.

Files

  • Core/Input/KeyState.h/.cpp: IsReleaseOfHeldButton(const SDL_Event&) (left/right/middle vs MouseLButton/MouseRButton/MouseMButton).
  • App/Platform/Windows/Winmain.cpp: PassesRightButtonToGame → PassesButtonToGame, releases go through the new check.
  • tests/core/test_synthetic_input.cpp: one test case for held/not held, press vs release, each button.

How to reproduce (on main)

  1. Enter the world (any map, safe zone is fine).
  2. Press and hold the left button on the ground, so the hero starts walking.
  3. While holding, move the cursor onto an RmlUi window (skill bar / HUD) and release it there.
  4. Move the cursor back over the ground without clicking.

On main the hero keeps walking after the cursor wherever it goes. With this PR it stops when the button is released.

Testing

  • Unit test: A release the UI took still reaches the game while the game holds that button [core][input] in test_synthetic_input (Windows x64 Release, -DENABLE_CONTROL_SOCKET=ON), passes with the other 25 [core][synthetic-input]/[core][input] cases.
  • In game, web build (Emscripten, Chrome) against a local OpenMU (-demo), Lorencia, Blade Knight. Steps above, released over the skill bar, then the cursor moved over the ground on two sides without clicking. Position from the map label:
on release +2 s +6 s cursor moved to the other side, +5 s
before (main code) 152,123 144,116 134,113 122,111, and the hero walked into the Trainer NPC and opened its dialog
after (this PR) 126,113 126,113 126,113 126,113
  • After the fix: clicking the Inventory button of an RmlUi window opens it and the hero does not move; a normal click on the ground still walks and stops.

🤖 Generated with Claude Code

…held

A left press on the ground that was released over an RmlUi window never
reached HandleMouseButton: the UI consumed the release, MouseLButton stayed
true and the hero kept walking after the cursor (ZzzInterface's held-button
move) until the next left click, across maps. Only the right button had the
"release while the game holds it" exception.

Every button release the UI consumed now still reaches the game while the
game holds that button (Core::Input::IsReleaseOfHeldButton), which replaces
the right-only check in PassesRightButtonToGame (now PassesButtonToGame).
A press the UI took never set the game's button, so clicks on window
buttons stay with the UI as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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