|
|
@ -50,25 +50,28 @@ struct tty { |
|
|
|
|
|
|
|
|
|
|
|
struct wl_event_source *input_source; |
|
|
|
struct wl_event_source *input_source; |
|
|
|
struct wl_event_source *vt_source; |
|
|
|
struct wl_event_source *vt_source; |
|
|
|
tty_vt_func_t vt_func; |
|
|
|
int vt, starting_vt; |
|
|
|
int vt, starting_vt, has_vt; |
|
|
|
|
|
|
|
int kb_mode; |
|
|
|
int kb_mode; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static int vt_handler(int signal_number, void *data) |
|
|
|
static int vt_handler(int signal_number, void *data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct tty *tty = data; |
|
|
|
struct tty *tty = data; |
|
|
|
|
|
|
|
struct weston_compositor *compositor = tty->compositor; |
|
|
|
|
|
|
|
|
|
|
|
if (tty->has_vt) { |
|
|
|
if (compositor->session_active) { |
|
|
|
tty->vt_func(tty->compositor, TTY_LEAVE_VT); |
|
|
|
compositor->session_active = 0; |
|
|
|
tty->has_vt = 0; |
|
|
|
wl_signal_emit(&tty->compositor->session_signal, |
|
|
|
|
|
|
|
tty->compositor); |
|
|
|
|
|
|
|
|
|
|
|
ioctl(tty->fd, VT_RELDISP, 1); |
|
|
|
ioctl(tty->fd, VT_RELDISP, 1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
ioctl(tty->fd, VT_RELDISP, VT_ACKACQ); |
|
|
|
ioctl(tty->fd, VT_RELDISP, VT_ACKACQ); |
|
|
|
|
|
|
|
|
|
|
|
tty->vt_func(tty->compositor, TTY_ENTER_VT); |
|
|
|
compositor->session_active = 1; |
|
|
|
tty->has_vt = 1; |
|
|
|
wl_signal_emit(&tty->compositor->session_signal, |
|
|
|
|
|
|
|
tty->compositor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
return 1; |
|
|
@ -120,8 +123,7 @@ tty_activate_vt(struct tty *tty, int vt) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct tty * |
|
|
|
struct tty * |
|
|
|
tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, |
|
|
|
tty_create(struct weston_compositor *compositor, int tty_nr) |
|
|
|
int tty_nr) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct termios raw_attributes; |
|
|
|
struct termios raw_attributes; |
|
|
|
struct vt_mode mode = { 0 }; |
|
|
|
struct vt_mode mode = { 0 }; |
|
|
@ -137,7 +139,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
tty->compositor = compositor; |
|
|
|
tty->compositor = compositor; |
|
|
|
tty->vt_func = vt_func; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tty->fd = weston_environment_get_fd("WESTON_TTY_FD"); |
|
|
|
tty->fd = weston_environment_get_fd("WESTON_TTY_FD"); |
|
|
|
if (tty->fd < 0) |
|
|
|
if (tty->fd < 0) |
|
|
@ -218,7 +219,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, |
|
|
|
goto err_kdkbmode; |
|
|
|
goto err_kdkbmode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
tty->has_vt = 1; |
|
|
|
|
|
|
|
mode.mode = VT_PROCESS; |
|
|
|
mode.mode = VT_PROCESS; |
|
|
|
mode.relsig = SIGUSR1; |
|
|
|
mode.relsig = SIGUSR1; |
|
|
|
mode.acqsig = SIGUSR1; |
|
|
|
mode.acqsig = SIGUSR1; |
|
|
@ -271,7 +271,7 @@ void tty_reset(struct tty *tty) |
|
|
|
if (ioctl(tty->fd, VT_SETMODE, &mode) < 0) |
|
|
|
if (ioctl(tty->fd, VT_SETMODE, &mode) < 0) |
|
|
|
weston_log("could not reset vt handling\n"); |
|
|
|
weston_log("could not reset vt handling\n"); |
|
|
|
|
|
|
|
|
|
|
|
if (tty->has_vt && tty->vt != tty->starting_vt) { |
|
|
|
if (tty->compositor->session_active && tty->vt != tty->starting_vt) { |
|
|
|
ioctl(tty->fd, VT_ACTIVATE, tty->starting_vt); |
|
|
|
ioctl(tty->fd, VT_ACTIVATE, tty->starting_vt); |
|
|
|
ioctl(tty->fd, VT_WAITACTIVE, tty->starting_vt); |
|
|
|
ioctl(tty->fd, VT_WAITACTIVE, tty->starting_vt); |
|
|
|
} |
|
|
|
} |
|
|
|