pointer: Add output position to absolute coordinates

This fixes mouse issues when there are multiple outputs
vencrypt
Andri Yngvason 2020-01-24 21:14:29 +00:00
parent 7eaece7c0a
commit a1ee09386a
3 changed files with 9 additions and 7 deletions

View File

@ -20,6 +20,8 @@
#include <neatvnc.h>
#include "wlr-virtual-pointer-unstable-v1.h"
#include "output.h"
struct pointer {
struct nvnc* vnc;
struct zwlr_virtual_pointer_v1* pointer;
@ -29,8 +31,7 @@ struct pointer {
uint32_t current_x;
uint32_t current_y;
uint32_t width;
uint32_t height;
const struct output* output;
};
int pointer_init(struct pointer* self);

View File

@ -699,8 +699,7 @@ int main(int argc, char* argv[])
keyboard_init(&self.keyboard_backend, self.kb_layout);
self.pointer_backend.vnc = self.nvnc;
self.pointer_backend.width = out->width;
self.pointer_backend.height = out->height;
self.pointer_backend.output = self.selected_output;
self.pointer_backend.pointer =
zwlr_virtual_pointer_manager_v1_create_virtual_pointer(

View File

@ -75,9 +75,11 @@ void pointer_set(struct pointer* self, uint32_t x, uint32_t y,
uint32_t t = gettime_ms();
if (x != self->current_x || y != self->current_y)
zwlr_virtual_pointer_v1_motion_absolute(self->pointer, t, x, y,
self->width,
self->height);
zwlr_virtual_pointer_v1_motion_absolute(self->pointer, t,
self->output->x + x,
self->output->y + y,
self->output->width,
self->output->height);
self->current_x = x;
self->current_y = y;