[PATCH v5 RESEND 01/10] ephyr: allow passing explictly host X server display number and/or authorization file path

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Mon Jul 20 04:14:47 PDT 2015


This patch introduces two command-line options for Xephyr:

  * -host-display: set Xephyr DISPLAY environment variable
                   to host X server display number
  * -host-auth:    set Xephyr XAUTHORITY environment variable
                   to host X server authorization file path

These options are particularly useful when Xephyr is launched
directly from display manager, because DISPLAY and/or XAUTHORITY
environment variables may not be set when it's launched.

Signed-off-by: Laércio de Sousa <laerciosousa at sme-mogidascruzes.sp.gov.br>
---
 hw/kdrive/ephyr/ephyrinit.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 8fbaf1d..0a42c96 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -141,6 +141,8 @@ ddxUseMsg(void)
     KdUseMsg();
 
     ErrorF("\nXephyr Option Usage:\n");
+    ErrorF("-host-display        host X server display number\n");
+    ErrorF("-host-auth           host X server authorization file path\n");
     ErrorF("-parent <XID>        Use existing window as Xephyr root win\n");
     ErrorF("-sw-cursor           Render cursors in software in Xephyr\n");
     ErrorF("-fullscreen          Attempt to run Xephyr fullscreen\n");
@@ -369,6 +371,24 @@ ddxProcessArgument(int argc, char **argv, int i)
         EphyrWantNoHostGrab = 1;
         return 2;
     }
+    else if (!strcmp(argv[i], "-host-display")) {
+        if (i + 1 < argc) {
+            setenv("DISPLAY", argv[i + 1], 1);
+            return 2;
+        }
+
+        UseMsg();
+        exit(1);
+    }
+    else if (!strcmp(argv[i], "-host-auth")) {
+        if (i + 1 < argc) {
+            setenv("XAUTHORITY", argv[i + 1], 1);
+            return 2;
+        }
+
+        UseMsg();
+        exit(1);
+    }
 
     return KdProcessArgument(argc, argv, i);
 }
-- 
2.3.6



More information about the xorg-devel mailing list