respect DISPLAY on linux

Signed-off-by: Arvid E. Picciani <aep@exys.org>
This commit is contained in:
Arvid E. Picciani 2017-04-18 14:17:33 +02:00
parent fbaf36442c
commit 47245e8862

View File

@ -4,7 +4,7 @@
static Display *mainDisplay = NULL;
static int registered = 0;
static char *displayName = ":0.0";
static char *displayName = NULL;
static int hasDisplayNameChanged = 0;
Display *XGetMainDisplay(void)
@ -24,6 +24,11 @@ Display *XGetMainDisplay(void)
mainDisplay = XOpenDisplay(NULL);
}
/* Fall back to the most likely :0.0*/
if (mainDisplay == NULL) {
mainDisplay = XOpenDisplay(":0.0");
}
if (mainDisplay == NULL) {
fputs("Could not open main display\n", stderr);
} else if (!registered) {