Explorar el Código

Merge pull request #58 from fkmclane/display

use DISPLAY environment variable by default instead of :0
Dalton Nell hace 7 años
padre
commit
ba73ec850d
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8
    1
      src/slop.cpp

+ 8
- 1
src/slop.cpp Ver fichero

@@ -1,6 +1,8 @@
1 1
 #include <chrono>
2 2
 #include <thread>
3 3
 
4
+#include <stdlib.h>
5
+
4 6
 #include "slopstates.hpp"
5 7
 #include "mouse.hpp"
6 8
 #include "resource.hpp"
@@ -36,11 +38,16 @@ slop::SlopOptions::SlopOptions() {
36 38
     padding = 0;
37 39
     shader = "textured";
38 40
     highlight = false;
39
-    xdisplay = ":0";
40 41
     r = 0.5;
41 42
     g = 0.5;
42 43
     b = 0.5;
43 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 53
 slop::SlopSelection::SlopSelection( float x, float y, float w, float h, int id ) {