fix support for dynamic loading of X11 functions, after adding XRaiseWindow

./premake4_linux64 --force_dlopen_x11 gmake
This commit is contained in:
Erwin Coumans
2014-08-31 12:51:11 -07:00
parent ec3650acc4
commit da8abf443e

View File

@@ -64,6 +64,7 @@ static bool forceOpenGL3 = true;
#ifdef DYNAMIC_LOAD_X11_FUNCTIONS #ifdef DYNAMIC_LOAD_X11_FUNCTIONS
///our X11 function typedefs ///our X11 function typedefs
typedef int (*PFNXFREE)(void*); typedef int (*PFNXFREE)(void*);
typedef XErrorHandler (* PFNXSETERRORHANDLER) (XErrorHandler); typedef XErrorHandler (* PFNXSETERRORHANDLER) (XErrorHandler);
typedef int (* PFNXSYNC) (Display* a,Bool b); typedef int (* PFNXSYNC) (Display* a,Bool b);
@@ -74,6 +75,8 @@ typedef int (*PFNXMAPWINDOW) (Display*, Window);
typedef int (*PFNXSTORENAME) (Display* a,Window b,_Xconst char* c); typedef int (*PFNXSTORENAME) (Display* a,Window b,_Xconst char* c);
typedef int (*PFNXCLOSEDISPLAY) (Display* a); typedef int (*PFNXCLOSEDISPLAY) (Display* a);
typedef int (*PFNXDESTROYWINDOW) (Display* a,Window b); typedef int (*PFNXDESTROYWINDOW) (Display* a,Window b);
typedef int (*PFNXRAISEWINDOW) (Display* a, Window b);
#if NeedWidePrototypes #if NeedWidePrototypes
typedef KeySym* (*PFNXGETKEYBOARDMAPPING) (Display*,unsigned int,int,int*); typedef KeySym* (*PFNXGETKEYBOARDMAPPING) (Display*,unsigned int,int,int*);
typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,unsigned int b,int c); typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,unsigned int b,int c);
@@ -100,6 +103,7 @@ typedef Status (*PFNXGETWINDOWATTRIBUTES) (Display* a,Window b,XWindowAttributes
#define MyXMapWindow m_data->m_x11_XMapWindow #define MyXMapWindow m_data->m_x11_XMapWindow
#define MyXStoreName m_data->m_x11_XStoreName #define MyXStoreName m_data->m_x11_XStoreName
#define MyXDestroyWindow m_data->m_x11_XDestroyWindow #define MyXDestroyWindow m_data->m_x11_XDestroyWindow
#define MyXRaiseWindow m_data->m_x11_XRaiseWindow
#define MyXCloseDisplay m_data->m_x11_XCloseDisplay #define MyXCloseDisplay m_data->m_x11_XCloseDisplay
#define MyXKeycodeToKeysym m_data->m_x11_XKeycodeToKeysym #define MyXKeycodeToKeysym m_data->m_x11_XKeycodeToKeysym
#define MyXConvertCase m_data->m_x11_XConvertCase #define MyXConvertCase m_data->m_x11_XConvertCase
@@ -125,6 +129,7 @@ typedef Status (*PFNXGETWINDOWATTRIBUTES) (Display* a,Window b,XWindowAttributes
#define MyXMapWindow XMapWindow #define MyXMapWindow XMapWindow
#define MyXStoreName XStoreName #define MyXStoreName XStoreName
#define MyXDestroyWindow XDestroyWindow #define MyXDestroyWindow XDestroyWindow
#define MyXRaiseWindow XRaiseWindow
#define MyXCloseDisplay XCloseDisplay #define MyXCloseDisplay XCloseDisplay
#define MyXKeycodeToKeysym XKeycodeToKeysym #define MyXKeycodeToKeysym XKeycodeToKeysym
#define MyXConvertCase XConvertCase #define MyXConvertCase XConvertCase
@@ -167,6 +172,7 @@ struct InternalData2
PFNXSTORENAME m_x11_XStoreName; PFNXSTORENAME m_x11_XStoreName;
PFNXCLOSEDISPLAY m_x11_XCloseDisplay; PFNXCLOSEDISPLAY m_x11_XCloseDisplay;
PFNXDESTROYWINDOW m_x11_XDestroyWindow; PFNXDESTROYWINDOW m_x11_XDestroyWindow;
PFNXRAISEWINDOW m_x11_XRaiseWindow;
PFNXKEYCODETOKEYSYM m_x11_XKeycodeToKeysym; PFNXKEYCODETOKEYSYM m_x11_XKeycodeToKeysym;
PFNXGETKEYBOARDMAPPING m_x11_XGetKeyboardMapping; PFNXGETKEYBOARDMAPPING m_x11_XGetKeyboardMapping;
PFNXCONVERTCASE m_x11_XConvertCase; PFNXCONVERTCASE m_x11_XConvertCase;
@@ -225,7 +231,10 @@ struct InternalData2
missingFunc = ((m_x11_XCloseDisplay = (PFNXCLOSEDISPLAY) dlsym(m_x11_library,"XCloseDisplay"))==NULL) | missingFunc; missingFunc = ((m_x11_XCloseDisplay = (PFNXCLOSEDISPLAY) dlsym(m_x11_library,"XCloseDisplay"))==NULL) | missingFunc;
if (missingFunc) { printf("Error: missing func XCloseDisplay in %s, exiting!\n", X11_LIBRARY); exit(0);} if (missingFunc) { printf("Error: missing func XCloseDisplay in %s, exiting!\n", X11_LIBRARY); exit(0);}
missingFunc = ((m_x11_XDestroyWindow = (PFNXDESTROYWINDOW) dlsym(m_x11_library,"XDestroyWindow"))==NULL) | missingFunc; missingFunc = ((m_x11_XDestroyWindow = (PFNXDESTROYWINDOW) dlsym(m_x11_library,"XDestroyWindow"))==NULL) | missingFunc;
if (missingFunc) { printf("Error: missing func XMapWindow in %s, exiting!\n", X11_LIBRARY); exit(0);} if (missingFunc) { printf("Error: missing func XDestroyWindow in %s, exiting!\n", X11_LIBRARY); exit(0);}
missingFunc = ((m_x11_XRaiseWindow = (PFNXRAISEWINDOW) dlsym(m_x11_library,"XRaiseWindow"))==NULL) | missingFunc;
if (missingFunc) { printf("Error: missing func XRaiseWindow in %s, exiting!\n", X11_LIBRARY); exit(0);}
missingFunc = ((m_x11_XGetKeyboardMapping = (PFNXGETKEYBOARDMAPPING) dlsym(m_x11_library,"XGetKeyboardMapping"))==NULL) | missingFunc; missingFunc = ((m_x11_XGetKeyboardMapping = (PFNXGETKEYBOARDMAPPING) dlsym(m_x11_library,"XGetKeyboardMapping"))==NULL) | missingFunc;
if (missingFunc) { printf("Error: missing func XGetKeyboardMapping in %s, exiting!\n", X11_LIBRARY); exit(0);} if (missingFunc) { printf("Error: missing func XGetKeyboardMapping in %s, exiting!\n", X11_LIBRARY); exit(0);}
missingFunc = ((m_x11_XKeycodeToKeysym = (PFNXKEYCODETOKEYSYM) dlsym(m_x11_library,"XKeycodeToKeysym"))==NULL) | missingFunc; missingFunc = ((m_x11_XKeycodeToKeysym = (PFNXKEYCODETOKEYSYM) dlsym(m_x11_library,"XKeycodeToKeysym"))==NULL) | missingFunc;
@@ -981,7 +990,7 @@ int X11OpenGLWindow::fileOpenDialog(char* filename, int maxNameLength)
{ {
printf("Error: fileOpenDialog no popen output, perhaps install zenity?\n"); printf("Error: fileOpenDialog no popen output, perhaps install zenity?\n");
} }
XRaiseWindow(m_data->m_dpy, m_data->m_win); MyXRaiseWindow(m_data->m_dpy, m_data->m_win);
return len; return len;
} }