Compare commits
1 Commits
master
...
seat-manag
Author | SHA1 | Date |
---|---|---|
Andri Yngvason | dbfef1306f |
|
@ -17,6 +17,7 @@ client_protocols = [
|
||||||
'wlr-export-dmabuf-unstable-v1.xml',
|
'wlr-export-dmabuf-unstable-v1.xml',
|
||||||
'wlr-screencopy-unstable-v1.xml',
|
'wlr-screencopy-unstable-v1.xml',
|
||||||
'wlr-virtual-pointer-unstable-v1.xml',
|
'wlr-virtual-pointer-unstable-v1.xml',
|
||||||
|
'wlr-seat-management-unstable-v1.xml',
|
||||||
'virtual-keyboard-unstable-v1.xml',
|
'virtual-keyboard-unstable-v1.xml',
|
||||||
'xdg-output-unstable-v1.xml',
|
'xdg-output-unstable-v1.xml',
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="wlr_seat_management_unstable_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2020 Andri Yngvason
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol for managing seats">
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwlr_seat_manager_v1" version="1">
|
||||||
|
<request name="create_chair">
|
||||||
|
<description summary="Create a transient seat">
|
||||||
|
Create a new seat that is removed when the client closes the connection.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string"/>
|
||||||
|
<arg name="seat" type="new_id" interface="zwlr_chair_v1"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="Destroy the manager">
|
||||||
|
Destroy the manager
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwlr_chair_v1" version="1">
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="Destroy the chair">
|
||||||
|
Destroy the chair
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
25
src/main.c
25
src/main.c
|
@ -36,6 +36,7 @@
|
||||||
#include "wlr-export-dmabuf-unstable-v1.h"
|
#include "wlr-export-dmabuf-unstable-v1.h"
|
||||||
#include "wlr-screencopy-unstable-v1.h"
|
#include "wlr-screencopy-unstable-v1.h"
|
||||||
#include "wlr-virtual-pointer-unstable-v1.h"
|
#include "wlr-virtual-pointer-unstable-v1.h"
|
||||||
|
#include "wlr-seat-management-unstable-v1.h"
|
||||||
#include "virtual-keyboard-unstable-v1.h"
|
#include "virtual-keyboard-unstable-v1.h"
|
||||||
#include "xdg-output-unstable-v1.h"
|
#include "xdg-output-unstable-v1.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
@ -68,6 +69,8 @@ struct wayvnc {
|
||||||
struct zxdg_output_manager_v1* xdg_output_manager;
|
struct zxdg_output_manager_v1* xdg_output_manager;
|
||||||
struct zwp_virtual_keyboard_manager_v1* keyboard_manager;
|
struct zwp_virtual_keyboard_manager_v1* keyboard_manager;
|
||||||
struct zwlr_virtual_pointer_manager_v1* pointer_manager;
|
struct zwlr_virtual_pointer_manager_v1* pointer_manager;
|
||||||
|
struct zwlr_seat_manager_v1* seat_manager;
|
||||||
|
struct zwlr_chair_v1* chair;
|
||||||
|
|
||||||
struct renderer renderer;
|
struct renderer renderer;
|
||||||
const struct output* selected_output;
|
const struct output* selected_output;
|
||||||
|
@ -190,6 +193,14 @@ static void registry_add(void* data, struct wl_registry* registry,
|
||||||
1);
|
1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(interface, zwlr_seat_manager_v1_interface.name) == 0) {
|
||||||
|
self->seat_manager =
|
||||||
|
wl_registry_bind(registry, id,
|
||||||
|
&zwlr_seat_manager_v1_interface, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registry_remove(void* data, struct wl_registry* registry,
|
static void registry_remove(void* data, struct wl_registry* registry,
|
||||||
|
@ -227,6 +238,7 @@ void wayvnc_destroy(struct wayvnc* self)
|
||||||
|
|
||||||
wl_shm_destroy(self->screencopy_backend.wl_shm);
|
wl_shm_destroy(self->screencopy_backend.wl_shm);
|
||||||
|
|
||||||
|
zwlr_seat_manager_v1_destroy(self->seat_manager);
|
||||||
zwp_virtual_keyboard_v1_destroy(self->keyboard_backend.virtual_keyboard);
|
zwp_virtual_keyboard_v1_destroy(self->keyboard_backend.virtual_keyboard);
|
||||||
zwp_virtual_keyboard_manager_v1_destroy(self->keyboard_manager);
|
zwp_virtual_keyboard_manager_v1_destroy(self->keyboard_manager);
|
||||||
keyboard_destroy(&self->keyboard_backend);
|
keyboard_destroy(&self->keyboard_backend);
|
||||||
|
@ -290,6 +302,17 @@ static int init_wayland(struct wayvnc* self)
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self->seat_manager) {
|
||||||
|
log_error("Seat management protocol not supported by compositor.\n");
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
self->chair = zwlr_seat_manager_v1_create_chair(self->seat_manager, "wayvnc");
|
||||||
|
if (!self) {
|
||||||
|
log_error("Failed to create a seat for wayvnc.\n");
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
wl_display_dispatch(self->display);
|
wl_display_dispatch(self->display);
|
||||||
wl_display_roundtrip(self->display);
|
wl_display_roundtrip(self->display);
|
||||||
|
|
||||||
|
@ -738,7 +761,7 @@ int main(int argc, char* argv[])
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seat = seat_first(&self.seats);
|
seat = seat_find_by_name(&self.seats, "wayvnc");
|
||||||
if (!seat) {
|
if (!seat) {
|
||||||
log_error("No seat found\n");
|
log_error("No seat found\n");
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
Loading…
Reference in New Issue