Merge pull request #56 from aep/master

respect DISPLAY on linux
This commit is contained in:
Evans 2021-12-31 19:59:47 -04:00 committed by GitHub
commit b2702100cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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