Concentrate source code that supports Darwin + XQuartz + fink as test platform
This commit is contained in:
parent
ffcf8bd0b7
commit
2f64c6a861
@ -697,7 +697,7 @@ void fl_open_display(Display* d) {
|
||||
|
||||
#if USE_XRANDR
|
||||
void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY);
|
||||
if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY);
|
||||
if (!libxrandr_addr) libxrandr_addr = Fl::system_driver()->dlopen("libXrandr.so");
|
||||
if (libxrandr_addr) {
|
||||
int error_base;
|
||||
typedef Bool (*XRRQueryExtension_type)(Display*, int*, int*);
|
||||
|
@ -47,14 +47,43 @@
|
||||
#endif /* !S_ISDIR */
|
||||
|
||||
|
||||
static void* double_dlopen(const char *filename1)
|
||||
{
|
||||
void *ptr = ::dlopen(filename1, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!ptr) {
|
||||
char filename2[FL_PATH_MAX];
|
||||
sprintf(filename2, "%s.0", filename1);
|
||||
ptr = dlopen(filename2, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
void *Fl_Posix_System_Driver::dlopen(const char *filename)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
#if HAVE_DLSYM
|
||||
return ::dlopen(filename, RTLD_LAZY);
|
||||
#endif
|
||||
return NULL;
|
||||
ptr = double_dlopen(filename);
|
||||
# ifdef __APPLE_CC__ // allows testing on Darwin + XQuartz + fink
|
||||
if (!ptr) {
|
||||
char *f_dylib = strdup(filename);
|
||||
strcpy(strrchr(f_dylib, '.'), ".dylib");
|
||||
char path[FL_PATH_MAX];
|
||||
sprintf(path, "/sw/lib/%s", f_dylib);
|
||||
ptr = ::dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!ptr) {
|
||||
sprintf(path, "/opt/sw/lib/%s", f_dylib);
|
||||
ptr = ::dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
if (!ptr) {
|
||||
sprintf(path, "/opt/X11/lib/%s", f_dylib);
|
||||
ptr = ::dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
free(f_dylib);
|
||||
}
|
||||
# endif // __APPLE_CC__
|
||||
#endif // HAVE_DLSYM
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int Fl_Posix_System_Driver::file_type(const char *filename)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Fl_X11_Screen_Driver.H"
|
||||
#include "../Xlib/Fl_Font.H"
|
||||
#include "Fl_X11_Window_Driver.H"
|
||||
#include "../../src/Fl_System_Driver.H"
|
||||
#include "../Xlib/Fl_Xlib_Graphics_Driver.H"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/platform.H>
|
||||
@ -287,10 +288,7 @@ void Fl_X11_Screen_Driver::init() {
|
||||
static XRRSizes_type XRRSizes_f = NULL;
|
||||
if (!XRRSizes_f) {
|
||||
void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY);
|
||||
if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY);
|
||||
# ifdef __APPLE_CC__ // allows testing on Darwin + X11
|
||||
if (!libxrandr_addr) libxrandr_addr = dlopen("/opt/X11/lib/libXrandr.dylib", RTLD_LAZY);
|
||||
# endif
|
||||
if (!libxrandr_addr) libxrandr_addr = Fl::system_driver()->dlopen("libXrandr.so");
|
||||
if (libxrandr_addr) XRRSizes_f = (XRRSizes_type)dlsym(libxrandr_addr, "XRRSizes");
|
||||
}
|
||||
if (XRRSizes_f) {
|
||||
|
@ -520,13 +520,6 @@ int Fl_X11_System_Driver::utf8locale() {
|
||||
#if HAVE_DLSYM && HAVE_DLFCN_H
|
||||
#include <dlfcn.h> // for dlopen et al
|
||||
|
||||
static void* fl_dlopen(const char *filename1, const char *filename2)
|
||||
{
|
||||
void *ptr = dlopen(filename1, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!ptr) ptr = dlopen(filename2, RTLD_LAZY | RTLD_GLOBAL);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
bool Fl_X11_System_Driver::probe_for_GTK(int major, int minor, void **ptr_gtk) {
|
||||
typedef void (*init_t)(int*, void*);
|
||||
*ptr_gtk = NULL;
|
||||
@ -536,18 +529,14 @@ bool Fl_X11_System_Driver::probe_for_GTK(int major, int minor, void **ptr_gtk) {
|
||||
*ptr_gtk = RTLD_DEFAULT; // Caution: NULL under linux, not-NULL under Darwin
|
||||
} else {
|
||||
// Try first with GTK3
|
||||
*ptr_gtk = fl_dlopen("libgtk-3.so", "libgtk-3.so.0");
|
||||
*ptr_gtk = Fl::system_driver()->dlopen("libgtk3.0.so");
|
||||
if (*ptr_gtk) {
|
||||
#ifdef DEBUG
|
||||
puts("selected GTK-3\n");
|
||||
#endif
|
||||
} else {
|
||||
// Try then with GTK2
|
||||
# ifdef __APPLE_CC__ // allows testing on Darwin + X11
|
||||
*ptr_gtk = ::dlopen("/sw/lib/libgtk-x11-2.0.dylib", RTLD_LAZY | RTLD_GLOBAL);
|
||||
#else
|
||||
*ptr_gtk = fl_dlopen("libgtk-x11-2.0.so", "libgtk-x11-2.0.so.0");
|
||||
#endif
|
||||
*ptr_gtk = Fl::system_driver()->dlopen("libgtk-x11-2.0.so");
|
||||
}
|
||||
if (*ptr_gtk) {
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user