[LightDM] [PATCH 1/2] Allow virtual terminal switching via xserver-allow-vt-switch=true

David Aguilar davvid at gmail.com
Sun May 24 02:50:03 PDT 2015


Teach lightdm about a new "xserver-allow-vt-switch"
configuration variable.  When set 'true', lightdm will inhibit
passing the hard-coded "-novtswitch" option to the X server.

This can also be helpful for X servers that do not understand
the "-novtswitch" option.

C.f. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=723874
C.f. https://bugs.launchpad.net/lightdm/+bug/852577
---
This patch can also be found here:
https://github.com/davvid/lightdm/commits/vtswitch

 data/lightdm.conf    |  2 ++
 src/seat-unity.c     |  4 ++++
 src/seat-xlocal.c    |  4 ++++
 src/x-server-local.c | 15 ++++++++++++++-
 src/x-server-local.h |  2 ++
 5 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/data/lightdm.conf b/data/lightdm.conf
index 2372a53..945847c 100644
--- a/data/lightdm.conf
+++ b/data/lightdm.conf
@@ -50,6 +50,7 @@
 # xserver-share = True if the X server is shared for both greeter and session
 # xserver-hostname = Hostname of X server (only for type=xremote)
 # xserver-display-number = Display number of X server (only for type=xremote)
+# xserver-allow-vt-switch = True if the X server should allow switching virtual terminals
 # xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
 # xdmcp-port = XDMCP UDP/IP port to communicate on
 # xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
@@ -92,6 +93,7 @@
 #xserver-share=true
 #xserver-hostname=
 #xserver-display-number=
+#xserver-allow-vt-switch=false
 #xdmcp-manager=
 #xdmcp-port=177
 #xdmcp-key=
diff --git a/src/seat-unity.c b/src/seat-unity.c
index 642be0a..1fc1379 100644
--- a/src/seat-unity.c
+++ b/src/seat-unity.c
@@ -197,6 +197,7 @@ create_x_server (Seat *seat)
     XServerLocal *x_server;
     const gchar *command = NULL, *layout = NULL, *config_file = NULL;
     gboolean allow_tcp;
+    gboolean allow_vt_switch;
     gchar *id;
 
     l_debug (seat, "Starting X server on Unity compositor");
@@ -228,6 +229,9 @@ create_x_server (Seat *seat)
     allow_tcp = seat_get_boolean_property (seat, "xserver-allow-tcp");
     x_server_local_set_allow_tcp (x_server, allow_tcp);
 
+    allow_vt_switch = seat_get_boolean_property (seat, "xserver-allow-vt-switch");
+    x_server_local_set_allow_vt_switch (x_server, allow_vt_switch);
+
     return x_server;
 }
 
diff --git a/src/seat-xlocal.c b/src/seat-xlocal.c
index 7b5ec7e..2ea6fad 100644
--- a/src/seat-xlocal.c
+++ b/src/seat-xlocal.c
@@ -171,6 +171,7 @@ create_x_server (Seat *seat)
     XServerLocal *x_server;
     const gchar *command = NULL, *layout = NULL, *config_file = NULL;
     gboolean allow_tcp;
+    gboolean allow_vt_switch;
     gint vt;
 
     x_server = x_server_local_new ();
@@ -207,6 +208,9 @@ create_x_server (Seat *seat)
     allow_tcp = seat_get_boolean_property (seat, "xserver-allow-tcp");
     x_server_local_set_allow_tcp (x_server, allow_tcp);
 
+    allow_vt_switch = seat_get_boolean_property (seat, "xserver-allow-vt-switch");
+    x_server_local_set_allow_vt_switch (x_server, allow_vt_switch);
+
     return x_server;
 }
 
diff --git a/src/x-server-local.c b/src/x-server-local.c
index 3260585..af53704 100644
--- a/src/x-server-local.c
+++ b/src/x-server-local.c
@@ -69,6 +69,7 @@ struct XServerLocalPrivate
 
     /* VT to run on */
     gint vt;
+    gboolean allow_vt_switch;
     gboolean have_vt_ref;
 
     /* Background to set */
@@ -233,6 +234,13 @@ x_server_local_set_allow_tcp (XServerLocal *server, gboolean allow_tcp)
 }
 
 void
+x_server_local_set_allow_vt_switch (XServerLocal *server, gboolean allow_vt_switch)
+{
+    g_return_if_fail (server != NULL);
+    server->priv->allow_vt_switch = allow_vt_switch;
+}
+
+void
 x_server_local_set_xdmcp_server (XServerLocal *server, const gchar *hostname)
 {
     g_return_if_fail (server != NULL);
@@ -500,7 +508,12 @@ x_server_local_start (DisplayServer *display_server)
         g_string_append (command, " -nolisten tcp");
 
     if (server->priv->vt >= 0)
-        g_string_append_printf (command, " vt%d -novtswitch", server->priv->vt);
+    {
+        if (server->priv->allow_vt_switch)
+            g_string_append_printf (command, " vt%d", server->priv->vt);
+        else
+            g_string_append_printf (command, " vt%d -novtswitch", server->priv->vt);
+    }
 
     if (server->priv->background)
         g_string_append_printf (command, " -background %s", server->priv->background);
diff --git a/src/x-server-local.h b/src/x-server-local.h
index 23c1d9a..05610b6 100644
--- a/src/x-server-local.h
+++ b/src/x-server-local.h
@@ -55,6 +55,8 @@ void x_server_local_set_sharevts (XServerLocal *server, gboolean sharevts);
 
 void x_server_local_set_allow_tcp (XServerLocal *server, gboolean allow_tcp);
 
+void x_server_local_set_allow_vt_switch (XServerLocal *server, gboolean allow_vt_switch);
+
 void x_server_local_set_xdmcp_server (XServerLocal *server, const gchar *hostname);
 
 const gchar *x_server_local_get_xdmcp_server (XServerLocal *server);
-- 
1.8.5.3



More information about the LightDM mailing list