Skip to content

Commit

Permalink
improve variable names, move hasDisplayNameChanged reset
Browse files Browse the repository at this point in the history
  • Loading branch information
jub3i authored and illegalprime committed Jun 1, 2016
1 parent cdbf8df commit 0e457ba
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/xdisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

static Display *mainDisplay = NULL;
static int registered = 0;
static char *display_name = ":0.0";
static int display_name_changed = 0;
static char *displayName = ":0.0";
static int hasDisplayNameChanged = 0;

Display *XGetMainDisplay(void)
{
/* Close the display if display_name has changed */
if (display_name_changed) {
/* Close the display if displayName has changed */
if (hasDisplayNameChanged) {
XCloseMainDisplay();
hasDisplayNameChanged = 0;
}
display_name_changed = 0;

if (mainDisplay == NULL) {
/* First try the user set display_name */
mainDisplay = XOpenDisplay(display_name);
/* First try the user set displayName */
mainDisplay = XOpenDisplay(displayName);

/* Then try using environment variable DISPLAY */
if (mainDisplay == NULL) {
Expand Down Expand Up @@ -45,10 +45,10 @@ void XCloseMainDisplay(void)

char *getXDisplay(void)
{
return display_name;
return displayName;
}

void setXDisplay(char *name) {
display_name = name;
display_name_changed = 1;
displayName = name;
hasDisplayNameChanged = 1;
}

0 comments on commit 0e457ba

Please sign in to comment.