mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-01 23:35:47 +00:00
Add button combination to quit streaming for gamepads
This commit is contained in:
parent
cbf31be73b
commit
cdca4c1b3a
@ -181,7 +181,7 @@ A documented example configuration file can be found at /etc/moonlight/moonlight
|
||||
|
||||
=head1 COMMENTS
|
||||
|
||||
Use Ctrl+Alt+Shift+Q to quit the streaming session.
|
||||
Use Ctrl+Alt+Shift+Q or Play+Back+LeftShoulder+RightShoulder to quit the streaming session.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
@ -91,6 +91,7 @@ static bool grabbingDevices;
|
||||
|
||||
#define QUIT_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL)
|
||||
#define QUIT_KEY KEY_Q
|
||||
#define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG)
|
||||
|
||||
static bool (*handler) (struct input_event*, struct input_device*);
|
||||
|
||||
@ -326,6 +327,9 @@ static bool evdev_handle_event(struct input_event *ev, struct input_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (gamepadModified && (dev->buttonFlags & QUIT_BUTTONS) == QUIT_BUTTONS)
|
||||
return false;
|
||||
|
||||
dev->gamepadModified |= gamepadModified;
|
||||
return true;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#define ACTION_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL)
|
||||
#define QUIT_KEY SDLK_q
|
||||
#define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG)
|
||||
#define FULLSCREEN_KEY SDLK_f
|
||||
|
||||
typedef struct _GAMEPAD_STATE {
|
||||
@ -232,6 +233,9 @@ int sdlinput_handle_event(SDL_Event* event) {
|
||||
else
|
||||
gamepad->buttons &= ~button;
|
||||
|
||||
if ((gamepad->buttons & QUIT_BUTTONS) == QUIT_BUTTONS)
|
||||
return SDL_QUIT_APPLICATION;
|
||||
|
||||
LiSendMultiControllerEvent(gamepad->id, activeGamepadMask, gamepad->buttons, gamepad->leftTrigger, gamepad->rightTrigger, gamepad->leftStickX, gamepad->leftStickY, gamepad->rightStickX, gamepad->rightStickY);
|
||||
break;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ static void help() {
|
||||
printf("\t-input <device>\t\tUse <device> as input. Can be used multiple times\n");
|
||||
printf("\t-audio <device>\t\tUse <device> as audio output device\n");
|
||||
#endif
|
||||
printf("\nUse Ctrl+Alt+Shift+Q to exit streaming session\n\n");
|
||||
printf("\nUse Ctrl+Alt+Shift+Q or Play+Back+LeftShoulder+RightShoulder to exit streaming session\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user