a
This commit is contained in:
parent
222b8fbdc4
commit
a5fbfa7a59
1 changed files with 41 additions and 41 deletions
82
server.c
82
server.c
|
@ -228,57 +228,57 @@ static void rfb_ptr_hook(int mask, int screen_x, int screen_y, rfbClientPtr cl)
|
||||||
int touch_x = round(global_x / resolution.x * UINPUT_ABS_MAX);
|
int touch_x = round(global_x / resolution.x * UINPUT_ABS_MAX);
|
||||||
int touch_y = round(global_y / resolution.y * UINPUT_ABS_MAX);
|
int touch_y = round(global_y / resolution.y * UINPUT_ABS_MAX);
|
||||||
struct input_event ies1[] = {
|
struct input_event ies1[] = {
|
||||||
{
|
{
|
||||||
.type = EV_ABS,
|
.type = EV_ABS,
|
||||||
.code = ABS_X,
|
.code = ABS_X,
|
||||||
.value = touch_x,
|
.value = touch_x,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_ABS,
|
.type = EV_ABS,
|
||||||
.code = ABS_Y,
|
.code = ABS_Y,
|
||||||
.value = touch_y,
|
.value = touch_y,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_KEY,
|
.type = EV_KEY,
|
||||||
.code = BTN_LEFT,
|
.code = BTN_LEFT,
|
||||||
.value = !! (mask & 0b1)
|
.value = !! (mask & 0b1)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_KEY,
|
.type = EV_KEY,
|
||||||
.code = BTN_MIDDLE,
|
.code = BTN_MIDDLE,
|
||||||
.value = !! (mask & 0b10)
|
.value = !! (mask & 0b10)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_KEY,
|
.type = EV_KEY,
|
||||||
.code = BTN_RIGHT,
|
.code = BTN_RIGHT,
|
||||||
.value = !! (mask & 0b100)
|
.value = !! (mask & 0b100)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_SYN,
|
.type = EV_SYN,
|
||||||
.code = SYN_REPORT,
|
.code = SYN_REPORT,
|
||||||
.value = 0,
|
.value = 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
for (int i = 0; i < ARRAY_SIZE(ies1); i++) {
|
for (int i = 0; i < ARRAY_SIZE(ies1); i++) {
|
||||||
write(uinput_fd, &ies1[i], sizeof(ies1[0]));
|
write(uinput_fd, &ies1[i], sizeof(ies1[0]));
|
||||||
}
|
}
|
||||||
if (mask & 0b11000) {
|
if (mask & 0b11000) {
|
||||||
struct input_event ies2[] = {
|
struct input_event ies2[] = {
|
||||||
{
|
{
|
||||||
.type = EV_REL,
|
.type = EV_REL,
|
||||||
.code = REL_WHEEL,
|
.code = REL_WHEEL,
|
||||||
.value = mask & 0b1000 ? 1 : -1,
|
.value = mask & 0b1000 ? 1 : -1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = EV_SYN,
|
.type = EV_SYN,
|
||||||
.code = SYN_REPORT,
|
.code = SYN_REPORT,
|
||||||
.value = 0,
|
.value = 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
for (int i = 0; i < ARRAY_SIZE(ies2); i++) {
|
for (int i = 0; i < ARRAY_SIZE(ies2); i++) {
|
||||||
write(uinput_fd, &ies2[i], sizeof(ies2[0]));
|
write(uinput_fd, &ies2[i], sizeof(ies2[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue