drm-lease: Disable weston TTY switch
[AGL/meta-agl-devel.git] / meta-agl-drm-lease / recipes-graphics / weston / weston / 0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch
1 From d086d6e3bc75331048f9f235c03408c68df40457 Mon Sep 17 00:00:00 2001
2 From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
3 Date: Wed, 3 Jun 2020 10:01:06 -0300
4 Subject: [PATCH 3/4] launcher: do not touch VT/tty while using non-default
5  seat
6
7 Launcher-direct does not allow us to run using a different
8 seat from the default seat0. This happens because VTs are
9 only exposed to the default seat, and users that are on
10 non-default seat should not touch VTs.
11
12 Add check in launcher-direct to skip VT/tty management if user
13 is running on a non-default seat.
14
15 Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
16 (cherry picked from commit 887a7e5717275c0dec007e6128298d5956c70891)
17 Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
18 ---
19  libweston/launcher-direct.c | 18 +++++++++++-------
20  1 file changed, 11 insertions(+), 7 deletions(-)
21
22 diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
23 index 8e21880..71c332a 100644
24 --- a/libweston/launcher-direct.c
25 +++ b/libweston/launcher-direct.c
26 @@ -303,9 +303,13 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
27         launcher->base.iface = &launcher_direct_iface;
28         launcher->compositor = compositor;
29  
30 -       if (setup_tty(launcher, tty) == -1) {
31 -               free(launcher);
32 -               return -1;
33 +       if (strcmp("seat0", seat_id) == 0) {
34 +               if (setup_tty(launcher, tty) == -1) {
35 +                       free(launcher);
36 +                       return -1;
37 +               }
38 +       } else {
39 +               launcher->tty = -1;
40         }
41  
42         * (struct launcher_direct **) out = launcher;
43 @@ -317,11 +321,11 @@ launcher_direct_destroy(struct weston_launcher *launcher_base)
44  {
45         struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base);
46  
47 -       launcher_direct_restore(&launcher->base);
48 -       wl_event_source_remove(launcher->vt_source);
49 -
50 -       if (launcher->tty >= 0)
51 +       if (launcher->tty >= 0) {
52 +               launcher_direct_restore(&launcher->base);
53 +               wl_event_source_remove(launcher->vt_source);
54                 close(launcher->tty);
55 +       }
56  
57         free(launcher);
58  }
59 -- 
60 2.17.1
61