Adding vtX to $defaultserverargs means that it will only be added when
the user specifies no server arguments.

This means that doing ie: "startx -- -depth 16" will cause the server to start
on a different vt then just "startx", which does not meat the principle of
least surprise.

Instead always pass the vtX argument, except when the user has specified its
own vtX argument. Note that vtX still only gets added for the default server,
since for ie Xnest or Xephyr it makes no sense.

Signed-off-by: Hans de Goede <[email protected]>
---
 startx.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/startx.cpp b/startx.cpp
index f4a0283..5dafce7 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -59,6 +59,7 @@ defaultserverargs=""
 defaultdisplay=":0"
 clientargs=""
 serverargs=""
+vtarg=""
 
 #ifdef __APPLE__
 
@@ -194,7 +195,7 @@ if [ x"$server" = x ]; then
     tty=$(tty)
     if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then
         tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
-        defaultserverargs=${defaultserverargs}" vt"${tty_num}
+        vtarg="vt$tty_num"
     fi
 #endif
 
@@ -213,6 +214,17 @@ if [ x"$serverargs" = x ]; then
     serverargs=$defaultserverargs
 fi
 
+XCOMM if no vt is specified add vtarg (which may be empty)
+have_vtarg="no"
+for i in $serverargs; do
+    if expr match "$i" '^vt[0-9]\+$' > /dev/null; then
+        have_vtarg="yes"
+    fi
+done
+if [ "$have_vtarg" = "no" ]; then
+    serverargs="$serverargs $vtarg"
+fi
+
 XCOMM if no display, use default
 if [ x"$display" = x ]; then
     display=$defaultdisplay
-- 
1.9.0

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to