diff options
| author | Manolo Gouy <Manolo> | 2014-10-01 16:37:13 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2014-10-01 16:37:13 +0000 |
| commit | fca603cc3577770709603b9d06ba414c06a87b23 (patch) | |
| tree | 6f3e61f628d72041f931921ec81fe0ca174e2b09 | |
| parent | bbefe857db0d516fa5e7bc3e45d9b0f46cf17fe0 (diff) | |
Protect use of dlopen() and dlsym() with HAVE_DLSYM and HAVE_DLFCN_H for compatibility with cases where these functions aren’t available.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10348 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_Window_shape.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Fl_Window_shape.cxx b/src/Fl_Window_shape.cxx index 9382575dc..e428934db 100644 --- a/src/Fl_Window_shape.cxx +++ b/src/Fl_Window_shape.cxx @@ -27,7 +27,10 @@ #ifdef WIN32 # include <malloc.h> // needed for VisualC2010 #elif !defined(__APPLE__) +#include <config.h> +#if HAVE_DLFCN_H #include <dlfcn.h> +#endif #define ShapeBounding 0 #define ShapeSet 0 #endif @@ -136,16 +139,18 @@ void Fl_Window::combine_mask() static XShapeCombineMask_type XShapeCombineMask_f = NULL; static int beenhere = 0; typedef Bool (*XShapeQueryExtension_type)(Display*, int*, int*); - int error_base, shapeEventBase; if (!beenhere) { beenhere = 1; +#if HAVE_DLSYM && HAVE_DLFCN_H fl_open_display(); void *handle = dlopen(NULL, RTLD_LAZY); // search symbols in executable XShapeQueryExtension_type XShapeQueryExtension_f = (XShapeQueryExtension_type)dlsym(handle, "XShapeQueryExtension"); XShapeCombineMask_f = (XShapeCombineMask_type)dlsym(handle, "XShapeCombineMask"); // make sure that the X server has the SHAPE extension - if ( !( XShapeQueryExtension_f && XShapeCombineMask_f && + int error_base, shapeEventBase; + if ( !( XShapeQueryExtension_f && XShapeCombineMask_f && XShapeQueryExtension_f(fl_display, &shapeEventBase, &error_base) ) ) XShapeCombineMask_f = NULL; +#endif } if (!XShapeCombineMask_f) return; shape_data_->lw_ = w(); |
