[PATCH v2 3/6] launcher-logind: only get a VT on seat0, as only seat0 supports VTs
Dima Ryazanov
dima at gmail.com
Sat Oct 7 06:41:56 UTC 2017
On Tue, Oct 3, 2017 at 7:28 PM, nerdopolis <bluescreen_avenger at verizon.net>
wrote:
> As only seat0 supports TTYs, this changes the logind launcher where
> it detects a TTY, only if the seat is seat0. This has only been
> tested for logind
> ---
> libweston/launcher-logind.c | 22 ++++++++++++----------
> libweston/launcher-util.c | 4 ++++
> 2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
> index a069bd4f..a94ec0e9 100644
> --- a/libweston/launcher-logind.c
> +++ b/libweston/launcher-logind.c
> @@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher
> **out, struct weston_compositor *
> free(t);
> goto err_session;
> }
> - free(t);
>
> - r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> - if (r < 0) {
> - weston_log("logind: session not running on a VT\n");
> - goto err_session;
> - } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> - weston_log("logind: requested VT --tty=%d differs from
> real session VT %u\n",
> - tty, wl->vtnr);
> - r = -EINVAL;
> - goto err_session;
> + if (!strcmp(t, "seat0")) {
> + r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> + if (r < 0) {
> + weston_log("logind: session not running on a
> VT\n");
> + goto err_session;
> + } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> + weston_log("logind: requested VT --tty=%d differs
> from real session VT %u\n",
> + tty, wl->vtnr);
> + r = -EINVAL;
> + goto err_session;
> + }
> }
> + free(t);
>
You will now need to free it before the two "goto err_session;" statements
above, too.
>
> loop = wl_display_get_event_loop(compositor->wl_display);
> r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus,
> &wl->dbus_ctx);
> diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
> index fa3ed13b..848c6ade 100644
> --- a/libweston/launcher-util.c
> +++ b/libweston/launcher-util.c
> @@ -111,6 +111,10 @@ WL_EXPORT void
> weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
> {
> uint32_t key;
> + struct weston_launcher *launcher = compositor->launcher;
> +
> + if (launcher->iface->get_vt(launcher) == 0)
> + return;
>
> if (compositor->vt_switching == false)
> return;
> --
> 2.14.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20171006/ef40cbda/attachment.html>
More information about the wayland-devel
mailing list