mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-12-26 11:29:48 +01:00
remotedesktop: fix scroll and modifiers
This commit is contained in:
parent
df607b82eb
commit
2e976939a4
1 changed files with 18 additions and 26 deletions
|
@ -128,7 +128,7 @@ int EmulatedInputServer::onEvent(eis_event* e) {
|
||||||
Debug::log(LOG, "[EIS] Device {} will no longer send events", eis_device_get_name(device));
|
Debug::log(LOG, "[EIS] Device {} will no longer send events", eis_device_get_name(device));
|
||||||
|
|
||||||
depressed = 0;
|
depressed = 0;
|
||||||
virtualKeyboard->sendModifiers(depressed, latched, locked, 3);
|
virtualKeyboard->sendModifiers(depressed, 0, locked, 3);
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_MOTION:
|
case EIS_EVENT_POINTER_MOTION:
|
||||||
if (virtualPointer != nullptr) {
|
if (virtualPointer != nullptr) {
|
||||||
|
@ -161,8 +161,10 @@ int EmulatedInputServer::onEvent(eis_event* e) {
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
if (virtualPointer != nullptr) {
|
if (virtualPointer != nullptr) {
|
||||||
virtualPointer->sendAxisDiscrete(1, 0, 1, eis_event_scroll_get_discrete_dy(e));
|
int32_t dx = eis_event_scroll_get_discrete_dx(e);
|
||||||
virtualPointer->sendAxisDiscrete(1, 1, 1, eis_event_scroll_get_discrete_dx(e));
|
int32_t dy = eis_event_scroll_get_discrete_dy(e);
|
||||||
|
virtualPointer->sendAxisDiscrete(1, 0, dy*30, 1);
|
||||||
|
virtualPointer->sendAxisDiscrete(0, 1, dx*30, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
|
@ -176,58 +178,48 @@ int EmulatedInputServer::onEvent(eis_event* e) {
|
||||||
if (pressed)
|
if (pressed)
|
||||||
depressed |= 1;
|
depressed |= 1;
|
||||||
else
|
else
|
||||||
depressed &= ~(1);
|
depressed &= ~((uint32_t)1);
|
||||||
break;
|
break;
|
||||||
case KEY_CAPSLOCK:
|
case KEY_CAPSLOCK:
|
||||||
if (pressed) {
|
locked ^= ((uint32_t)1 << 4);
|
||||||
if (locked & (1 << 1))
|
|
||||||
locked &= ~(1 << 1);
|
|
||||||
else
|
|
||||||
locked |= 1 << 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case KEY_LEFTCTRL:
|
case KEY_LEFTCTRL:
|
||||||
case KEY_RIGHTCTRL:
|
case KEY_RIGHTCTRL:
|
||||||
if (pressed)
|
if (pressed)
|
||||||
depressed |= 1 << 2;
|
depressed |= (uint32_t)1 << 2;
|
||||||
else
|
else
|
||||||
depressed &= ~(1 << 2);
|
depressed &= ~((uint32_t)1 << 2);
|
||||||
break;
|
break;
|
||||||
case KEY_LEFTALT:
|
case KEY_LEFTALT:
|
||||||
case KEY_RIGHTALT:
|
case KEY_RIGHTALT:
|
||||||
if (pressed)
|
if (pressed)
|
||||||
depressed |= 1 << 3;
|
depressed |= (uint32_t)1 << 3;
|
||||||
else
|
else
|
||||||
depressed &= ~(1 << 3);
|
depressed &= ~((uint32_t)1 << 3);
|
||||||
break;
|
break;
|
||||||
case KEY_NUMLOCK:
|
case KEY_NUMLOCK:
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
if (locked & (1 << 4))
|
locked ^= ((uint32_t)1 << 4);
|
||||||
locked &= ~(1 << 4);
|
|
||||||
else
|
|
||||||
locked |= 1 << 4;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_LEFTMETA:
|
case KEY_LEFTMETA:
|
||||||
case KEY_RIGHTMETA:
|
case KEY_RIGHTMETA:
|
||||||
if (pressed)
|
if (pressed)
|
||||||
depressed |= 1 << 6;
|
depressed |= (uint32_t)1 << 6;
|
||||||
else
|
else
|
||||||
depressed &= ~(1 << 6);
|
depressed &= ~((uint32_t)1 << 6);
|
||||||
break;
|
break;
|
||||||
case KEY_SCROLLLOCK:
|
case KEY_SCROLLLOCK:
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
if (locked & (1 << 7))
|
locked ^= ((uint32_t)1 << 7);
|
||||||
locked &= ~(1 << 7);
|
|
||||||
else
|
|
||||||
locked |= 1 << 7;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virtualKeyboard->sendModifiers(depressed, latched, locked, 3);
|
|
||||||
virtualKeyboard->sendKey(1, keycode, pressed);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtualKeyboard->sendModifiers(depressed, 0, locked, 3);
|
||||||
|
virtualKeyboard->sendKey(1, keycode, pressed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue