seat: be a little more forgiving in the case there's no open terminal

We can end up in a situation where a seat object doesn't have a terminal
associated with it.  In that case we shouldn't crash, but continue on
with no input available for that seat.

https://bugs.freedesktop.org/show_bug.cgi?id=80553
This commit is contained in:
Ray Strode 2014-07-14 08:04:54 -04:00
parent a58ae9ba27
commit 84eb4381db

View file

@ -144,13 +144,22 @@ ply_seat_open (ply_seat_t *seat,
if (seat->renderer != NULL) {
seat->keyboard = ply_keyboard_new_for_renderer (seat->renderer);
add_pixel_displays (seat);
} else {
} else if (seat->terminal != NULL) {
seat->keyboard = ply_keyboard_new_for_terminal (seat->terminal);
}
add_text_displays (seat);
ply_keyboard_watch_for_input (seat->keyboard);
seat->keyboard_active = true;
if (seat->terminal != NULL) {
add_text_displays (seat);
} else {
ply_trace ("not adding text display for seat, since seat has no associated terminal");
}
if (seat->keyboard != NULL) {
ply_keyboard_watch_for_input (seat->keyboard);
seat->keyboard_active = true;
} else {
ply_trace ("not watching seat for input");
}
return true;
}