diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-06-12 15:53:03 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-06-12 15:53:03 +0200 |
commit | 4962213bace101fd2861c19cc0e4c057b15a2030 (patch) | |
tree | feacce7a15270701bd4d89d4ca54ee991bdbbf31 /src | |
parent | 35eb595863af94a9b89cf00fecec21490fe0ffd7 (diff) |
kmscon: pass vtnr to pty so XDG_VTNR is set
We need to correctly set the VTNR for each new pty, otherwise the pty
cannot set the XDG_VTNR correctly. Note that we do this only for real VTs,
that is, vtnr > 0.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/kmscon_seat.c | 6 | ||||
-rw-r--r-- | src/kmscon_terminal.c | 8 | ||||
-rw-r--r-- | src/kmscon_terminal.h | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/kmscon_seat.c b/src/kmscon_seat.c index 8a259b9..9565f49 100644 --- a/src/kmscon_seat.c +++ b/src/kmscon_seat.c @@ -614,7 +614,8 @@ static void seat_input_event(struct uterm_input *input, ev->handled = true; if (!seat->conf->session_control) return; - ret = kmscon_terminal_register(&s, seat); + ret = kmscon_terminal_register(&s, seat, + uterm_vt_get_num(seat->vt)); if (ret == -EOPNOTSUPP) { log_notice("terminal support not compiled in"); } else if (ret) { @@ -791,7 +792,8 @@ void kmscon_seat_startup(struct kmscon_seat *seat) } if (seat->conf->terminal_session) { - ret = kmscon_terminal_register(&s, seat); + ret = kmscon_terminal_register(&s, seat, + uterm_vt_get_num(seat->vt)); if (ret == -EOPNOTSUPP) log_notice("terminal support not compiled in"); else if (ret) diff --git a/src/kmscon_terminal.c b/src/kmscon_terminal.c index 740a27c..482d50f 100644 --- a/src/kmscon_terminal.c +++ b/src/kmscon_terminal.c @@ -580,7 +580,7 @@ static void write_event(struct tsm_vte *vte, const char *u8, size_t len, } int kmscon_terminal_register(struct kmscon_session **out, - struct kmscon_seat *seat) + struct kmscon_seat *seat, unsigned int vtnr) { struct kmscon_terminal *term; int ret; @@ -646,6 +646,12 @@ int kmscon_terminal_register(struct kmscon_session **out, if (ret) goto err_pty; + if (vtnr > 0) { + ret = kmscon_pty_set_vtnr(term->pty, vtnr); + if (ret) + goto err_pty; + } + ret = ev_eloop_new_fd(term->eloop, &term->ptyfd, kmscon_pty_get_fd(term->pty), EV_READABLE, pty_event, term); diff --git a/src/kmscon_terminal.h b/src/kmscon_terminal.h index 9035b72..9c6a373 100644 --- a/src/kmscon_terminal.h +++ b/src/kmscon_terminal.h @@ -40,12 +40,14 @@ #ifdef BUILD_ENABLE_SESSION_TERMINAL int kmscon_terminal_register(struct kmscon_session **out, - struct kmscon_seat *seat); + struct kmscon_seat *seat, + unsigned int vtnr); #else /* !BUILD_ENABLE_SESSION_TERMINAL */ static inline int kmscon_terminal_register(struct kmscon_session **out, - struct kmscon_seat *seat) + struct kmscon_seat *seat, + unsigned int vtnr) { return -EOPNOTSUPP; } |