seat: forward HUP to caller

We now forward VT_HUP to the caller so they can react on it. Default
behavior is to shutdown this seat. In single-seat mode we also close the
application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-12-02 12:42:35 +01:00
parent dc1ac3d891
commit 5d94e9eb48
3 changed files with 18 additions and 0 deletions

View File

@ -106,6 +106,19 @@ static int app_seat_event(struct kmscon_seat *s, unsigned int event,
if (!--app->vt_exit_count)
ev_eloop_exit(app->vt_eloop);
}
break;
case KMSCON_SEAT_HUP:
kmscon_seat_free(seat->seat);
seat->seat = NULL;
if (!shl_string_list_is(app->conf->seats, "all") &&
shl_string_list_count(app->conf->seats, true) == 1) {
log_debug("seat HUP in single-seat mode; exiting...");
ev_eloop_exit(app->eloop);
} else {
log_debug("seat HUP in multi-seat mode; ignoring...");
}
break;
}

View File

@ -539,6 +539,10 @@ static int seat_vt_event(struct uterm_vt *vt, struct uterm_vt_event *ev,
if (ret)
return ret;
break;
case UTERM_VT_HUP:
if (seat->cb)
seat->cb(seat, KMSCON_SEAT_HUP, seat->data);
break;
}
return 0;

View File

@ -46,6 +46,7 @@ enum kmscon_seat_event {
KMSCON_SEAT_SLEEP,
KMSCON_SEAT_BACKGROUND,
KMSCON_SEAT_FOREGROUND,
KMSCON_SEAT_HUP,
};
typedef int (*kmscon_seat_cb_t) (struct kmscon_seat *seat,