X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-seat.c;h=72bcfc4a52b89ac0c4a7ac4fad7a216d62b2968c;hb=c784f8fb150c50f55edb824737b536214f8e8e13;hp=8198011c207c5586655039af8bbc297781eb98db;hpb=f97a438ab62bd1ea07c4574eac48d7b8fc4d7387;p=elogind.git diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 8198011c2..72bcfc4a5 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -241,7 +241,7 @@ int seat_set_active(Seat *s, Session *session) { int seat_switch_to(Seat *s, unsigned int num) { /* Public session positions skip 0 (there is only F1-F12). Maybe it * will get reassigned in the future, so return error for now. */ - if (!num) + if (num == 0) return -EINVAL; if (num >= s->position_count || !s->positions[num]) { @@ -258,12 +258,12 @@ int seat_switch_to(Seat *s, unsigned int num) { int seat_switch_to_next(Seat *s) { unsigned int start, i; - if (!s->position_count) + if (s->position_count == 0) return -EINVAL; start = 1; - if (s->active && s->active->pos > 0) - start = s->active->pos; + if (s->active && s->active->position > 0) + start = s->active->position; for (i = start + 1; i < s->position_count; ++i) if (s->positions[i]) @@ -279,12 +279,12 @@ int seat_switch_to_next(Seat *s) { int seat_switch_to_previous(Seat *s) { unsigned int start, i; - if (!s->position_count) + if (s->position_count == 0) return -EINVAL; start = 1; - if (s->active && s->active->pos > 0) - start = s->active->pos; + if (s->active && s->active->position > 0) + start = s->active->position; for (i = start - 1; i > 0; --i) if (s->positions[i]) @@ -440,21 +440,21 @@ int seat_stop_sessions(Seat *s, bool force) { void seat_evict_position(Seat *s, Session *session) { Session *iter; - unsigned int pos = session->pos; + unsigned int pos = session->position; - session->pos = 0; + session->position = 0; - if (!pos) + if (pos == 0) return; if (pos < s->position_count && s->positions[pos] == session) { s->positions[pos] = NULL; /* There might be another session claiming the same - * position (eg., during gdm->session transition), so lets look + * position (eg., during gdm->session transition), so let's look * for it and set it on the free slot. */ LIST_FOREACH(sessions_by_seat, iter, s->sessions) { - if (iter->pos == pos) { + if (iter->position == pos) { s->positions[pos] = iter; break; } @@ -472,7 +472,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) { seat_evict_position(s, session); - session->pos = pos; + session->position = pos; if (pos > 0 && !s->positions[pos]) s->positions[pos] = session; } @@ -480,7 +480,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) { static void seat_assign_position(Seat *s, Session *session) { unsigned int pos; - if (session->pos > 0) + if (session->position > 0) return; for (pos = 1; pos < s->position_count; ++pos)