Merge pull request #2890 from mihaicmn/create-default-seat

Fix crash when defaut seat is not created
This commit is contained in:
Ryan Dwyer 2018-10-20 19:43:58 +10:00 committed by GitHub
commit cafb1ff4f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,10 @@ struct sway_seat *input_manager_current_seat(void) {
return seat; return seat;
} }
struct sway_seat *input_manager_get_default_seat(void) {
return input_manager_get_seat(DEFAULT_SEAT);
}
struct sway_seat *input_manager_get_seat(const char *seat_name) { struct sway_seat *input_manager_get_seat(const char *seat_name) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) { wl_list_for_each(seat, &server.input->seats, link) {
@ -294,7 +298,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
if (!input_has_seat_configuration()) { if (!input_has_seat_configuration()) {
wlr_log(WLR_DEBUG, "no seat configuration, using default seat"); wlr_log(WLR_DEBUG, "no seat configuration, using default seat");
seat = input_manager_get_seat(DEFAULT_SEAT); seat = input_manager_get_default_seat();
seat_add_device(seat, input_device); seat_add_device(seat, input_device);
return; return;
} }
@ -517,16 +521,6 @@ void input_manager_configure_xcursor(void) {
} }
} }
struct sway_seat *input_manager_get_default_seat(void) {
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &server.input->seats, link) {
if (strcmp(seat->wlr_seat->name, DEFAULT_SEAT) == 0) {
return seat;
}
}
return seat;
}
struct input_config *input_device_get_config(struct sway_input_device *device) { struct input_config *input_device_get_config(struct sway_input_device *device) {
struct input_config *wildcard_config = NULL; struct input_config *wildcard_config = NULL;
struct input_config *input_config = NULL; struct input_config *input_config = NULL;