mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
cleanup
This commit is contained in:
parent
a4c1270ef0
commit
63f7fb9517
|
@ -14,6 +14,7 @@ struct seat_config *new_seat_config(const char* name) {
|
||||||
sway_log(L_DEBUG, "new_seat_config(%s)", name);
|
sway_log(L_DEBUG, "new_seat_config(%s)", name);
|
||||||
seat->name = strdup(name);
|
seat->name = strdup(name);
|
||||||
if (!sway_assert(seat->name, "could not allocate name for seat")) {
|
if (!sway_assert(seat->name, "could not allocate name for seat")) {
|
||||||
|
free(seat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ struct seat_config *new_seat_config(const char* name) {
|
||||||
seat->attachments = create_list();
|
seat->attachments = create_list();
|
||||||
if (!sway_assert(seat->attachments,
|
if (!sway_assert(seat->attachments,
|
||||||
"could not allocate seat attachments list")) {
|
"could not allocate seat attachments list")) {
|
||||||
|
free(seat->name);
|
||||||
|
free(seat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,11 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
bool added = false;
|
bool added = false;
|
||||||
wl_list_for_each(seat, &input->seats, link) {
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
if (seat->config &&
|
bool has_attachment = seat->config &&
|
||||||
(seat_config_get_attachment(seat->config,
|
(seat_config_get_attachment(seat->config, input_device->identifier) ||
|
||||||
input_device->identifier) ||
|
seat_config_get_attachment(seat->config, "*"));
|
||||||
seat_config_get_attachment(seat->config, "*"))) {
|
|
||||||
|
if (has_attachment) {
|
||||||
sway_seat_add_device(seat, input_device);
|
sway_seat_add_device(seat, input_device);
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input,
|
||||||
|
|
||||||
seat->wlr_seat = wlr_seat_create(input->server->wl_display, seat_name);
|
seat->wlr_seat = wlr_seat_create(input->server->wl_display, seat_name);
|
||||||
if (!sway_assert(seat->wlr_seat, "could not allocate seat")) {
|
if (!sway_assert(seat->wlr_seat, "could not allocate seat")) {
|
||||||
|
free(seat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue