mirror of
https://github.com/swaywm/sway.git
synced 2026-04-25 06:46:24 -04:00
Implement seat management
This commit is contained in:
parent
e8e7bbc85f
commit
5b1c8e1fa4
2 changed files with 22 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||
#include <wlr/types/wlr_seat_management_v1.h>
|
||||
#include "sway/server.h"
|
||||
#include "sway/config.h"
|
||||
#include "list.h"
|
||||
|
|
@ -25,6 +26,7 @@ struct sway_input_manager {
|
|||
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
||||
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
||||
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
||||
struct wlr_seat_manager_v1 *seat_manager;
|
||||
|
||||
struct wl_listener new_input;
|
||||
struct wl_listener inhibit_activate;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_keyboard_group.h>
|
||||
|
|
@ -442,6 +443,19 @@ void handle_virtual_pointer(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
}
|
||||
|
||||
struct wlr_seat *seat_manager_create_seat(const char *name) {
|
||||
struct sway_seat *seat = seat_create(name);
|
||||
return seat ? seat->wlr_seat : NULL;
|
||||
}
|
||||
|
||||
void seat_manager_destroy_seat(struct wlr_seat *wlr_seat) {
|
||||
struct sway_seat *seat =
|
||||
input_manager_sway_seat_from_wlr_seat(wlr_seat);
|
||||
if (seat) {
|
||||
seat_destroy(seat);
|
||||
}
|
||||
}
|
||||
|
||||
struct sway_input_manager *input_manager_create(struct sway_server *server) {
|
||||
struct sway_input_manager *input =
|
||||
calloc(1, sizeof(struct sway_input_manager));
|
||||
|
|
@ -483,6 +497,12 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) {
|
|||
wl_signal_add(&input->keyboard_shortcuts_inhibit->events.new_inhibitor,
|
||||
&input->keyboard_shortcuts_inhibit_new_inhibitor);
|
||||
|
||||
input->seat_manager = wlr_seat_manager_v1_create(server->wl_display);
|
||||
assert(input->seat_manager);
|
||||
|
||||
input->seat_manager->create_seat = seat_manager_create_seat;
|
||||
input->seat_manager->destroy_seat = seat_manager_destroy_seat;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue