diff --git a/protocols/wlr-virtual-pointer-unstable-v1.xml b/protocols/wlr-virtual-pointer-unstable-v1.xml index e21b4d7..ea243e7 100644 --- a/protocols/wlr-virtual-pointer-unstable-v1.xml +++ b/protocols/wlr-virtual-pointer-unstable-v1.xml @@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE. - + This protocol allows clients to emulate a physical pointer device. The requests are mostly mirror opposites of those specified in wl_pointer. @@ -118,7 +118,7 @@ - + This object allows clients to create individual virtual pointer objects. @@ -135,5 +135,18 @@ + + + + + Creates a new virtual pointer. The seat and the output arguments are + optional. If the seat argument is set, the compositor should assign the + input device to the requested seat. If the output argument is set, the + compositor should map the input device to the requested output. + + + + + diff --git a/src/main.c b/src/main.c index b0dc740..b0fae7c 100644 --- a/src/main.c +++ b/src/main.c @@ -69,6 +69,8 @@ struct wayvnc { struct zwp_virtual_keyboard_manager_v1* keyboard_manager; struct zwlr_virtual_pointer_manager_v1* pointer_manager; + int pointer_manager_version; + struct renderer renderer; const struct output* selected_output; const struct seat* selected_seat; @@ -163,7 +165,8 @@ static void registry_add(void* data, struct wl_registry* registry, self->pointer_manager = wl_registry_bind(registry, id, &zwlr_virtual_pointer_manager_v1_interface, - 1); + version); + self->pointer_manager_version = version; return; } @@ -766,8 +769,11 @@ int main(int argc, char* argv[]) self.pointer_backend.vnc = self.nvnc; self.pointer_backend.output = self.selected_output; - self.pointer_backend.pointer = - zwlr_virtual_pointer_manager_v1_create_virtual_pointer( + self.pointer_backend.pointer = self.pointer_manager_version == 2 + ? zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output( + self.pointer_manager, self.selected_seat->wl_seat, + out->wl_output) + : zwlr_virtual_pointer_manager_v1_create_virtual_pointer( self.pointer_manager, self.selected_seat->wl_seat); pointer_init(&self.pointer_backend);