summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-12-02 22:57:05 +0100
committerLibravatar emersion <contact@emersion.fr>2019-01-24 11:48:19 +0100
commit75406bb93b96091d30e52922d0f319530fe65471 (patch)
tree31c0d2a7633684cc58e00c03f9f493ee4091c303
parentMake json-c include respect pkg-config --cflags (diff)
downloadsway-75406bb93b96091d30e52922d0f319530fe65471.tar.gz
sway-75406bb93b96091d30e52922d0f319530fe65471.tar.zst
sway-75406bb93b96091d30e52922d0f319530fe65471.zip
Update for swaywm/wlroots#1402
-rw-r--r--include/sway/input/seat.h2
-rw-r--r--sway/input/seat.c31
2 files changed, 32 insertions, 1 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index d2f14895..ef85b67f 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -76,6 +76,8 @@ struct sway_seat {
76 struct wl_listener focus_destroy; 76 struct wl_listener focus_destroy;
77 struct wl_listener new_node; 77 struct wl_listener new_node;
78 struct wl_listener new_drag_icon; 78 struct wl_listener new_drag_icon;
79 struct wl_listener request_set_selection;
80 struct wl_listener request_set_primary_selection;
79 81
80 struct wl_list devices; // sway_seat_device::link 82 struct wl_list devices; // sway_seat_device::link
81 83
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 1a4ccd77..fd5eda2d 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -5,10 +5,12 @@
5#include <strings.h> 5#include <strings.h>
6#include <time.h> 6#include <time.h>
7#include <wlr/types/wlr_cursor.h> 7#include <wlr/types/wlr_cursor.h>
8#include <wlr/types/wlr_data_device.h>
8#include <wlr/types/wlr_output_layout.h> 9#include <wlr/types/wlr_output_layout.h>
10#include <wlr/types/wlr_primary_selection.h>
9#include <wlr/types/wlr_xcursor_manager.h> 11#include <wlr/types/wlr_xcursor_manager.h>
10#include "log.h"
11#include "config.h" 12#include "config.h"
13#include "log.h"
12#include "sway/debug.h" 14#include "sway/debug.h"
13#include "sway/desktop.h" 15#include "sway/desktop.h"
14#include "sway/input/cursor.h" 16#include "sway/input/cursor.h"
@@ -44,6 +46,8 @@ void seat_destroy(struct sway_seat *seat) {
44 sway_cursor_destroy(seat->cursor); 46 sway_cursor_destroy(seat->cursor);
45 wl_list_remove(&seat->new_node.link); 47 wl_list_remove(&seat->new_node.link);
46 wl_list_remove(&seat->new_drag_icon.link); 48 wl_list_remove(&seat->new_drag_icon.link);
49 wl_list_remove(&seat->request_set_selection.link);
50 wl_list_remove(&seat->request_set_primary_selection.link);
47 wl_list_remove(&seat->link); 51 wl_list_remove(&seat->link);
48 wlr_seat_destroy(seat->wlr_seat); 52 wlr_seat_destroy(seat->wlr_seat);
49 free(seat->prev_workspace_name); 53 free(seat->prev_workspace_name);
@@ -311,6 +315,22 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) {
311 seatop_abort(seat); 315 seatop_abort(seat);
312} 316}
313 317
318static void handle_request_set_selection(struct wl_listener *listener,
319 void *data) {
320 struct sway_seat *seat =
321 wl_container_of(listener, seat, request_set_selection);
322 struct wlr_seat_request_set_selection_event *event = data;
323 wlr_seat_set_selection(seat->wlr_seat, event->source, event->serial);
324}
325
326static void handle_request_set_primary_selection(struct wl_listener *listener,
327 void *data) {
328 struct sway_seat *seat =
329 wl_container_of(listener, seat, request_set_primary_selection);
330 struct wlr_seat_request_set_primary_selection_event *event = data;
331 wlr_seat_set_primary_selection(seat->wlr_seat, event->source, event->serial);
332}
333
314static void collect_focus_iter(struct sway_node *node, void *data) { 334static void collect_focus_iter(struct sway_node *node, void *data) {
315 struct sway_seat *seat = data; 335 struct sway_seat *seat = data;
316 struct sway_seat_node *seat_node = seat_node_from_node(seat, node); 336 struct sway_seat_node *seat_node = seat_node_from_node(seat, node);
@@ -371,6 +391,15 @@ struct sway_seat *seat_create(const char *seat_name) {
371 wl_signal_add(&seat->wlr_seat->events.new_drag_icon, &seat->new_drag_icon); 391 wl_signal_add(&seat->wlr_seat->events.new_drag_icon, &seat->new_drag_icon);
372 seat->new_drag_icon.notify = handle_new_drag_icon; 392 seat->new_drag_icon.notify = handle_new_drag_icon;
373 393
394 wl_signal_add(&seat->wlr_seat->events.request_set_selection,
395 &seat->request_set_selection);
396 seat->request_set_selection.notify = handle_request_set_selection;
397
398 wl_signal_add(&seat->wlr_seat->events.request_set_primary_selection,
399 &seat->request_set_primary_selection);
400 seat->request_set_primary_selection.notify =
401 handle_request_set_primary_selection;
402
374 wl_list_init(&seat->devices); 403 wl_list_init(&seat->devices);
375 404
376 wl_list_insert(&server.input->seats, &seat->link); 405 wl_list_insert(&server.input->seats, &seat->link);