Browse Source

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

naelstrof 7 years ago
parent
commit
2a00b1f125
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      src/slop.cpp

+ 8
- 2
src/slop.cpp View File

43
     x11 = new X11(options->xdisplay);
43
     x11 = new X11(options->xdisplay);
44
     keyboard = new Keyboard( x11 );
44
     keyboard = new Keyboard( x11 );
45
     bool success = false;
45
     bool success = false;
46
+    std::string errorstring = "";
46
     SlopWindow* window;
47
     SlopWindow* window;
47
     // First we check if we have a compositor available
48
     // First we check if we have a compositor available
48
 	if ( x11->hasCompositor() ) {
49
 	if ( x11->hasCompositor() ) {
54
             success = false;
55
             success = false;
55
         }
56
         }
56
     } else {
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
     if ( !success ) {
60
     if ( !success ) {
60
         // If we fail, we launch the XShape version of slop.
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
         returnval = XShapeSlopSelect( options, cancelled );
68
         returnval = XShapeSlopSelect( options, cancelled );
63
     } else {
69
     } else {
64
         returnval = GLSlopSelect( options, cancelled, window );
70
         returnval = GLSlopSelect( options, cancelled, window );