mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
seat: implement virtual pointer protocol
This commit is contained in:
parent
065b015fbb
commit
4b8d0ba4b2
2 changed files with 31 additions and 0 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
|
|
@ -156,6 +157,9 @@ struct seat {
|
||||||
struct wl_listener constraint_commit;
|
struct wl_listener constraint_commit;
|
||||||
struct wl_listener idle_inhibitor_create;
|
struct wl_listener idle_inhibitor_create;
|
||||||
struct wl_listener pressed_surface_destroy;
|
struct wl_listener pressed_surface_destroy;
|
||||||
|
|
||||||
|
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
||||||
|
struct wl_listener virtual_pointer_new;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lab_data_buffer;
|
struct lab_data_buffer;
|
||||||
|
|
|
||||||
27
src/seat.c
27
src/seat.c
|
|
@ -286,6 +286,27 @@ new_idle_inhibitor(struct wl_listener *listener, void *data)
|
||||||
wlr_idle_set_enabled(seat->wlr_idle, seat->seat, 0);
|
wlr_idle_set_enabled(seat->wlr_idle, seat->seat, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
new_virtual_pointer(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct seat *seat = wl_container_of(listener, seat, virtual_pointer_new);
|
||||||
|
struct wlr_virtual_pointer_v1_new_pointer_event *event = data;
|
||||||
|
struct wlr_virtual_pointer_v1 *pointer = event->new_pointer;
|
||||||
|
struct wlr_input_device *device = &pointer->pointer.base;
|
||||||
|
struct input *input = calloc(1, sizeof(struct input));
|
||||||
|
|
||||||
|
device->data = input;
|
||||||
|
input->wlr_input_device = device;
|
||||||
|
|
||||||
|
seat_add_device(seat, input);
|
||||||
|
new_pointer(seat, input);
|
||||||
|
|
||||||
|
if (event->suggested_output) {
|
||||||
|
wlr_cursor_map_input_to_output(seat->cursor, device,
|
||||||
|
event->suggested_output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
seat_init(struct server *server)
|
seat_init(struct server *server)
|
||||||
{
|
{
|
||||||
|
|
@ -310,6 +331,12 @@ seat_init(struct server *server)
|
||||||
&seat->idle_inhibitor_create);
|
&seat->idle_inhibitor_create);
|
||||||
seat->idle_inhibitor_create.notify = new_idle_inhibitor;
|
seat->idle_inhibitor_create.notify = new_idle_inhibitor;
|
||||||
|
|
||||||
|
seat->virtual_pointer = wlr_virtual_pointer_manager_v1_create(
|
||||||
|
server->wl_display);
|
||||||
|
wl_signal_add(&seat->virtual_pointer->events.new_virtual_pointer,
|
||||||
|
&seat->virtual_pointer_new);
|
||||||
|
seat->virtual_pointer_new.notify = new_virtual_pointer;
|
||||||
|
|
||||||
seat->cursor = wlr_cursor_create();
|
seat->cursor = wlr_cursor_create();
|
||||||
if (!seat->cursor) {
|
if (!seat->cursor) {
|
||||||
wlr_log(WLR_ERROR, "unable to create cursor");
|
wlr_log(WLR_ERROR, "unable to create cursor");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue