X11: Make libX11 dynamically loaded

This completes the dynamic loading of all X11 libraries in preparation
for run-time platform selection.
This commit is contained in:
Camilla Löwy 2019-12-16 13:19:37 +01:00
parent 0c27ed1d0e
commit a0a5cc57df
4 changed files with 508 additions and 6 deletions

View File

@ -195,11 +195,8 @@ if (_GLFW_X11)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
list(APPEND glfw_PKG_DEPS "x11")
# Set up library and include paths # Set up library and include paths
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}")
# Check for XRandR (modern resolution switching and gamma control) # Check for XRandR (modern resolution switching and gamma control)
if (NOT X11_Xrandr_INCLUDE_PATH) if (NOT X11_Xrandr_INCLUDE_PATH)

View File

@ -29,8 +29,6 @@
#include "internal.h" #include "internal.h"
#include <X11/Xresource.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
@ -948,6 +946,210 @@ int _glfwPlatformInit(void)
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
#endif #endif
#if defined(__CYGWIN__)
_glfw.x11.xlib.handle = _glfw_dlopen("libX11-6.so");
#else
_glfw.x11.xlib.handle = _glfw_dlopen("libX11.so.6");
#endif
if (!_glfw.x11.xlib.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to load Xlib");
return GLFW_FALSE;
}
_glfw.x11.xlib.AllocClassHint = (PFN_XAllocClassHint)
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocClassHint");
_glfw.x11.xlib.AllocSizeHints = (PFN_XAllocSizeHints)
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocSizeHints");
_glfw.x11.xlib.AllocWMHints = (PFN_XAllocWMHints)
_glfw_dlsym(_glfw.x11.xlib.handle, "XAllocWMHints");
_glfw.x11.xlib.ChangeProperty = (PFN_XChangeProperty)
_glfw_dlsym(_glfw.x11.xlib.handle, "XChangeProperty");
_glfw.x11.xlib.ChangeWindowAttributes = (PFN_XChangeWindowAttributes)
_glfw_dlsym(_glfw.x11.xlib.handle, "XChangeWindowAttributes");
_glfw.x11.xlib.CheckIfEvent = (PFN_XCheckIfEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCheckIfEvent");
_glfw.x11.xlib.CheckTypedWindowEvent = (PFN_XCheckTypedWindowEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCheckTypedWindowEvent");
_glfw.x11.xlib.CloseDisplay = (PFN_XCloseDisplay)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCloseDisplay");
_glfw.x11.xlib.CloseIM = (PFN_XCloseIM)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCloseIM");
_glfw.x11.xlib.ConvertSelection = (PFN_XConvertSelection)
_glfw_dlsym(_glfw.x11.xlib.handle, "XConvertSelection");
_glfw.x11.xlib.CreateColormap = (PFN_XCreateColormap)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateColormap");
_glfw.x11.xlib.CreateFontCursor = (PFN_XCreateFontCursor)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateFontCursor");
_glfw.x11.xlib.CreateIC = (PFN_XCreateIC)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateIC");
_glfw.x11.xlib.CreateWindow = (PFN_XCreateWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XCreateWindow");
_glfw.x11.xlib.DefineCursor = (PFN_XDefineCursor)
_glfw_dlsym(_glfw.x11.xlib.handle, "XDefineCursor");
_glfw.x11.xlib.DeleteContext = (PFN_XDeleteContext)
_glfw_dlsym(_glfw.x11.xlib.handle, "XDeleteContext");
_glfw.x11.xlib.DeleteProperty = (PFN_XDeleteProperty)
_glfw_dlsym(_glfw.x11.xlib.handle, "XDeleteProperty");
_glfw.x11.xlib.DestroyIC = (PFN_XDestroyIC)
_glfw_dlsym(_glfw.x11.xlib.handle, "XDestroyIC");
_glfw.x11.xlib.DestroyWindow = (PFN_XDestroyWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XDestroyWindow");
_glfw.x11.xlib.EventsQueued = (PFN_XEventsQueued)
_glfw_dlsym(_glfw.x11.xlib.handle, "XEventsQueued");
_glfw.x11.xlib.FilterEvent = (PFN_XFilterEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFilterEvent");
_glfw.x11.xlib.FindContext = (PFN_XFindContext)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFindContext");
_glfw.x11.xlib.Flush = (PFN_XFlush)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFlush");
_glfw.x11.xlib.Free = (PFN_XFree)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFree");
_glfw.x11.xlib.FreeColormap = (PFN_XFreeColormap)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeColormap");
_glfw.x11.xlib.FreeCursor = (PFN_XFreeCursor)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeCursor");
_glfw.x11.xlib.FreeEventData = (PFN_XFreeEventData)
_glfw_dlsym(_glfw.x11.xlib.handle, "XFreeEventData");
_glfw.x11.xlib.GetErrorText = (PFN_XGetErrorText)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetErrorText");
_glfw.x11.xlib.GetEventData = (PFN_XGetEventData)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetEventData");
_glfw.x11.xlib.GetICValues = (PFN_XGetICValues)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetICValues");
_glfw.x11.xlib.GetIMValues = (PFN_XGetIMValues)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetIMValues");
_glfw.x11.xlib.GetInputFocus = (PFN_XGetInputFocus)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetInputFocus");
_glfw.x11.xlib.GetKeyboardMapping = (PFN_XGetKeyboardMapping)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetKeyboardMapping");
_glfw.x11.xlib.GetScreenSaver = (PFN_XGetScreenSaver)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetScreenSaver");
_glfw.x11.xlib.GetSelectionOwner = (PFN_XGetSelectionOwner)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetSelectionOwner");
_glfw.x11.xlib.GetVisualInfo = (PFN_XGetVisualInfo)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetVisualInfo");
_glfw.x11.xlib.GetWMNormalHints = (PFN_XGetWMNormalHints)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWMNormalHints");
_glfw.x11.xlib.GetWindowAttributes = (PFN_XGetWindowAttributes)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWindowAttributes");
_glfw.x11.xlib.GetWindowProperty = (PFN_XGetWindowProperty)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGetWindowProperty");
_glfw.x11.xlib.GrabPointer = (PFN_XGrabPointer)
_glfw_dlsym(_glfw.x11.xlib.handle, "XGrabPointer");
_glfw.x11.xlib.IconifyWindow = (PFN_XIconifyWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XIconifyWindow");
_glfw.x11.xlib.InitThreads = (PFN_XInitThreads)
_glfw_dlsym(_glfw.x11.xlib.handle, "XInitThreads");
_glfw.x11.xlib.InternAtom = (PFN_XInternAtom)
_glfw_dlsym(_glfw.x11.xlib.handle, "XInternAtom");
_glfw.x11.xlib.LookupString = (PFN_XLookupString)
_glfw_dlsym(_glfw.x11.xlib.handle, "XLookupString");
_glfw.x11.xlib.MapRaised = (PFN_XMapRaised)
_glfw_dlsym(_glfw.x11.xlib.handle, "XMapRaised");
_glfw.x11.xlib.MapWindow = (PFN_XMapWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XMapWindow");
_glfw.x11.xlib.MoveResizeWindow = (PFN_XMoveResizeWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XMoveResizeWindow");
_glfw.x11.xlib.MoveWindow = (PFN_XMoveWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XMoveWindow");
_glfw.x11.xlib.NextEvent = (PFN_XNextEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XNextEvent");
_glfw.x11.xlib.OpenDisplay = (PFN_XOpenDisplay)
_glfw_dlsym(_glfw.x11.xlib.handle, "XOpenDisplay");
_glfw.x11.xlib.OpenIM = (PFN_XOpenIM)
_glfw_dlsym(_glfw.x11.xlib.handle, "XOpenIM");
_glfw.x11.xlib.PeekEvent = (PFN_XPeekEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XPeekEvent");
_glfw.x11.xlib.Pending = (PFN_XPending)
_glfw_dlsym(_glfw.x11.xlib.handle, "XPending");
_glfw.x11.xlib.QueryExtension = (PFN_XQueryExtension)
_glfw_dlsym(_glfw.x11.xlib.handle, "XQueryExtension");
_glfw.x11.xlib.QueryPointer = (PFN_XQueryPointer)
_glfw_dlsym(_glfw.x11.xlib.handle, "XQueryPointer");
_glfw.x11.xlib.RaiseWindow = (PFN_XRaiseWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XRaiseWindow");
_glfw.x11.xlib.ResizeWindow = (PFN_XResizeWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XResizeWindow");
_glfw.x11.xlib.ResourceManagerString = (PFN_XResourceManagerString)
_glfw_dlsym(_glfw.x11.xlib.handle, "XResourceManagerString");
_glfw.x11.xlib.SaveContext = (PFN_XSaveContext)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSaveContext");
_glfw.x11.xlib.SelectInput = (PFN_XSelectInput)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSelectInput");
_glfw.x11.xlib.SendEvent = (PFN_XSendEvent)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSendEvent");
_glfw.x11.xlib.SetClassHint = (PFN_XSetClassHint)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetClassHint");
_glfw.x11.xlib.SetErrorHandler = (PFN_XSetErrorHandler)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetErrorHandler");
_glfw.x11.xlib.SetICFocus = (PFN_XSetICFocus)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetICFocus");
_glfw.x11.xlib.SetInputFocus = (PFN_XSetInputFocus)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetInputFocus");
_glfw.x11.xlib.SetLocaleModifiers = (PFN_XSetLocaleModifiers)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetLocaleModifiers");
_glfw.x11.xlib.SetScreenSaver = (PFN_XSetScreenSaver)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetScreenSaver");
_glfw.x11.xlib.SetSelectionOwner = (PFN_XSetSelectionOwner)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetSelectionOwner");
_glfw.x11.xlib.SetWMHints = (PFN_XSetWMHints)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMHints");
_glfw.x11.xlib.SetWMNormalHints = (PFN_XSetWMNormalHints)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMNormalHints");
_glfw.x11.xlib.SetWMProtocols = (PFN_XSetWMProtocols)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSetWMProtocols");
_glfw.x11.xlib.SupportsLocale = (PFN_XSupportsLocale)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSupportsLocale");
_glfw.x11.xlib.Sync = (PFN_XSync)
_glfw_dlsym(_glfw.x11.xlib.handle, "XSync");
_glfw.x11.xlib.TranslateCoordinates = (PFN_XTranslateCoordinates)
_glfw_dlsym(_glfw.x11.xlib.handle, "XTranslateCoordinates");
_glfw.x11.xlib.UndefineCursor = (PFN_XUndefineCursor)
_glfw_dlsym(_glfw.x11.xlib.handle, "XUndefineCursor");
_glfw.x11.xlib.UngrabPointer = (PFN_XUngrabPointer)
_glfw_dlsym(_glfw.x11.xlib.handle, "XUngrabPointer");
_glfw.x11.xlib.UnmapWindow = (PFN_XUnmapWindow)
_glfw_dlsym(_glfw.x11.xlib.handle, "XUnmapWindow");
_glfw.x11.xlib.UnsetICFocus = (PFN_XUnsetICFocus)
_glfw_dlsym(_glfw.x11.xlib.handle, "XUnsetICFocus");
_glfw.x11.xlib.VisualIDFromVisual = (PFN_XVisualIDFromVisual)
_glfw_dlsym(_glfw.x11.xlib.handle, "XVisualIDFromVisual");
_glfw.x11.xlib.WarpPointer = (PFN_XWarpPointer)
_glfw_dlsym(_glfw.x11.xlib.handle, "XWarpPointer");
_glfw.x11.xkb.FreeKeyboard = (PFN_XkbFreeKeyboard)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbFreeKeyboard");
_glfw.x11.xkb.FreeNames = (PFN_XkbFreeNames)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbFreeNames");
_glfw.x11.xkb.GetMap = (PFN_XkbGetMap)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetMap");
_glfw.x11.xkb.GetNames = (PFN_XkbGetNames)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetNames");
_glfw.x11.xkb.GetState = (PFN_XkbGetState)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbGetState");
_glfw.x11.xkb.KeycodeToKeysym = (PFN_XkbKeycodeToKeysym)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbKeycodeToKeysym");
_glfw.x11.xkb.QueryExtension = (PFN_XkbQueryExtension)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbQueryExtension");
_glfw.x11.xkb.SelectEventDetails = (PFN_XkbSelectEventDetails)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbSelectEventDetails");
_glfw.x11.xkb.SetDetectableAutoRepeat = (PFN_XkbSetDetectableAutoRepeat)
_glfw_dlsym(_glfw.x11.xlib.handle, "XkbSetDetectableAutoRepeat");
_glfw.x11.xrm.DestroyDatabase = (PFN_XrmDestroyDatabase)
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmDestroyDatabase");
_glfw.x11.xrm.GetResource = (PFN_XrmGetResource)
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmGetResource");
_glfw.x11.xrm.GetStringDatabase = (PFN_XrmGetStringDatabase)
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmGetStringDatabase");
_glfw.x11.xrm.Initialize = (PFN_XrmInitialize)
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmInitialize");
_glfw.x11.xrm.UniqueQuark = (PFN_XrmUniqueQuark)
_glfw_dlsym(_glfw.x11.xlib.handle, "XrmUniqueQuark");
_glfw.x11.xlib.utf8LookupString = (PFN_Xutf8LookupString)
_glfw_dlsym(_glfw.x11.xlib.handle, "Xutf8LookupString");
_glfw.x11.xlib.utf8SetWMProperties = (PFN_Xutf8SetWMProperties)
_glfw_dlsym(_glfw.x11.xlib.handle, "Xutf8SetWMProperties");
XInitThreads(); XInitThreads();
XrmInitialize(); XrmInitialize();
@ -1092,6 +1294,12 @@ void _glfwPlatformTerminate(void)
#if defined(__linux__) #if defined(__linux__)
_glfwTerminateJoysticksLinux(); _glfwTerminateJoysticksLinux();
#endif #endif
if (_glfw.x11.xlib.handle)
{
_glfw_dlclose(_glfw.x11.xlib.handle);
_glfw.x11.xlib.handle = NULL;
}
} }
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)

View File

@ -33,6 +33,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <X11/Xcursor/Xcursor.h> #include <X11/Xcursor/Xcursor.h>
// The XRandR extension provides mode setting and gamma control // The XRandR extension provides mode setting and gamma control
@ -47,6 +48,199 @@
// The XInput extension provides raw mouse motion input // The XInput extension provides raw mouse motion input
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
typedef XClassHint* (* PFN_XAllocClassHint)(void);
typedef XSizeHints* (* PFN_XAllocSizeHints)(void);
typedef XWMHints* (* PFN_XAllocWMHints)(void);
typedef int (* PFN_XChangeProperty)(Display*,Window,Atom,Atom,int,int,const unsigned char*,int);
typedef int (* PFN_XChangeWindowAttributes)(Display*,Window,unsigned long,XSetWindowAttributes*);
typedef Bool (* PFN_XCheckIfEvent)(Display*,XEvent*,Bool(*)(Display*,XEvent*,XPointer),XPointer);
typedef Bool (* PFN_XCheckTypedWindowEvent)(Display*,Window,int,XEvent*);
typedef int (* PFN_XCloseDisplay)(Display*);
typedef Status (* PFN_XCloseIM)(XIM);
typedef int (* PFN_XConvertSelection)(Display*,Atom,Atom,Atom,Window,Time);
typedef Colormap (* PFN_XCreateColormap)(Display*,Window,Visual*,int);
typedef Cursor (* PFN_XCreateFontCursor)(Display*,unsigned int);
typedef XIC (* PFN_XCreateIC)(XIM,...);
typedef Window (* PFN_XCreateWindow)(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*);
typedef int (* PFN_XDefineCursor)(Display*,Window,Cursor);
typedef int (* PFN_XDeleteContext)(Display*,XID,XContext);
typedef int (* PFN_XDeleteProperty)(Display*,Window,Atom);
typedef void (* PFN_XDestroyIC)(XIC);
typedef int (* PFN_XDestroyWindow)(Display*,Window);
typedef int (* PFN_XEventsQueued)(Display*,int);
typedef Bool (* PFN_XFilterEvent)(XEvent*,Window);
typedef int (* PFN_XFindContext)(Display*,XID,XContext,XPointer*);
typedef int (* PFN_XFlush)(Display*);
typedef int (* PFN_XFree)(void*);
typedef int (* PFN_XFreeColormap)(Display*,Colormap);
typedef int (* PFN_XFreeCursor)(Display*,Cursor);
typedef void (* PFN_XFreeEventData)(Display*,XGenericEventCookie*);
typedef int (* PFN_XGetErrorText)(Display*,int,char*,int);
typedef Bool (* PFN_XGetEventData)(Display*,XGenericEventCookie*);
typedef char* (* PFN_XGetICValues)(XIC,...);
typedef char* (* PFN_XGetIMValues)(XIM,...);
typedef int (* PFN_XGetInputFocus)(Display*,Window*,int*);
typedef KeySym* (* PFN_XGetKeyboardMapping)(Display*,KeyCode,int,int*);
typedef int (* PFN_XGetScreenSaver)(Display*,int*,int*,int*,int*);
typedef Window (* PFN_XGetSelectionOwner)(Display*,Atom);
typedef XVisualInfo* (* PFN_XGetVisualInfo)(Display*,long,XVisualInfo*,int*);
typedef Status (* PFN_XGetWMNormalHints)(Display*,Window,XSizeHints*,long*);
typedef Status (* PFN_XGetWindowAttributes)(Display*,Window,XWindowAttributes*);
typedef int (* PFN_XGetWindowProperty)(Display*,Window,Atom,long,long,Bool,Atom,Atom*,int*,unsigned long*,unsigned long*,unsigned char**);
typedef int (* PFN_XGrabPointer)(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time);
typedef Status (* PFN_XIconifyWindow)(Display*,Window,int);
typedef Status (* PFN_XInitThreads)(void);
typedef Atom (* PFN_XInternAtom)(Display*,const char*,Bool);
typedef int (* PFN_XLookupString)(XKeyEvent*,char*,int,KeySym*,XComposeStatus*);
typedef int (* PFN_XMapRaised)(Display*,Window);
typedef int (* PFN_XMapWindow)(Display*,Window);
typedef int (* PFN_XMoveResizeWindow)(Display*,Window,int,int,unsigned int,unsigned int);
typedef int (* PFN_XMoveWindow)(Display*,Window,int,int);
typedef int (* PFN_XNextEvent)(Display*,XEvent*);
typedef Display* (* PFN_XOpenDisplay)(const char*);
typedef XIM (* PFN_XOpenIM)(Display*,XrmDatabase*,char*,char*);
typedef int (* PFN_XPeekEvent)(Display*,XEvent*);
typedef int (* PFN_XPending)(Display*);
typedef Bool (* PFN_XQueryExtension)(Display*,const char*,int*,int*,int*);
typedef Bool (* PFN_XQueryPointer)(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*);
typedef int (* PFN_XRaiseWindow)(Display*,Window);
typedef int (* PFN_XResizeWindow)(Display*,Window,unsigned int,unsigned int);
typedef char* (* PFN_XResourceManagerString)(Display*);
typedef int (* PFN_XSaveContext)(Display*,XID,XContext,const char*);
typedef int (* PFN_XSelectInput)(Display*,Window,long);
typedef Status (* PFN_XSendEvent)(Display*,Window,Bool,long,XEvent*);
typedef int (* PFN_XSetClassHint)(Display*,Window,XClassHint*);
typedef XErrorHandler (* PFN_XSetErrorHandler)(XErrorHandler);
typedef void (* PFN_XSetICFocus)(XIC);
typedef int (* PFN_XSetInputFocus)(Display*,Window,int,Time);
typedef char* (* PFN_XSetLocaleModifiers)(const char*);
typedef int (* PFN_XSetScreenSaver)(Display*,int,int,int,int);
typedef int (* PFN_XSetSelectionOwner)(Display*,Atom,Window,Time);
typedef int (* PFN_XSetWMHints)(Display*,Window,XWMHints*);
typedef void (* PFN_XSetWMNormalHints)(Display*,Window,XSizeHints*);
typedef Status (* PFN_XSetWMProtocols)(Display*,Window,Atom*,int);
typedef Bool (* PFN_XSupportsLocale)(void);
typedef int (* PFN_XSync)(Display*,Bool);
typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*);
typedef int (* PFN_XUndefineCursor)(Display*,Window);
typedef int (* PFN_XUngrabPointer)(Display*,Time);
typedef int (* PFN_XUnmapWindow)(Display*,Window);
typedef void (* PFN_XUnsetICFocus)(XIC);
typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*);
typedef int (* PFN_XWarpPointer)(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int);
typedef void (* PFN_XkbFreeKeyboard)(XkbDescPtr,unsigned int,Bool);
typedef void (* PFN_XkbFreeNames)(XkbDescPtr,unsigned int,Bool);
typedef XkbDescPtr (* PFN_XkbGetMap)(Display*,unsigned int,unsigned int);
typedef Status (* PFN_XkbGetNames)(Display*,unsigned int,XkbDescPtr);
typedef Status (* PFN_XkbGetState)(Display*,unsigned int,XkbStatePtr);
typedef KeySym (* PFN_XkbKeycodeToKeysym)(Display*,KeyCode,int,int);
typedef Bool (* PFN_XkbQueryExtension)(Display*,int*,int*,int*,int*,int*);
typedef Bool (* PFN_XkbSelectEventDetails)(Display*,unsigned int,unsigned int,unsigned long,unsigned long);
typedef Bool (* PFN_XkbSetDetectableAutoRepeat)(Display*,Bool,Bool*);
typedef void (* PFN_XrmDestroyDatabase)(XrmDatabase);
typedef Bool (* PFN_XrmGetResource)(XrmDatabase,const char*,const char*,char**,XrmValue*);
typedef XrmDatabase (* PFN_XrmGetStringDatabase)(const char*);
typedef void (* PFN_XrmInitialize)(void);
typedef XrmQuark (* PFN_XrmUniqueQuark)(void);
typedef int (* PFN_Xutf8LookupString)(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*);
typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char*,char**,int,XSizeHints*,XWMHints*,XClassHint*);
#define XAllocClassHint _glfw.x11.xlib.AllocClassHint
#define XAllocSizeHints _glfw.x11.xlib.AllocSizeHints
#define XAllocWMHints _glfw.x11.xlib.AllocWMHints
#define XChangeProperty _glfw.x11.xlib.ChangeProperty
#define XChangeWindowAttributes _glfw.x11.xlib.ChangeWindowAttributes
#define XCheckIfEvent _glfw.x11.xlib.CheckIfEvent
#define XCheckTypedWindowEvent _glfw.x11.xlib.CheckTypedWindowEvent
#define XCloseDisplay _glfw.x11.xlib.CloseDisplay
#define XCloseIM _glfw.x11.xlib.CloseIM
#define XConvertSelection _glfw.x11.xlib.ConvertSelection
#define XCreateColormap _glfw.x11.xlib.CreateColormap
#define XCreateFontCursor _glfw.x11.xlib.CreateFontCursor
#define XCreateIC _glfw.x11.xlib.CreateIC
#define XCreateWindow _glfw.x11.xlib.CreateWindow
#define XDefineCursor _glfw.x11.xlib.DefineCursor
#define XDeleteContext _glfw.x11.xlib.DeleteContext
#define XDeleteProperty _glfw.x11.xlib.DeleteProperty
#define XDestroyIC _glfw.x11.xlib.DestroyIC
#define XDestroyWindow _glfw.x11.xlib.DestroyWindow
#define XEventsQueued _glfw.x11.xlib.EventsQueued
#define XFilterEvent _glfw.x11.xlib.FilterEvent
#define XFindContext _glfw.x11.xlib.FindContext
#define XFlush _glfw.x11.xlib.Flush
#define XFree _glfw.x11.xlib.Free
#define XFreeColormap _glfw.x11.xlib.FreeColormap
#define XFreeCursor _glfw.x11.xlib.FreeCursor
#define XFreeEventData _glfw.x11.xlib.FreeEventData
#define XGetErrorText _glfw.x11.xlib.GetErrorText
#define XGetEventData _glfw.x11.xlib.GetEventData
#define XGetICValues _glfw.x11.xlib.GetICValues
#define XGetIMValues _glfw.x11.xlib.GetIMValues
#define XGetInputFocus _glfw.x11.xlib.GetInputFocus
#define XGetKeyboardMapping _glfw.x11.xlib.GetKeyboardMapping
#define XGetScreenSaver _glfw.x11.xlib.GetScreenSaver
#define XGetSelectionOwner _glfw.x11.xlib.GetSelectionOwner
#define XGetVisualInfo _glfw.x11.xlib.GetVisualInfo
#define XGetWMNormalHints _glfw.x11.xlib.GetWMNormalHints
#define XGetWindowAttributes _glfw.x11.xlib.GetWindowAttributes
#define XGetWindowProperty _glfw.x11.xlib.GetWindowProperty
#define XGrabPointer _glfw.x11.xlib.GrabPointer
#define XIconifyWindow _glfw.x11.xlib.IconifyWindow
#define XInitThreads _glfw.x11.xlib.InitThreads
#define XInternAtom _glfw.x11.xlib.InternAtom
#define XLookupString _glfw.x11.xlib.LookupString
#define XMapRaised _glfw.x11.xlib.MapRaised
#define XMapWindow _glfw.x11.xlib.MapWindow
#define XMoveResizeWindow _glfw.x11.xlib.MoveResizeWindow
#define XMoveWindow _glfw.x11.xlib.MoveWindow
#define XNextEvent _glfw.x11.xlib.NextEvent
#define XOpenDisplay _glfw.x11.xlib.OpenDisplay
#define XOpenIM _glfw.x11.xlib.OpenIM
#define XPeekEvent _glfw.x11.xlib.PeekEvent
#define XPending _glfw.x11.xlib.Pending
#define XQueryExtension _glfw.x11.xlib.QueryExtension
#define XQueryPointer _glfw.x11.xlib.QueryPointer
#define XRaiseWindow _glfw.x11.xlib.RaiseWindow
#define XResizeWindow _glfw.x11.xlib.ResizeWindow
#define XResourceManagerString _glfw.x11.xlib.ResourceManagerString
#define XSaveContext _glfw.x11.xlib.SaveContext
#define XSelectInput _glfw.x11.xlib.SelectInput
#define XSendEvent _glfw.x11.xlib.SendEvent
#define XSetClassHint _glfw.x11.xlib.SetClassHint
#define XSetErrorHandler _glfw.x11.xlib.SetErrorHandler
#define XSetICFocus _glfw.x11.xlib.SetICFocus
#define XSetInputFocus _glfw.x11.xlib.SetInputFocus
#define XSetLocaleModifiers _glfw.x11.xlib.SetLocaleModifiers
#define XSetScreenSaver _glfw.x11.xlib.SetScreenSaver
#define XSetSelectionOwner _glfw.x11.xlib.SetSelectionOwner
#define XSetWMHints _glfw.x11.xlib.SetWMHints
#define XSetWMNormalHints _glfw.x11.xlib.SetWMNormalHints
#define XSetWMProtocols _glfw.x11.xlib.SetWMProtocols
#define XSupportsLocale _glfw.x11.xlib.SupportsLocale
#define XSync _glfw.x11.xlib.Sync
#define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates
#define XUndefineCursor _glfw.x11.xlib.UndefineCursor
#define XUngrabPointer _glfw.x11.xlib.UngrabPointer
#define XUnmapWindow _glfw.x11.xlib.UnmapWindow
#define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus
#define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual
#define XWarpPointer _glfw.x11.xlib.WarpPointer
#define XkbFreeKeyboard _glfw.x11.xkb.FreeKeyboard
#define XkbFreeNames _glfw.x11.xkb.FreeNames
#define XkbGetMap _glfw.x11.xkb.GetMap
#define XkbGetNames _glfw.x11.xkb.GetNames
#define XkbGetState _glfw.x11.xkb.GetState
#define XkbKeycodeToKeysym _glfw.x11.xkb.KeycodeToKeysym
#define XkbQueryExtension _glfw.x11.xkb.QueryExtension
#define XkbSelectEventDetails _glfw.x11.xkb.SelectEventDetails
#define XkbSetDetectableAutoRepeat _glfw.x11.xkb.SetDetectableAutoRepeat
#define XrmDestroyDatabase _glfw.x11.xrm.DestroyDatabase
#define XrmGetResource _glfw.x11.xrm.GetResource
#define XrmGetStringDatabase _glfw.x11.xrm.GetStringDatabase
#define XrmInitialize _glfw.x11.xrm.Initialize
#define XrmUniqueQuark _glfw.x11.xrm.UniqueQuark
#define Xutf8LookupString _glfw.x11.xlib.utf8LookupString
#define Xutf8SetWMProperties _glfw.x11.xlib.utf8SetWMProperties
typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int); typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int);
typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*); typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*);
typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*); typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*);
@ -301,6 +495,100 @@ typedef struct _GLFWlibraryX11
Atom ATOM_PAIR; Atom ATOM_PAIR;
Atom GLFW_SELECTION; Atom GLFW_SELECTION;
struct {
void* handle;
PFN_XAllocClassHint AllocClassHint;
PFN_XAllocSizeHints AllocSizeHints;
PFN_XAllocWMHints AllocWMHints;
PFN_XChangeProperty ChangeProperty;
PFN_XChangeWindowAttributes ChangeWindowAttributes;
PFN_XCheckIfEvent CheckIfEvent;
PFN_XCheckTypedWindowEvent CheckTypedWindowEvent;
PFN_XCloseDisplay CloseDisplay;
PFN_XCloseIM CloseIM;
PFN_XConvertSelection ConvertSelection;
PFN_XCreateColormap CreateColormap;
PFN_XCreateFontCursor CreateFontCursor;
PFN_XCreateIC CreateIC;
PFN_XCreateWindow CreateWindow;
PFN_XDefineCursor DefineCursor;
PFN_XDeleteContext DeleteContext;
PFN_XDeleteProperty DeleteProperty;
PFN_XDestroyIC DestroyIC;
PFN_XDestroyWindow DestroyWindow;
PFN_XEventsQueued EventsQueued;
PFN_XFilterEvent FilterEvent;
PFN_XFindContext FindContext;
PFN_XFlush Flush;
PFN_XFree Free;
PFN_XFreeColormap FreeColormap;
PFN_XFreeCursor FreeCursor;
PFN_XFreeEventData FreeEventData;
PFN_XGetErrorText GetErrorText;
PFN_XGetEventData GetEventData;
PFN_XGetICValues GetICValues;
PFN_XGetIMValues GetIMValues;
PFN_XGetInputFocus GetInputFocus;
PFN_XGetKeyboardMapping GetKeyboardMapping;
PFN_XGetScreenSaver GetScreenSaver;
PFN_XGetSelectionOwner GetSelectionOwner;
PFN_XGetVisualInfo GetVisualInfo;
PFN_XGetWMNormalHints GetWMNormalHints;
PFN_XGetWindowAttributes GetWindowAttributes;
PFN_XGetWindowProperty GetWindowProperty;
PFN_XGrabPointer GrabPointer;
PFN_XIconifyWindow IconifyWindow;
PFN_XInitThreads InitThreads;
PFN_XInternAtom InternAtom;
PFN_XLookupString LookupString;
PFN_XMapRaised MapRaised;
PFN_XMapWindow MapWindow;
PFN_XMoveResizeWindow MoveResizeWindow;
PFN_XMoveWindow MoveWindow;
PFN_XNextEvent NextEvent;
PFN_XOpenDisplay OpenDisplay;
PFN_XOpenIM OpenIM;
PFN_XPeekEvent PeekEvent;
PFN_XPending Pending;
PFN_XQueryExtension QueryExtension;
PFN_XQueryPointer QueryPointer;
PFN_XRaiseWindow RaiseWindow;
PFN_XResizeWindow ResizeWindow;
PFN_XResourceManagerString ResourceManagerString;
PFN_XSaveContext SaveContext;
PFN_XSelectInput SelectInput;
PFN_XSendEvent SendEvent;
PFN_XSetClassHint SetClassHint;
PFN_XSetErrorHandler SetErrorHandler;
PFN_XSetICFocus SetICFocus;
PFN_XSetInputFocus SetInputFocus;
PFN_XSetLocaleModifiers SetLocaleModifiers;
PFN_XSetScreenSaver SetScreenSaver;
PFN_XSetSelectionOwner SetSelectionOwner;
PFN_XSetWMHints SetWMHints;
PFN_XSetWMNormalHints SetWMNormalHints;
PFN_XSetWMProtocols SetWMProtocols;
PFN_XSupportsLocale SupportsLocale;
PFN_XSync Sync;
PFN_XTranslateCoordinates TranslateCoordinates;
PFN_XUndefineCursor UndefineCursor;
PFN_XUngrabPointer UngrabPointer;
PFN_XUnmapWindow UnmapWindow;
PFN_XUnsetICFocus UnsetICFocus;
PFN_XVisualIDFromVisual VisualIDFromVisual;
PFN_XWarpPointer WarpPointer;
PFN_Xutf8LookupString utf8LookupString;
PFN_Xutf8SetWMProperties utf8SetWMProperties;
} xlib;
struct {
PFN_XrmDestroyDatabase DestroyDatabase;
PFN_XrmGetResource GetResource;
PFN_XrmGetStringDatabase GetStringDatabase;
PFN_XrmInitialize Initialize;
PFN_XrmUniqueQuark UniqueQuark;
} xrm;
struct { struct {
GLFWbool available; GLFWbool available;
void* handle; void* handle;
@ -338,6 +626,15 @@ typedef struct _GLFWlibraryX11
int major; int major;
int minor; int minor;
unsigned int group; unsigned int group;
PFN_XkbFreeKeyboard FreeKeyboard;
PFN_XkbFreeNames FreeNames;
PFN_XkbGetMap GetMap;
PFN_XkbGetNames GetNames;
PFN_XkbGetState GetState;
PFN_XkbKeycodeToKeysym KeycodeToKeysym;
PFN_XkbQueryExtension QueryExtension;
PFN_XkbSelectEventDetails SelectEventDetails;
PFN_XkbSetDetectableAutoRepeat SetDetectableAutoRepeat;
} xkb; } xkb;
struct { struct {

View File

@ -2759,7 +2759,7 @@ void _glfwPlatformPollEvents(void)
#endif #endif
XPending(_glfw.x11.display); XPending(_glfw.x11.display);
while (XQLength(_glfw.x11.display)) while (QLength(_glfw.x11.display))
{ {
XEvent event; XEvent event;
XNextEvent(_glfw.x11.display, &event); XNextEvent(_glfw.x11.display, &event);