commit 60e77eb6d3d2779cb51f5c11a19ff9673fec1220
parent 5936cf5aff5a2cf781c339b7ae0e245a18dda8a8
Author: deurzen <max@deurzen.net>
Date: Wed, 1 Jun 2022 08:38:35 +0200
provides {,primary}selection functionality
Diffstat:
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/kranewl/input/seat.cc b/src/kranewl/input/seat.cc
@@ -7,10 +7,13 @@
extern "C" {
#include <wlr/types/wlr_cursor.h>
-#include <wlr/types/wlr_seat.h>
-#include <wlr/types/wlr_xcursor_manager.h>
+#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_input_inhibitor.h>
+#include <wlr/types/wlr_primary_selection.h>
+#include <wlr/types/wlr_primary_selection_v1.h>
+#include <wlr/types/wlr_seat.h>
+#include <wlr/types/wlr_xcursor_manager.h>
}
Seat::Seat(
@@ -101,17 +104,35 @@ Seat::handle_destroy(struct wl_listener*, void*)
}
void
-Seat::handle_request_set_selection(struct wl_listener*, void*)
+Seat::handle_request_set_selection(struct wl_listener* listener, void* data)
{
TRACE();
+ Seat_ptr seat = wl_container_of(listener, seat, ml_request_set_selection);
+ struct wlr_seat_request_set_selection_event* event
+ = reinterpret_cast<struct wlr_seat_request_set_selection_event*>(data);
+
+ wlr_seat_set_selection(
+ seat->mp_wlr_seat,
+ event->source,
+ event->serial
+ );
}
void
-Seat::handle_request_set_primary_selection(struct wl_listener*, void*)
+Seat::handle_request_set_primary_selection(struct wl_listener* listener, void* data)
{
TRACE();
+ Seat_ptr seat = wl_container_of(listener, seat, ml_request_set_primary_selection);
+ struct wlr_seat_request_set_primary_selection_event* event
+ = reinterpret_cast<struct wlr_seat_request_set_primary_selection_event*>(data);
+
+ wlr_seat_set_primary_selection(
+ seat->mp_wlr_seat,
+ event->source,
+ event->serial
+ );
}
void