mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
fix(input): don't send ALT when right-alt is remapped to meta (#5318)
Signed-off-by: Anish Pallati <i@anish.land>
This commit is contained in:
+3
-3
@@ -1274,10 +1274,10 @@ namespace config {
|
||||
|
||||
// This config option will only be used by the UI
|
||||
// When editing in the config file itself, use "keybindings"
|
||||
bool map_rightalt_to_win = false;
|
||||
bool_f(vars, "key_rightalt_to_key_win", map_rightalt_to_win);
|
||||
input.key_rightalt_to_key_win = false;
|
||||
bool_f(vars, "key_rightalt_to_key_win", input.key_rightalt_to_key_win);
|
||||
|
||||
if (map_rightalt_to_win) {
|
||||
if (input.key_rightalt_to_key_win) {
|
||||
input.keybindings.emplace(0xA5, 0x5B);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ namespace config {
|
||||
bool ds5_inputtino_randomize_mac;
|
||||
|
||||
bool keyboard;
|
||||
bool key_rightalt_to_key_win;
|
||||
bool mouse;
|
||||
bool controller;
|
||||
|
||||
|
||||
+19
-3
@@ -178,6 +178,9 @@ namespace input {
|
||||
// Keep track of alt+ctrl+shift key combo
|
||||
int shortcutFlags;
|
||||
|
||||
bool left_alt_pressed = false;
|
||||
bool right_alt_pressed = false;
|
||||
|
||||
std::vector<gamepad_t> gamepads;
|
||||
std::unique_ptr<platf::client_input_t> client_context;
|
||||
|
||||
@@ -760,17 +763,30 @@ namespace input {
|
||||
auto release = util::endian::little(packet->header.magic) == KEY_UP_EVENT_MAGIC;
|
||||
auto keyCode = packet->keyCode & 0x00FF;
|
||||
|
||||
if (keyCode == VKEY_LMENU) {
|
||||
input->left_alt_pressed = !release;
|
||||
} else if (keyCode == VKEY_RMENU) {
|
||||
input->right_alt_pressed = !release;
|
||||
}
|
||||
|
||||
// Right-alt maps to meta, so it must not also register as ALT
|
||||
int modifiers = packet->modifiers;
|
||||
if (config::input.key_rightalt_to_key_win &&
|
||||
input->right_alt_pressed && !input->left_alt_pressed) {
|
||||
modifiers &= ~MODIFIER_ALT;
|
||||
}
|
||||
|
||||
// Set synthetic modifier flags if the keyboard packet is requesting modifier
|
||||
// keys that are not current pressed.
|
||||
uint8_t synthetic_modifiers = 0;
|
||||
if (!release && !is_modifier(keyCode)) {
|
||||
if (!(input->shortcutFlags & input_t::SHIFT) && (packet->modifiers & MODIFIER_SHIFT)) {
|
||||
if (!(input->shortcutFlags & input_t::SHIFT) && (modifiers & MODIFIER_SHIFT)) {
|
||||
synthetic_modifiers |= MODIFIER_SHIFT;
|
||||
}
|
||||
if (!(input->shortcutFlags & input_t::CTRL) && (packet->modifiers & MODIFIER_CTRL)) {
|
||||
if (!(input->shortcutFlags & input_t::CTRL) && (modifiers & MODIFIER_CTRL)) {
|
||||
synthetic_modifiers |= MODIFIER_CTRL;
|
||||
}
|
||||
if (!(input->shortcutFlags & input_t::ALT) && (packet->modifiers & MODIFIER_ALT)) {
|
||||
if (!(input->shortcutFlags & input_t::ALT) && (modifiers & MODIFIER_ALT)) {
|
||||
synthetic_modifiers |= MODIFIER_ALT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user