Browse Source

use DISPLAY environment variable by default instead of :0

Foster McLane 7 years ago
parent
commit
548e887157
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      src/slop.cpp

+ 8
- 1
src/slop.cpp View File

1
 #include <chrono>
1
 #include <chrono>
2
 #include <thread>
2
 #include <thread>
3
 
3
 
4
+#include <stdlib.h>
5
+
4
 #include "slopstates.hpp"
6
 #include "slopstates.hpp"
5
 #include "mouse.hpp"
7
 #include "mouse.hpp"
6
 #include "resource.hpp"
8
 #include "resource.hpp"
36
     padding = 0;
38
     padding = 0;
37
     shader = "textured";
39
     shader = "textured";
38
     highlight = false;
40
     highlight = false;
39
-    xdisplay = ":0";
40
     r = 0.5;
41
     r = 0.5;
41
     g = 0.5;
42
     g = 0.5;
42
     b = 0.5;
43
     b = 0.5;
43
     a = 1;
44
     a = 1;
45
+
46
+    char * envdisplay = getenv("DISPLAY");
47
+    if (envdisplay == NULL)
48
+        xdisplay = ":0";
49
+    else
50
+        xdisplay = envdisplay;
44
 }
51
 }
45
 
52
 
46
 slop::SlopSelection::SlopSelection( float x, float y, float w, float h, int id ) {
53
 slop::SlopSelection::SlopSelection( float x, float y, float w, float h, int id ) {