]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Allow VNC command to be specified in lightdm.conf
authorRobert Ancell <robert.ancell@canonical.com>
Fri, 12 Apr 2013 03:16:00 +0000 (15:16 +1200)
committerRobert Ancell <robert.ancell@canonical.com>
Fri, 12 Apr 2013 03:16:00 +0000 (15:16 +1200)
NEWS
data/lightdm.conf
src/seat-xvnc.c
src/xserver-xvnc.c
src/xserver-xvnc.h
tests/scripts/vnc-command.conf [new file with mode: 0644]
tests/test-vnc-command [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index a5159302659011a0a2b7337720f5f0f1ede092a9..baa92dd3ce070ba8b06e5e8ae387a56557b41e20 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Overview of changes in lightdm 1.5.4
+
+    * Allow VNC command to be specified in lightdm.conf
+
 Overview of changes in lightdm 1.5.3
 
     * Fix build with gobject-introspection 1.35.9
index 0e4c318948eac801563df9353a391cd14639bcf4..02b867d5bcc6508b6e75725e57b7cf2c05aecea6 100644 (file)
 # VNC Server configuration
 #
 # enabled = True if VNC connections should be allowed
+# command = Command to run Xvnc server with
 # port = TCP/IP port to listen for connections on
+# width = Width of display to use
+# height = Height of display to use
+# depth = Color depth of display to use
 #
 [VNCServer]
 #enabled=false
+#command=Xvnc
 #port=5900
 #width=1024
 #height=768
index df654cd9e86779220bdf929c470617d86a402b0f..8b936537bb08566f0a5474b967e07b45bba41ee4 100644 (file)
@@ -36,10 +36,15 @@ static DisplayServer *
 seat_xvnc_create_display_server (Seat *seat)
 {
     XServerXVNC *xserver;
+    const gchar *command = NULL;
 
     xserver = xserver_xvnc_new ();
     xserver_xvnc_set_socket (xserver, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
 
+    command = config_get_string (config_get_instance (), "VNCServer", "xserver-command");
+    if (command)
+        xserver_xvnc_set_command (xserver, command);
+
     if (config_has_key (config_get_instance (), "VNCServer", "width") &&
         config_has_key (config_get_instance (), "VNCServer", "height"))
     {
index b28c1cbf4b0000b4092dcc2fb6519f6b4a212fc7..29512d1bb2024feda1941aa57de0ba326581e7d5 100644 (file)
@@ -28,7 +28,10 @@ struct XServerXVNCPrivate
     Process *xserver_process;
   
     /* File to log to */
-    gchar *log_file;  
+    gchar *log_file;
+
+    /* Command to run the X server */
+    gchar *command;
 
     /* Authority file */
     gchar *authority_file;
@@ -60,6 +63,14 @@ xserver_xvnc_new (void)
     return self;
 }
 
+void
+xserver_xvnc_set_command (XServerXVNC *server, const gchar *command)
+{
+    g_return_if_fail (server != NULL);
+    g_free (server->priv->command);
+    server->priv->command = g_strdup (command);
+}
+
 void
 xserver_xvnc_set_socket (XServerXVNC *server, int fd)
 {
@@ -206,10 +217,10 @@ xserver_xvnc_start (DisplayServer *display_server)
     g_free (filename);
     g_free (dir);
 
-    absolute_command = get_absolute_command ("Xvnc");
+    absolute_command = get_absolute_command (server->priv->command);
     if (!absolute_command)
     {
-        g_debug ("Can't launch Xvnc, not found in path");
+        g_debug ("Can't launch X server %s, not found in path", server->priv->command);
         stopped_cb (server->priv->xserver_process, XSERVER_XVNC (server));
         return FALSE;
     }
@@ -279,6 +290,7 @@ static void
 xserver_xvnc_init (XServerXVNC *server)
 {
     server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, XSERVER_XVNC_TYPE, XServerXVNCPrivate);
+    server->priv->command = g_strdup ("Xvnc");
     server->priv->width = 1024;
     server->priv->height = 768;
     server->priv->depth = 8;
@@ -293,6 +305,7 @@ xserver_xvnc_finalize (GObject *object)
 
     if (self->priv->xserver_process)
         g_object_unref (self->priv->xserver_process);
+    g_free (self->priv->command);
     g_free (self->priv->authority_file);
     g_free (self->priv->log_file);
 
index 48454f495e05b64c39180e7c8a92b754039278bb..407f3a12b4cc354631bae279d65bcd398c8de2d0 100644 (file)
@@ -41,6 +41,8 @@ gboolean xserver_xvnc_check_available (void);
 
 XServerXVNC *xserver_xvnc_new (void);
 
+void xserver_xvnc_set_command (XServerXVNC *server, const gchar *command);
+
 void xserver_xvnc_set_socket (XServerXVNC *server, int fd);
 
 int xserver_xvnc_get_socket (XServerXVNC *server);
diff --git a/tests/scripts/vnc-command.conf b/tests/scripts/vnc-command.conf
new file mode 100644 (file)
index 0000000..6d07360
--- /dev/null
@@ -0,0 +1,28 @@
+#
+# Check that LightDM correctly negotiates VNC and starts the session to the remote server.
+#
+
+[LightDM]
+minimum-display-number=50
+start-default-seat=false
+
+[VNCServer]
+enabled=true
+port=9999
+command=Xvnc -depth 16
+
+#?RUNNER DAEMON-START
+#?*WAIT 1
+
+# Start a VNC client
+#?*START-VNC-CLIENT ARGS="::9999"
+#?VNC-CLIENT START
+#?VNC-CLIENT CONNECT SERVER=::9999
+
+# Xvnc server starts
+#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=16
+
+# Clean up
+#?*STOP-DAEMON
+#?XSERVER :50 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/test-vnc-command b/tests/test-vnc-command
new file mode 100755 (executable)
index 0000000..bcdc981
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner vnc-login test-gobject-greeter