Implement horizontal scrolling and Sunshine detection for Moonlight (#793)

This commit is contained in:
Cameron Gutman
2023-01-21 17:42:08 -06:00
committed by GitHub
parent da390c37db
commit 4b642f6e01
8 changed files with 52 additions and 4 deletions

View File

@@ -982,6 +982,19 @@ void scroll(input_t &input, int high_res_distance) {
libevdev_uinput_write_event(mouse, EV_SYN, SYN_REPORT, 0);
}
void hscroll(input_t &input, int high_res_distance) {
int distance = high_res_distance / 120;
auto mouse = ((input_raw_t *)input.get())->mouse_input.get();
if(!mouse) {
return;
}
libevdev_uinput_write_event(mouse, EV_REL, REL_HWHEEL, distance);
libevdev_uinput_write_event(mouse, EV_REL, REL_HWHEEL_HI_RES, high_res_distance);
libevdev_uinput_write_event(mouse, EV_SYN, SYN_REPORT, 0);
}
static keycode_t keysym(std::uint16_t modcode) {
if(modcode <= keycodes.size()) {
return keycodes[modcode];