Bug fix: make -X,--display actually work, improve error message if display not found
authorCesare Tirabassi <norsetto@ubuntu.com>
Sat, 1 Aug 2009 07:34:21 +0000 (09:34 +0200)
committerCesare Tirabassi <norsetto@ubuntu.com>
Sat, 1 Aug 2009 07:34:21 +0000 (09:34 +0200)
src/conky.c
src/x11.c

index 0b8d644..8b0763d 100644 (file)
@@ -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 '?':
index 286e070..5d325cd 100644 (file)
--- 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));
                }
        }