Ver código fonte

Only prints one warning now instead of two when a compositor is missing

naelstrof 7 anos atrás
pai
commit
2a00b1f125
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8
    2
      src/slop.cpp

+ 8
- 2
src/slop.cpp Ver arquivo

@@ -43,6 +43,7 @@ SlopSelection SlopSelect( SlopOptions* options, bool* cancelled ) {
43 43
     x11 = new X11(options->xdisplay);
44 44
     keyboard = new Keyboard( x11 );
45 45
     bool success = false;
46
+    std::string errorstring = "";
46 47
     SlopWindow* window;
47 48
     // First we check if we have a compositor available
48 49
 	if ( x11->hasCompositor() ) {
@@ -54,11 +55,16 @@ SlopSelection SlopSelect( SlopOptions* options, bool* cancelled ) {
54 55
             success = false;
55 56
         }
56 57
     } else {
57
-        std::cerr << "Failed to detect a compositor, OpenGL hardware-accelleration disabled...\n";
58
+        errorstring += "Failed to detect a compositor, OpenGL hardware-accelleration disabled...\n";
58 59
     }
59 60
     if ( !success ) {
60 61
         // If we fail, we launch the XShape version of slop.
61
-        std::cerr << "Failed to launch OpenGL context, --shader parameter will be ignored.\n";
62
+        if ( errorstring.length() <= 0 ) {
63
+            errorstring += "Failed to launch OpenGL context, --shader parameter will be ignored.\n";
64
+            std::cerr << errorstring;
65
+        } else {
66
+            std::cerr << errorstring;
67
+        }
62 68
         returnval = XShapeSlopSelect( options, cancelled );
63 69
     } else {
64 70
         returnval = GLSlopSelect( options, cancelled, window );