History

input: add MP_KEY_STATE_SET_ONLY

Trivial.

nanahi committed 2 years ago

Commit c4ff6751 parent 42951412 files · +9 −4Browse files

Showing the changes to input/input.c (1 of 2 files). Show all

Unified · Split

input/input.c+6−4
@@ -598,7 +598,8 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale, · 597 unmodified lines
598598 int scale_units)
599599 {
600600 int state = code & (MP_KEY_STATE_DOWN | MP_KEY_STATE_UP);
601− code = code & ~(unsigned)state;
601+ bool no_emit = code & MP_KEY_STATE_SET_ONLY;
602+ code = code & ~(unsigned)(state | MP_KEY_STATE_SET_ONLY);
602603
603604 if (mp_msg_test(ictx->log, MSGL_TRACE)) {
604605 char *key = mp_input_get_key_name(code);
@@ -648,9 +649,10 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale, · 43 unmodified lines
648649 return;
649650
650651 // Don't emit a command on key-down if the key is designed to emit commands
651− // on key-up (like mouse buttons). Also, if the command specifically should
652− // be sent both on key down and key up, still emit the command.
653− if (cmd->emit_on_up && !cmd->def->on_updown) {
652+ // on key-up (like mouse buttons), or setting key state only without emitting commands.
653+ // Also, if the command specifically should be sent both on key down and key up,
654+ // still emit the command.
655+ if ((cmd->emit_on_up && !cmd->def->on_updown) || no_emit) {
654656 talloc_free(cmd);
655657 return;
656658 }

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