seat: listen on wlr_seat.events.request_set_selection and wlr_seat.events.request_set_primary_selection

This is now required with wlroots 0.3, see https://github.com/swaywm/wlroots/releases/tag/0.3
and https://github.com/swaywm/wlroots/pull/1402

Fixes #42.
This commit is contained in:
Jente Hidskes 2019-02-16 01:23:09 +01:00
parent 202f74f21a
commit 76e8be14d9
2 changed files with 27 additions and 0 deletions

25
seat.c
View file

@ -15,6 +15,7 @@
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xcursor_manager.h>
@ -340,6 +341,24 @@ handle_new_input(struct wl_listener *listener, void *data)
update_capabilities(seat);
}
static void
handle_request_set_primary_selection(struct wl_listener *listener, void *data)
{
struct cg_seat *seat = wl_container_of(listener, seat, request_set_primary_selection);
struct wlr_seat_request_set_primary_selection_event *event = data;
wlr_seat_set_primary_selection(seat->seat, event->source, event->serial);
}
static void
handle_request_set_selection(struct wl_listener *listener, void *data)
{
struct cg_seat *seat = wl_container_of(listener, seat, request_set_selection);
struct wlr_seat_request_set_selection_event *event = data;
wlr_seat_set_selection(seat->seat, event->source, event->serial);
}
static void
handle_request_set_cursor(struct wl_listener *listener, void *data)
{
@ -631,6 +650,8 @@ handle_destroy(struct wl_listener *listener, void *data)
wl_list_remove(&seat->touch_up.link);
wl_list_remove(&seat->touch_motion.link);
wl_list_remove(&seat->request_set_cursor.link);
wl_list_remove(&seat->request_set_selection.link);
wl_list_remove(&seat->request_set_primary_selection.link);
}
struct cg_seat *
@ -692,6 +713,10 @@ seat_create(struct cg_server *server)
seat->request_set_cursor.notify = handle_request_set_cursor;
wl_signal_add(&seat->seat->events.request_set_cursor, &seat->request_set_cursor);
seat->request_set_selection.notify = handle_request_set_selection;
wl_signal_add(&seat->seat->events.request_set_selection, &seat->request_set_selection);
seat->request_set_primary_selection.notify = handle_request_set_primary_selection;
wl_signal_add(&seat->seat->events.request_set_primary_selection, &seat->request_set_primary_selection);
wl_list_init(&seat->keyboards);
wl_list_init(&seat->pointers);

2
seat.h
View file

@ -43,6 +43,8 @@ struct cg_seat {
struct wl_listener new_drag_icon;
struct wl_listener request_set_cursor;
struct wl_listener request_set_selection;
struct wl_listener request_set_primary_selection;
};
struct cg_keyboard {