Browse Source

Added error message when the XShape extension isn't supported.

Dalton Nell 10 years ago
parent
commit
09d2eb9de8
3 changed files with 13 additions and 0 deletions
  1. 5
    0
      src/main.cpp
  2. 6
    0
      src/rectangle.cpp
  3. 2
    0
      src/rectangle.hpp

+ 5
- 0
src/main.cpp View File

@@ -186,6 +186,11 @@ int app( int argc, char** argv ) {
186 186
     if ( err != EXIT_SUCCESS ) {
187 187
         return EXIT_FAILURE;
188 188
     }
189
+    if ( !slop::isRectangleSupported() ) {
190
+        fprintf( stderr, "Error: Your X server doesn't support the XShape extension. There's nothing slop can do about this!\n" );
191
+        fprintf( stderr, "  Try updating X and making sure you have XExtensions installed. (/usr/lib/libXext.so, /usr/include/X11/extensions/shape.h)\n" );
192
+        return EXIT_FAILURE;
193
+    }
189 194
     int state = 0;
190 195
     bool running = true;
191 196
     slop::Rectangle* selection = NULL;

+ 6
- 0
src/rectangle.cpp View File

@@ -187,3 +187,9 @@ XColor slop::Rectangle::convertColor( float r, float g, float b ) {
187 187
     }
188 188
     return color;
189 189
 }
190
+
191
+bool slop::isRectangleSupported() {
192
+    int event_base;
193
+    int error_base;
194
+    return XShapeQueryExtension( xengine->m_display, &event_base, &error_base );
195
+}

+ 2
- 0
src/rectangle.hpp View File

@@ -57,6 +57,8 @@ private:
57 57
     void    constrain( int w, int h );
58 58
 };
59 59
 
60
+bool isRectangleSupported();
61
+
60 62
 }
61 63
 
62 64
 #endif // IS_RECTANGLE_H_