pointer: Add output position to absolute coordinates
This fixes mouse issues when there are multiple outputsvencrypt
parent
7eaece7c0a
commit
a1ee09386a
|
@ -20,6 +20,8 @@
|
||||||
#include <neatvnc.h>
|
#include <neatvnc.h>
|
||||||
#include "wlr-virtual-pointer-unstable-v1.h"
|
#include "wlr-virtual-pointer-unstable-v1.h"
|
||||||
|
|
||||||
|
#include "output.h"
|
||||||
|
|
||||||
struct pointer {
|
struct pointer {
|
||||||
struct nvnc* vnc;
|
struct nvnc* vnc;
|
||||||
struct zwlr_virtual_pointer_v1* pointer;
|
struct zwlr_virtual_pointer_v1* pointer;
|
||||||
|
@ -29,8 +31,7 @@ struct pointer {
|
||||||
uint32_t current_x;
|
uint32_t current_x;
|
||||||
uint32_t current_y;
|
uint32_t current_y;
|
||||||
|
|
||||||
uint32_t width;
|
const struct output* output;
|
||||||
uint32_t height;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int pointer_init(struct pointer* self);
|
int pointer_init(struct pointer* self);
|
||||||
|
|
|
@ -699,8 +699,7 @@ int main(int argc, char* argv[])
|
||||||
keyboard_init(&self.keyboard_backend, self.kb_layout);
|
keyboard_init(&self.keyboard_backend, self.kb_layout);
|
||||||
|
|
||||||
self.pointer_backend.vnc = self.nvnc;
|
self.pointer_backend.vnc = self.nvnc;
|
||||||
self.pointer_backend.width = out->width;
|
self.pointer_backend.output = self.selected_output;
|
||||||
self.pointer_backend.height = out->height;
|
|
||||||
|
|
||||||
self.pointer_backend.pointer =
|
self.pointer_backend.pointer =
|
||||||
zwlr_virtual_pointer_manager_v1_create_virtual_pointer(
|
zwlr_virtual_pointer_manager_v1_create_virtual_pointer(
|
||||||
|
|
|
@ -75,9 +75,11 @@ void pointer_set(struct pointer* self, uint32_t x, uint32_t y,
|
||||||
uint32_t t = gettime_ms();
|
uint32_t t = gettime_ms();
|
||||||
|
|
||||||
if (x != self->current_x || y != self->current_y)
|
if (x != self->current_x || y != self->current_y)
|
||||||
zwlr_virtual_pointer_v1_motion_absolute(self->pointer, t, x, y,
|
zwlr_virtual_pointer_v1_motion_absolute(self->pointer, t,
|
||||||
self->width,
|
self->output->x + x,
|
||||||
self->height);
|
self->output->y + y,
|
||||||
|
self->output->width,
|
||||||
|
self->output->height);
|
||||||
|
|
||||||
self->current_x = x;
|
self->current_x = x;
|
||||||
self->current_y = y;
|
self->current_y = y;
|
||||||
|
|
Loading…
Reference in New Issue