From 1ae944c07189b54d5d7458a2d0efaa39fbbac457 Mon Sep 17 00:00:00 2001 From: Greg V Date: Wed, 22 Nov 2017 15:57:05 +0300 Subject: Use SIGUSR2 for vt switching instead of SIGUSR1 Xwayland uses SIGUSR1 to signal readiness. With direct(-freebsd) session and Xwayland, wlroots was confusing the Xwayland readiness signal with a vt switch signal, freezing the desktop. Same problem was found in Weston in 2014: https://phabricator.freedesktop.org/T7080 --- backend/session/direct-freebsd.c | 6 +++--- backend/session/direct.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'backend/session') diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index fc4bab04..c0621416 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -148,8 +148,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display struct vt_mode mode = { .mode = VT_PROCESS, - .relsig = SIGUSR1, - .acqsig = SIGUSR1, + .relsig = SIGUSR2, + .acqsig = SIGUSR2, .frsig = SIGIO, // has to be set }; @@ -159,7 +159,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display } struct wl_event_loop *loop = wl_display_get_event_loop(display); - session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1, + session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2, vt_handler, session); if (!session->vt_source) { goto error; diff --git a/backend/session/direct.c b/backend/session/direct.c index 942dc552..9d6cd36d 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -184,8 +184,8 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display struct vt_mode mode = { .mode = VT_PROCESS, - .relsig = SIGUSR1, - .acqsig = SIGUSR1, + .relsig = SIGUSR2, + .acqsig = SIGUSR2, }; if (ioctl(fd, VT_SETMODE, &mode) < 0) { @@ -194,7 +194,7 @@ static bool setup_tty(struct direct_session *session, struct wl_display *display } struct wl_event_loop *loop = wl_display_get_event_loop(display); - session->vt_source = wl_event_loop_add_signal(loop, SIGUSR1, + session->vt_source = wl_event_loop_add_signal(loop, SIGUSR2, vt_handler, session); if (!session->vt_source) { goto error; -- cgit v1.2.3 From a8d8a63fe0b437a6a4d37fd03a0e8b4e178e22c7 Mon Sep 17 00:00:00 2001 From: n3rdopolis Date: Sat, 2 Dec 2017 10:50:00 -0500 Subject: Attempt to fix #454 With logind, only seat0 can use TTYs --- backend/session/logind.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'backend/session') diff --git a/backend/session/logind.c b/backend/session/logind.c index daff75b6..e42b85f8 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -347,19 +347,22 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { goto error; } - ret = sd_session_get_vt(session->id, &session->base.vtnr); - if (ret < 0) { - wlr_log(L_ERROR, "Session not running in virtual terminal"); - goto error; - } - char *seat; ret = sd_session_get_seat(session->id, &seat); if (ret < 0) { wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); goto error; } + snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); + if (seat == "seat0") + { + ret = sd_session_get_vt(session->id, &session->base.vtnr); + if (ret < 0) { + wlr_log(L_ERROR, "Session not running in virtual terminal"); + goto error; + } + } free(seat); ret = sd_bus_default_system(&session->bus); -- cgit v1.2.3 From 8a2d54c24ab157c8acc669f6aa5af365abc71a70 Mon Sep 17 00:00:00 2001 From: n3rdopolis Date: Sat, 2 Dec 2017 12:37:28 -0500 Subject: Fix style and string comparison --- backend/session/logind.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'backend/session') diff --git a/backend/session/logind.c b/backend/session/logind.c index e42b85f8..e9d4c8f3 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -353,10 +353,9 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); goto error; } - snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); - if (seat == "seat0") - { + + if (strcmp(seat, "seat0") == 0) { ret = sd_session_get_vt(session->id, &session->base.vtnr); if (ret < 0) { wlr_log(L_ERROR, "Session not running in virtual terminal"); -- cgit v1.2.3