Map input to the selected output

pull/20/head
Andri Yngvason 2020-02-05 22:33:16 +00:00
parent 345d1d054a
commit 10e5c08752
2 changed files with 24 additions and 5 deletions

View File

@ -23,7 +23,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zwlr_virtual_pointer_v1" version="1">
<interface name="zwlr_virtual_pointer_v1" version="2">
<description summary="virtual pointer">
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 @@
</request>
</interface>
<interface name="zwlr_virtual_pointer_manager_v1" version="1">
<interface name="zwlr_virtual_pointer_manager_v1" version="2">
<description summary="virtual pointer manager">
This object allows clients to create individual virtual pointer objects.
</description>
@ -135,5 +135,18 @@
<request name="destroy" type="destructor" since="1">
<description summary="destroy the virtual pointer manager"/>
</request>
<!-- Version 2 additions -->
<request name="create_virtual_pointer_with_output" since="2">
<description summary="Create a new virtual pointer">
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.
</description>
<arg name="seat" type="object" interface="wl_seat" allow-null="true"/>
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
<arg name="id" type="new_id" interface="zwlr_virtual_pointer_v1"/>
</request>
</interface>
</protocol>

View File

@ -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);