mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-01-26 09:35:22 +00:00
Add support for X1/X2 mouse buttons and Super keys
This commit is contained in:
parent
b2d41b3c64
commit
992cce946c
@ -120,7 +120,7 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_MOUSE_BUTTON_PACKET packet
|
||||
display_cursor = true;
|
||||
|
||||
auto button = util::endian::big(packet->button);
|
||||
if(button > 0 && button < 4) {
|
||||
if(button > 0 && button < input->mouse_press.size()) {
|
||||
input->mouse_press[button] = packet->action != BUTTON_RELEASED;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ struct input_t {
|
||||
|
||||
gamepad_state_t gamepad_state;
|
||||
std::unordered_map<short, bool> key_press;
|
||||
std::array<std::uint8_t, 3> mouse_press;
|
||||
std::array<std::uint8_t, 5> mouse_press;
|
||||
|
||||
util::ThreadPool::task_id_t back_timeout_id;
|
||||
|
||||
|
@ -64,10 +64,18 @@ void button_mouse(input_t &input, int button, bool release) {
|
||||
btn_type = BTN_MIDDLE;
|
||||
scan = 90003;
|
||||
}
|
||||
else {
|
||||
else if(button == 3) {
|
||||
btn_type = BTN_RIGHT;
|
||||
scan = 90002;
|
||||
}
|
||||
else if(button == 4) {
|
||||
btn_type = BTN_SIDE;
|
||||
scan = 90004;
|
||||
}
|
||||
else {
|
||||
btn_type = BTN_EXTRA;
|
||||
scan = 90005;
|
||||
}
|
||||
|
||||
auto mouse = ((input_raw_t*)input.get())->mouse_input.get();
|
||||
libevdev_uinput_write_event(mouse, EV_MSC, MSC_SCAN, scan);
|
||||
@ -166,6 +174,10 @@ uint16_t keysym(uint16_t modcode) {
|
||||
return XK_Alt_L;
|
||||
case 0xA5: /* return XK_Alt_R; */
|
||||
return XK_Super_L;
|
||||
case 0x5B:
|
||||
return XK_Super_L;
|
||||
case 0x5C:
|
||||
return XK_Super_R;
|
||||
case 0xBA:
|
||||
return XK_semicolon;
|
||||
case 0xBB:
|
||||
@ -188,10 +200,6 @@ uint16_t keysym(uint16_t modcode) {
|
||||
return XK_bracketright;
|
||||
case 0xDE:
|
||||
return XK_apostrophe;
|
||||
case 0x01: //FIXME: Moonlight doesn't support Super key
|
||||
return XK_Super_L;
|
||||
case 0x02:
|
||||
return XK_Super_R;
|
||||
}
|
||||
|
||||
return modcode;
|
||||
|
@ -47,10 +47,20 @@ void button_mouse(input_t &input, int button, bool release) {
|
||||
mi.dwFlags = release ? MOUSEEVENTF_MIDDLEUP : MOUSEEVENTF_MIDDLEDOWN;
|
||||
mouse_button = VK_MBUTTON;
|
||||
}
|
||||
else {
|
||||
else if(button == 3) {
|
||||
mi.dwFlags = release ? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_RIGHTDOWN;
|
||||
mouse_button = VK_RBUTTON;
|
||||
}
|
||||
else if(button == 4) {
|
||||
mi.dwFlags = release ? MOUSEEVENTF_XUP : MOUSEEVENTF_XDOWN;
|
||||
mi.mouseData = XBUTTON1;
|
||||
mouse_button = VK_XBUTTON1;
|
||||
}
|
||||
else {
|
||||
mi.dwFlags = release ? MOUSEEVENTF_XUP : MOUSEEVENTF_XDOWN;
|
||||
mi.mouseData = XBUTTON2;
|
||||
mouse_button = VK_XBUTTON2;
|
||||
}
|
||||
|
||||
auto key_state = GetAsyncKeyState(mouse_button);
|
||||
bool key_state_down = (key_state & KEY_STATE_DOWN) != 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user