From fca603cc3577770709603b9d06ba414c06a87b23 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 1 Oct 2014 16:37:13 +0000 Subject: =?UTF-8?q?Protect=20use=20of=20dlopen()=20and=20dlsym()=20with=20?= =?UTF-8?q?HAVE=5FDLSYM=20and=20HAVE=5FDLFCN=5FH=20for=20compatibility=20w?= =?UTF-8?q?ith=20cases=20where=20these=20functions=20aren=E2=80=99t=20avai?= =?UTF-8?q?lable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10348 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Window_shape.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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 // needed for VisualC2010 #elif !defined(__APPLE__) +#include +#if HAVE_DLFCN_H #include +#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(); -- cgit v1.2.3