From 01e66c7f8c9e3ec7bc4c38a53444825ffb5d92e9 Mon Sep 17 00:00:00 2001 From: Cesare Tirabassi Date: Sat, 1 Aug 2009 09:34:21 +0200 Subject: [PATCH] Bug fix: make -X,--display actually work, improve error message if display not found --- src/conky.c | 10 +++++----- src/x11.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conky.c b/src/conky.c index 0b8d6441..8b0763dc 100644 --- a/src/conky.c +++ b/src/conky.c @@ -9257,11 +9257,6 @@ void initialisation(int argc, char **argv) { case 'a': text_alignment = string_to_alignment(optarg); break; - case 'X': - if (disp) - free(disp); - disp = strdup(optarg); - break; #ifdef OWN_WINDOW case 'o': @@ -9459,6 +9454,11 @@ int main(int argc, char **argv) case 'w': window.window = strtol(optarg, 0, 0); break; + case 'X': + if (disp) + free(disp); + disp = strdup(optarg); + break; #endif /* X11 */ case '?': diff --git a/src/x11.c b/src/x11.c index 286e0707..5d325cd4 100644 --- a/src/x11.c +++ b/src/x11.c @@ -76,7 +76,7 @@ void init_X11(const char *disp) { if (!display) { if ((display = XOpenDisplay(disp)) == NULL) { - CRIT_ERR(NULL, NULL, "can't open display: %s", XDisplayName(0)); + CRIT_ERR(NULL, NULL, "can't open display: %s", XDisplayName(disp)); } }