summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-03-11 14:34:32 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-03-11 14:34:32 +0000
commit0264f4f6e358e3c6d988e425f6586750749085c1 (patch)
tree0e0edd22dc9a20d3ad24cb61ef513eba94c7a519
parentf93c38fd889ba3a345daf41a5c8b472433e007b9 (diff)
Handle -displayfd and an explicit display number sensiblycygwin-release-1.13
Handle -displayfd and an explicit display number sensibly, e.g. use the explicitly specified display number, and write it to the displayfd
-rw-r--r--dix/globals.c1
-rw-r--r--include/opaque.h1
-rw-r--r--os/connection.c9
-rw-r--r--os/utils.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/dix/globals.c b/dix/globals.c
index 332b91f5c..82d0e5977 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -129,6 +129,7 @@ int monitorResolution = 0;
char *display;
int displayfd;
+Bool explicit_display = FALSE;
char *ConnectionInfo;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
diff --git a/include/opaque.h b/include/opaque.h
index b76ab6e6b..5b73a24c7 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -51,6 +51,7 @@ extern _X_EXPORT int defaultScreenSaverBlanking;
extern _X_EXPORT int defaultScreenSaverAllowExposures;
extern _X_EXPORT char *display;
extern _X_EXPORT int displayfd;
+extern _X_EXPORT Bool explicit_display;
extern _X_EXPORT int defaultBackingStore;
extern _X_EXPORT Bool disableBackingStore;
diff --git a/os/connection.c b/os/connection.c
index 669c25566..5ea3b8e0d 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -366,8 +366,8 @@ void
NotifyParentProcess(void)
{
#if !defined(WIN32)
- if (dynamic_display[0]) {
- write(displayfd, dynamic_display, strlen(dynamic_display));
+ if (displayfd) {
+ write(displayfd, display, strlen(display));
write(displayfd, "\n", 1);
close(displayfd);
}
@@ -419,9 +419,8 @@ CreateWellKnownSockets(void)
FD_ZERO(&WellKnownConnections);
/* display is initialized to "0" by main(). It is then set to the display
- * number if specified on the command line, or to NULL when the -displayfd
- * option is used. */
- if (display) {
+ * number if specified on the command line. */
+ if ((displayfd == 0) || explicit_display) {
if (TryCreateSocket(atoi(display), &partial) &&
ListenTransCount >= 1)
if (!PartialNetwork && partial)
diff --git a/os/utils.c b/os/utils.c
index 19e266836..d4277f6fa 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -596,6 +596,7 @@ ProcessCommandLine(int argc, char *argv[])
else if (argv[i][0] == ':') {
/* initialize display */
display = argv[i];
+ explicit_display = TRUE;
display++;
if (!VerifyDisplayName(display)) {
ErrorF("Bad display name: %s\n", display);
@@ -666,7 +667,6 @@ ProcessCommandLine(int argc, char *argv[])
else if (strcmp(argv[i], "-displayfd") == 0) {
if (++i < argc) {
displayfd = atoi(argv[i]);
- display = NULL;
nolock = TRUE;
}
else