瀏覽代碼

Merge pull request #58 from fkmclane/display

use DISPLAY environment variable by default instead of :0
Dalton Nell 7 年之前
父節點
當前提交
ba73ec850d
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8
    1
      src/slop.cpp

+ 8
- 1
src/slop.cpp 查看文件

@@ -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 ) {