History

input: don't resolve double clicks on the active mouse section

Normally, key bindings are resolved in the input section stack order. However, mouse key bindings have a special "active mouse section" feature (which is a section with MOUSE_MOVE bound and mouse button is down in the section) which lets the section to be selected instead, with a fallback to the "default" section. The intention of the feature is for mouse dragging which should "stick" to the section where the mouse is down. This causes a problem with scripts which bind mouse double clicks: since double clicks are triggered on mouse down, it's resolved with the "active mouse section" feature instead of the section stack order. If the section which has the double click bound doesn't also have MOUSE_MOVE bound, the "default" section will be used instead. If it's already bound there, it will be triggered. Fix this by not resolving double clicks on the active mouse section, which is not the intention of the feature.

nanahi committed 2 years ago

Commit 65fef731 parent 948faa51 file · +3 −1Browse files

Unified · Split

input/input.c+3−1
@@ -448,7 +448,9 @@ static struct cmd_bind *find_any_bind_for_key(struct input_ctx *ictx, · 447 unmodified lines
448 448
449 // First look whether a mouse section is capturing all mouse input449 // First look whether a mouse section is capturing all mouse input
450 // exclusively (regardless of the active section stack order).450 // exclusively (regardless of the active section stack order).
451 if (use_mouse && MP_KEY_IS_MOUSE_BTN_SINGLE(ictx->last_key_down)) {451 if (use_mouse && MP_KEY_IS_MOUSE_BTN_SINGLE(ictx->last_key_down) &&
452 !MP_KEY_IS_MOUSE_BTN_DBL(code))
453 {
452 struct cmd_bind *bind =454 struct cmd_bind *bind =
453 find_bind_for_key_section(ictx, ictx->mouse_section, code);455 find_bind_for_key_section(ictx, ictx->mouse_section, code);
454 if (bind)456 if (bind)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t