nanogui: X11 drivers for Microwindows
Subject:
Re: X11 drivers for Microwindows
From:
Daniel R Risacher ####@####.####
Date:
1 Dec 1999 12:17:56 -0000
Message-Id: <m2bt8ax3oj.fsf@alum.mit.edu>
Actually, I suspect that this code can be simplified even further.
According to the man page for XOpenDisplay(), :
On a POSIX-conformant system, if the display_name is NULL, it defaults
to the value of the DISPLAY environment variable.
I believe the dependence on POSIX-ness is required for the getenv()
call to work. Since we need this anyway, I propose the following patch:
--- scr_x11.c.old Wed Dec 1 06:03:13 1999
+++ scr_x11.c Wed Dec 1 06:05:48 1999
@@ -298,16 +298,9 @@
static int setup_needed = 1;
if (setup_needed) {
- char* name;
int i;
- if ((name = (char*) getenv("DISPLAY")) == NULL)
- name = ":0";
- else if ((name = strchr(name, '=')) == NULL)
- name = ":0";
- else
- name++;
- if ((x11_dpy = XOpenDisplay(name)) == NULL)
+ if ((x11_dpy = XOpenDisplay(NULL)) == NULL)
return -1;
XSetErrorHandler(x11_error);