mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-10-25 13:30:42 +00:00
Avoid stuck keys on disconnect and remove useless sleep
This commit is contained in:
1 parent
781afc7c66
commit
45c1a504e9
1 file changed
+9
-7
+9
-7
@@ -104,6 +104,8 @@ static bool* currentReverse;
|
|||||||
|
|
||||||
static bool grabbingDevices;
|
static bool grabbingDevices;
|
||||||
|
|
||||||
|
static bool waitingToExitOnModifiersUp = false;
|
||||||
|
|
||||||
int evdev_gamepads = 0;
|
int evdev_gamepads = 0;
|
||||||
|
|
||||||
#define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL)
|
#define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL)
|
||||||
@@ -263,15 +265,13 @@ static bool evdev_handle_event(struct input_event *ev, struct input_device *dev)
|
|||||||
dev->modifiers &= ~modifier;
|
dev->modifiers &= ~modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit the stream if all the required quit keys are down
|
// After the quit key combo is pressed, quit once all keys are raised
|
||||||
if ((dev->modifiers & ACTION_MODIFIERS) == ACTION_MODIFIERS &&
|
if ((dev->modifiers & ACTION_MODIFIERS) == ACTION_MODIFIERS &&
|
||||||
ev->code == QUIT_KEY && ev->value != 0) {
|
ev->code == QUIT_KEY && ev->value != 0) {
|
||||||
|
waitingToExitOnModifiersUp = true;
|
||||||
short code = 0x80 << 8 | keyCodes[ev->code];
|
return true;
|
||||||
LiSendKeyboardEvent(code, KEY_ACTION_DOWN, 0);
|
} else if (waitingToExitOnModifiersUp && dev->modifiers == 0)
|
||||||
usleep(1000000);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
short code = 0x80 << 8 | keyCodes[ev->code];
|
short code = 0x80 << 8 | keyCodes[ev->code];
|
||||||
LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers);
|
LiSendKeyboardEvent(code, ev->value?KEY_ACTION_DOWN:KEY_ACTION_UP, dev->modifiers);
|
||||||
@@ -495,8 +495,10 @@ static bool evdev_handle_event(struct input_event *ev, struct input_device *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamepadModified && (dev->buttonFlags & QUIT_BUTTONS) == QUIT_BUTTONS)
|
if (gamepadModified && (dev->buttonFlags & QUIT_BUTTONS) == QUIT_BUTTONS) {
|
||||||
|
LiSendMultiControllerEvent(dev->controllerId, 1, 0, 0, 0, 0, 0, 0, 0);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
dev->gamepadModified |= gamepadModified;
|
dev->gamepadModified |= gamepadModified;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in new issue
Block a user