Parcourir la source

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

Dalton Nell il y a 9 ans
Parent
révision
09d2eb9de8
3 fichiers modifiés avec 13 ajouts et 0 suppressions
  1. 5
    0
      src/main.cpp
  2. 6
    0
      src/rectangle.cpp
  3. 2
    0
      src/rectangle.hpp

+ 5
- 0
src/main.cpp Voir le fichier

@@ -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 Voir le fichier

@@ -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 Voir le fichier

@@ -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_