summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2011-10-18 14:07:12 +1100
committerRobert Ancell <robert.ancell@canonical.com>2011-10-18 14:07:12 +1100
commitd6c589d418ad379e83048bd34cc3422949a4f240 (patch)
treed1aba4ae8bed027895111434058ab0e01dec7bf7
parent1da6072954a470d4d9912040ec84c3e813be977d (diff)
downloadlightdm-d6c589d418ad379e83048bd34cc3422949a4f240.tar.gz
Set default resolution of VNC to 1024x768, add settings for width, height, depth into lightdm.conf
-rw-r--r--NEWS2
-rw-r--r--data/lightdm.conf3
-rw-r--r--src/xserver-xvnc.c43
-rw-r--r--src/xserver-xvnc.h4
4 files changed, 44 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 542db237..f0171558 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Overview of changes in lightdm 1.1.1
* Fix X sessions with arguments in Exec not working
* Use previous session for automatic login or if greeter does not request
one.
+ * Set default resolution of VNC to 1024x768, add settings for width, height,
+ depth into lightdm.conf.
Overview of changes in lightdm 1.1.0
diff --git a/data/lightdm.conf b/data/lightdm.conf
index f682a602..2dbff285 100644
--- a/data/lightdm.conf
+++ b/data/lightdm.conf
@@ -108,3 +108,6 @@
[VNCServer]
#enabled=false
#port=5900
+#width=1024
+#height=768
+#depth=8
diff --git a/src/xserver-xvnc.c b/src/xserver-xvnc.c
index b31b9297..9712f344 100644
--- a/src/xserver-xvnc.c
+++ b/src/xserver-xvnc.c
@@ -34,6 +34,9 @@ struct XServerXVNCPrivate
/* File descriptor to use for standard input */
gint stdin_fd;
+
+ /* Geometry and colour depth */
+ gint width, height, depth;
/* TRUE when received ready signal */
gboolean got_signal;
@@ -70,6 +73,21 @@ xserver_xvnc_get_stdin (XServerXVNC *server)
return server->priv->stdin_fd;
}
+void
+xserver_xvnc_set_geometry (XServerXVNC *server, gint width, gint height)
+{
+ g_return_if_fail (server != NULL);
+ server->priv->width = width;
+ server->priv->height = height;
+}
+
+void
+xserver_xvnc_set_depth (XServerXVNC *server, gint depth)
+{
+ g_return_if_fail (server != NULL);
+ server->priv->depth = depth;
+}
+
gchar *
xserver_xvnc_get_authority_file_path (XServerXVNC *server)
{
@@ -173,7 +191,8 @@ xserver_xvnc_start (DisplayServer *display_server)
XServerXVNC *server = XSERVER_XVNC (display_server);
XAuthority *authority;
gboolean result;
- gchar *filename, *run_dir, *dir, *path, *absolute_command, *command;
+ gchar *filename, *run_dir, *dir, *path, *absolute_command;
+ GString *command;
gchar hostname[1024], *number;
GError *error = NULL;
@@ -226,16 +245,21 @@ xserver_xvnc_start (DisplayServer *display_server)
if (error)
g_warning ("Failed to write authority: %s", error->message);
g_clear_error (&error);
-
- command = g_strdup_printf ("%s :%d -auth %s -inetd -nolisten tcp",
- absolute_command,
- xserver_get_display_number (XSERVER (server)),
- path);
+
+ command = g_string_new (absolute_command);
g_free (absolute_command);
+
+ g_string_append_printf (command, " :%d", xserver_get_display_number (XSERVER (server)));
+ g_string_append_printf (command, " -auth %s ", path);
g_free (path);
+ g_string_append (command, " -inetd -nolisten tcp");
+ if (server->priv->width > 0 && server->priv->height > 0)
+ g_string_append_printf (command, " -geometry %dx%d ", server->priv->width, server->priv->height);
+ if (server->priv->depth > 0)
+ g_string_append_printf (command, " -depth %d ", server->priv->depth);
- process_set_command (server->priv->xserver_process, command);
- g_free (command);
+ process_set_command (server->priv->xserver_process, command->str);
+ g_string_free (command, TRUE);
g_debug ("Launching Xvnc server");
@@ -260,6 +284,9 @@ static void
xserver_xvnc_init (XServerXVNC *server)
{
server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, XSERVER_XVNC_TYPE, XServerXVNCPrivate);
+ server->priv->width = 1024;
+ server->priv->height = 768;
+ server->priv->depth = 8;
}
static void
diff --git a/src/xserver-xvnc.h b/src/xserver-xvnc.h
index 461dcb3d..12cc5a59 100644
--- a/src/xserver-xvnc.h
+++ b/src/xserver-xvnc.h
@@ -45,6 +45,10 @@ void xserver_xvnc_set_stdin (XServerXVNC *server, int fd);
int xserver_xvnc_get_stdin (XServerXVNC *server);
+void xserver_xvnc_set_geometry (XServerXVNC *server, gint width, gint height);
+
+void xserver_xvnc_set_depth (XServerXVNC *server, gint depth);
+
gchar *xserver_xvnc_get_authority_file_path (XServerXVNC *server);
G_END_DECLS