Selaa lähdekoodia

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

Dalton Nell 9 vuotta sitten
vanhempi
commit
09d2eb9de8
3 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  1. 5
    0
      src/main.cpp
  2. 6
    0
      src/rectangle.cpp
  3. 2
    0
      src/rectangle.hpp

+ 5
- 0
src/main.cpp Näytä tiedosto

186
     if ( err != EXIT_SUCCESS ) {
186
     if ( err != EXIT_SUCCESS ) {
187
         return EXIT_FAILURE;
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
     int state = 0;
194
     int state = 0;
190
     bool running = true;
195
     bool running = true;
191
     slop::Rectangle* selection = NULL;
196
     slop::Rectangle* selection = NULL;

+ 6
- 0
src/rectangle.cpp Näytä tiedosto

187
     }
187
     }
188
     return color;
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 Näytä tiedosto

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