mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
remove empty seats
This commit is contained in:
parent
afd66d63cc
commit
6e85e7ec89
5 changed files with 19 additions and 0 deletions
|
|
@ -53,6 +53,8 @@ struct sway_seat *input_manager_get_seat(const char *seat_name, bool create);
|
|||
*/
|
||||
void input_manager_verify_fallback_seat(void);
|
||||
|
||||
void input_manager_seat_consider_destroy(const char *seat_name);
|
||||
|
||||
/**
|
||||
* Gets the last seat the user interacted with
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ struct sway_seat *seat_create(const char *seat_name);
|
|||
|
||||
void seat_destroy(struct sway_seat *seat);
|
||||
|
||||
void seat_consider_destroy(struct sway_seat *seat);
|
||||
|
||||
void seat_add_device(struct sway_seat *seat,
|
||||
struct sway_input_device *device);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
|
||||
struct cmd_results *seat_cmd_detach(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
|
|
@ -23,5 +24,8 @@ struct cmd_results *seat_cmd_detach(int argc, char **argv) {
|
|||
if (!config->validating) {
|
||||
input_manager_apply_seat_config(new_seat_config(current_seat_config->name));
|
||||
}
|
||||
|
||||
input_manager_seat_consider_destroy(current_seat_config->name);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -729,6 +729,11 @@ void input_manager_apply_seat_config(struct seat_config *seat_config) {
|
|||
}
|
||||
}
|
||||
|
||||
void input_manager_seat_consider_destroy(const char *seat_name) {
|
||||
struct sway_seat *seat = input_manager_get_seat(seat_name, false);
|
||||
seat_consider_destroy(seat);
|
||||
}
|
||||
|
||||
void input_manager_configure_xcursor(void) {
|
||||
struct sway_seat *seat = NULL;
|
||||
wl_list_for_each(seat, &server.input->seats, link) {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ static void seat_node_destroy(struct sway_seat_node *seat_node) {
|
|||
free(seat_node);
|
||||
}
|
||||
|
||||
void seat_consider_destroy(struct sway_seat *seat) {
|
||||
if (wl_list_empty(&seat->devices)) {
|
||||
seat_destroy(seat);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate all views within this container recursively.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue