|
|
@ -1,6 +1,7 @@
|
|
|
|
#include <assert.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <wlr/types/wlr_primary_selection.h>
|
|
|
|
#include <wlr/types/wlr_primary_selection.h>
|
|
|
|
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include "util/signal.h"
|
|
|
|
#include "util/signal.h"
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_primary_selection_source_init(
|
|
|
|
void wlr_primary_selection_source_init(
|
|
|
@ -50,7 +51,14 @@ static void seat_handle_primary_selection_source_destroy(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_seat_set_primary_selection(struct wlr_seat *seat,
|
|
|
|
void wlr_seat_set_primary_selection(struct wlr_seat *seat,
|
|
|
|
struct wlr_primary_selection_source *source) {
|
|
|
|
struct wlr_primary_selection_source *source, uint32_t serial) {
|
|
|
|
|
|
|
|
if (seat->primary_selection_source != NULL &&
|
|
|
|
|
|
|
|
seat->primary_selection_serial - serial < UINT32_MAX / 2) {
|
|
|
|
|
|
|
|
wlr_log(WLR_DEBUG, "Rejecting set_selection request, invalid serial "
|
|
|
|
|
|
|
|
"(%"PRIu32" <= %"PRIu32")", serial, seat->primary_selection_serial);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (seat->primary_selection_source != NULL) {
|
|
|
|
if (seat->primary_selection_source != NULL) {
|
|
|
|
wl_list_remove(&seat->primary_selection_source_destroy.link);
|
|
|
|
wl_list_remove(&seat->primary_selection_source_destroy.link);
|
|
|
|
wlr_primary_selection_source_destroy(seat->primary_selection_source);
|
|
|
|
wlr_primary_selection_source_destroy(seat->primary_selection_source);
|
|
|
@ -58,6 +66,8 @@ void wlr_seat_set_primary_selection(struct wlr_seat *seat,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
seat->primary_selection_source = source;
|
|
|
|
seat->primary_selection_source = source;
|
|
|
|
|
|
|
|
seat->primary_selection_serial = serial;
|
|
|
|
|
|
|
|
|
|
|
|
if (source != NULL) {
|
|
|
|
if (source != NULL) {
|
|
|
|
seat->primary_selection_source_destroy.notify =
|
|
|
|
seat->primary_selection_source_destroy.notify =
|
|
|
|
seat_handle_primary_selection_source_destroy;
|
|
|
|
seat_handle_primary_selection_source_destroy;
|
|
|
|