diff options
author | ross <ross@b067294f-1dea-0310-9683-c47a78595994> | 2007-01-15 13:51:19 +0000 |
---|---|---|
committer | ross <ross@b067294f-1dea-0310-9683-c47a78595994> | 2007-01-15 13:51:19 +0000 |
commit | 32610bdc9a1f0be4961f4dde49749c57845e3d34 (patch) | |
tree | 624678d430a9a8ff8fd71d19a6014ece4a9cb50f | |
parent | 01526a8e76a62932d539273bcefeda15b43592bf (diff) |
2007-01-15 Ross Burton <ross@openedhand.com>
* src/main.c:
Use Xephyr by default, and attempt to find a spare display instead
of hard-coding :1.
git-svn-id: http://svn.o-hand.com/repos/matchbox/trunk/Xoo@1437 b067294f-1dea-0310-9683-c47a78595994
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/main.c | 19 |
2 files changed, 23 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2007-01-15 Ross Burton <ross@openedhand.com> + + * src/main.c: + Use Xephyr by default, and attempt to find a spare display instead + of hard-coding :1. + 2006-02-10 Ross Burton <ross@openedhand.com> * src/config.c: @@ -26,7 +26,7 @@ #include "callbacks.h" #include "prefs.h" -#define XNEST_BIN "/usr/X11R6/bin/Xnest" +#define XNEST_BIN "/usr/bin/Xephyr" /* Used by the signal handler to detect which child has died */ pid_t xnest_pid; @@ -36,13 +36,28 @@ static gboolean key_event (GtkWidget * widget, GdkEventKey * event, static void fakeapp_catch_sigchild (int sign); +static char * +find_spare_dpy (void) +{ + int i; + char buf[100]; + + for (i = 0; i < 256; i++) { + g_snprintf (buf, sizeof(buf), "/tmp/.X%d-lock", i); + if (access (buf, F_OK) != 0) { + return g_strdup_printf (":%i", i); + } + } + return NULL; +} + FakeApp * fakeapp_new (void) { GladeXML *glade; FakeApp *app = g_new0 (FakeApp, 1); - app->xnest_dpy_name = ":1"; + app->xnest_dpy_name = find_spare_dpy (); app->xnest_bin_path = XNEST_BIN; app->xnest_bin_options = strdup ("-ac"); /* freed if changed */ |