mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-24 05:31:13 +00:00
Add Sunshine protocol extension to support non-normalized key codes
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ typedef struct _NV_HAPTICS_PACKET {
|
|||||||
#define KEY_UP_EVENT_MAGIC 0x00000004
|
#define KEY_UP_EVENT_MAGIC 0x00000004
|
||||||
typedef struct _NV_KEYBOARD_PACKET {
|
typedef struct _NV_KEYBOARD_PACKET {
|
||||||
NV_INPUT_HEADER header;
|
NV_INPUT_HEADER header;
|
||||||
char zero1;
|
char flags; // Sunshine extension (always 0 for GFE)
|
||||||
short keyCode;
|
short keyCode;
|
||||||
char modifiers;
|
char modifiers;
|
||||||
short zero2;
|
short zero2;
|
||||||
|
|||||||
+6
-2
@@ -675,7 +675,7 @@ int LiSendMouseButtonEvent(char action, int button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send a key press event to the streaming machine
|
// Send a key press event to the streaming machine
|
||||||
int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers) {
|
int LiSendKeyboardEvent2(short keyCode, char keyAction, char modifiers, char flags) {
|
||||||
PPACKET_HOLDER holder;
|
PPACKET_HOLDER holder;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -732,7 +732,7 @@ int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers) {
|
|||||||
|
|
||||||
holder->packet.keyboard.header.size = BE32(sizeof(NV_KEYBOARD_PACKET) - sizeof(uint32_t));
|
holder->packet.keyboard.header.size = BE32(sizeof(NV_KEYBOARD_PACKET) - sizeof(uint32_t));
|
||||||
holder->packet.keyboard.header.magic = LE32((uint32_t)keyAction);
|
holder->packet.keyboard.header.magic = LE32((uint32_t)keyAction);
|
||||||
holder->packet.keyboard.zero1 = 0;
|
holder->packet.keyboard.flags = IS_SUNSHINE() ? flags : 0;
|
||||||
holder->packet.keyboard.keyCode = LE16(keyCode);
|
holder->packet.keyboard.keyCode = LE16(keyCode);
|
||||||
holder->packet.keyboard.modifiers = modifiers;
|
holder->packet.keyboard.modifiers = modifiers;
|
||||||
holder->packet.keyboard.zero2 = 0;
|
holder->packet.keyboard.zero2 = 0;
|
||||||
@@ -747,6 +747,10 @@ int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers) {
|
||||||
|
return LiSendKeyboardEvent2(keyCode, keyAction, modifiers, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int LiSendUtf8TextEvent(const char *text, unsigned int length) {
|
int LiSendUtf8TextEvent(const char *text, unsigned int length) {
|
||||||
PPACKET_HOLDER holder;
|
PPACKET_HOLDER holder;
|
||||||
int err;
|
int err;
|
||||||
|
|||||||
@@ -546,6 +546,8 @@ int LiSendMouseMoveAsMousePositionEvent(short deltaX, short deltaY, short refere
|
|||||||
int LiSendMouseButtonEvent(char action, int button);
|
int LiSendMouseButtonEvent(char action, int button);
|
||||||
|
|
||||||
// This function queues a keyboard event to be sent to the remote server.
|
// This function queues a keyboard event to be sent to the remote server.
|
||||||
|
// Key codes are Win32 Virtual Key (VK) codes and interpreted as keys on
|
||||||
|
// a US English layout.
|
||||||
#define KEY_ACTION_DOWN 0x03
|
#define KEY_ACTION_DOWN 0x03
|
||||||
#define KEY_ACTION_UP 0x04
|
#define KEY_ACTION_UP 0x04
|
||||||
#define MODIFIER_SHIFT 0x01
|
#define MODIFIER_SHIFT 0x01
|
||||||
@@ -554,6 +556,12 @@ int LiSendMouseButtonEvent(char action, int button);
|
|||||||
#define MODIFIER_META 0x08
|
#define MODIFIER_META 0x08
|
||||||
int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers);
|
int LiSendKeyboardEvent(short keyCode, char keyAction, char modifiers);
|
||||||
|
|
||||||
|
// Similar to LiSendKeyboardEvent() but allows the client to inform the host that
|
||||||
|
// the keycode was not mapped to a standard US English scancode and should be
|
||||||
|
// interpreted as-is. This is a Sunshine protocol extension.
|
||||||
|
#define SS_KBE_FLAG_NON_NORMALIZED 0x01
|
||||||
|
int LiSendKeyboardEvent2(short keyCode, char keyAction, char modifiers, char flags);
|
||||||
|
|
||||||
// This function queues an UTF-8 encoded text to be sent to the remote server.
|
// This function queues an UTF-8 encoded text to be sent to the remote server.
|
||||||
int LiSendUtf8TextEvent(const char *text, unsigned int length);
|
int LiSendUtf8TextEvent(const char *text, unsigned int length);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user