mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Implemented primary-selection support
Well, wl-clipboard works now anyway
This commit is contained in:
parent
af1a945c1c
commit
73d114ffbe
4 changed files with 32 additions and 2 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
#define _WB_SEAT_H
|
#define _WB_SEAT_H
|
||||||
|
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.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_seat.h>
|
||||||
|
|
||||||
#include "waybox/server.h"
|
#include "waybox/server.h"
|
||||||
|
|
@ -10,6 +12,9 @@ struct wb_seat {
|
||||||
struct wlr_seat *seat;
|
struct wlr_seat *seat;
|
||||||
|
|
||||||
struct wl_list keyboards;
|
struct wl_list keyboards;
|
||||||
|
|
||||||
|
struct wl_listener request_set_primary_selection;
|
||||||
|
struct wl_listener request_set_selection;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wb_keyboard {
|
struct wb_keyboard {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include <wlr/types/wlr_screencopy_v1.h>
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,22 @@ static void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_seat_set_capabilities(server->seat->seat, caps);
|
wlr_seat_set_capabilities(server->seat->seat, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_request_set_primary_selection(struct wl_listener *listener,
|
||||||
|
void *data) {
|
||||||
|
struct wb_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 wb_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);
|
||||||
|
}
|
||||||
|
|
||||||
struct wb_seat *wb_seat_create(struct wb_server *server) {
|
struct wb_seat *wb_seat_create(struct wb_server *server) {
|
||||||
struct wb_seat *seat = malloc(sizeof(struct wb_seat));
|
struct wb_seat *seat = malloc(sizeof(struct wb_seat));
|
||||||
|
|
||||||
|
|
@ -152,10 +168,21 @@ struct wb_seat *wb_seat_create(struct wb_server *server) {
|
||||||
wl_signal_add(&server->backend->events.new_input, &server->new_input);
|
wl_signal_add(&server->backend->events.new_input, &server->new_input);
|
||||||
seat->seat = wlr_seat_create(server->wl_display, "seat0");
|
seat->seat = wlr_seat_create(server->wl_display, "seat0");
|
||||||
|
|
||||||
|
wlr_primary_selection_v1_device_manager_create(server->wl_display);
|
||||||
|
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);
|
||||||
|
seat->request_set_selection.notify = handle_request_set_selection;
|
||||||
|
wl_signal_add(&seat->seat->events.request_set_selection,
|
||||||
|
&seat->request_set_selection);
|
||||||
|
|
||||||
return seat;
|
return seat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wb_seat_destroy(struct wb_seat *seat) {
|
void wb_seat_destroy(struct wb_seat *seat) {
|
||||||
|
wl_list_remove(&seat->request_set_primary_selection.link);
|
||||||
|
wl_list_remove(&seat->request_set_selection.link);
|
||||||
wlr_seat_destroy(seat->seat);
|
wlr_seat_destroy(seat->seat);
|
||||||
free(seat);
|
free(seat);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ bool wb_start_server(struct wb_server* server) {
|
||||||
|
|
||||||
wlr_gamma_control_manager_v1_create(server->wl_display);
|
wlr_gamma_control_manager_v1_create(server->wl_display);
|
||||||
wlr_screencopy_manager_v1_create(server->wl_display);
|
wlr_screencopy_manager_v1_create(server->wl_display);
|
||||||
wlr_primary_selection_v1_device_manager_create(server->wl_display);
|
|
||||||
wlr_idle_create(server->wl_display);
|
wlr_idle_create(server->wl_display);
|
||||||
|
|
||||||
wlr_data_device_manager_create(server->wl_display);
|
wlr_data_device_manager_create(server->wl_display);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue