1 //======================================================================== 2 // GLFW 3.5 X11 - www.glfw.org 3 //------------------------------------------------------------------------ 4 // Copyright (c) 2002-2006 Marcus Geelnard 5 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org> 6 // 7 // This software is provided 'as-is', without any express or implied 8 // warranty. In no event will the authors be held liable for any damages 9 // arising from the use of this software. 10 // 11 // Permission is granted to anyone to use this software for any purpose, 12 // including commercial applications, and to alter it and redistribute it 13 // freely, subject to the following restrictions: 14 // 15 // 1. The origin of this software must not be misrepresented; you must not 16 // claim that you wrote the original software. If you use this software 17 // in a product, an acknowledgment in the product documentation would 18 // be appreciated but is not required. 19 // 20 // 2. Altered source versions must be plainly marked as such, and must not 21 // be misrepresented as being the original software. 22 // 23 // 3. This notice may not be removed or altered from any source 24 // distribution. 25 // 26 //======================================================================== 27 28 #include <unistd.h> 29 #include <signal.h> 30 #include <stdint.h> 31 32 #include <X11/Xlib.h> 33 #include <X11/keysym.h> 34 #include <X11/Xatom.h> 35 #include <X11/Xresource.h> 36 #include <X11/Xcursor/Xcursor.h> 37 38 // The XRandR extension provides mode setting and gamma control 39 #include <X11/extensions/Xrandr.h> 40 41 // The Xkb extension provides improved keyboard support 42 #include <X11/XKBlib.h> 43 44 // The Xinerama extension provides legacy monitor indices 45 #include <X11/extensions/Xinerama.h> 46 47 // The XInput extension provides raw mouse motion input 48 #ifndef USE_DUMMPY_XINPUT2 49 #include <X11/extensions/XInput2.h> 50 #endif 51 52 // The Shape extension provides custom window shapes 53 #include <X11/extensions/shape.h> 54 55 #define GLX_VENDOR 1 56 #define GLX_RGBA_BIT 0x00000001 57 #define GLX_WINDOW_BIT 0x00000001 58 #define GLX_DRAWABLE_TYPE 0x8010 59 #define GLX_RENDER_TYPE 0x8011 60 #define GLX_RGBA_TYPE 0x8014 61 #define GLX_DOUBLEBUFFER 5 62 #define GLX_STEREO 6 63 #define GLX_AUX_BUFFERS 7 64 #define GLX_RED_SIZE 8 65 #define GLX_GREEN_SIZE 9 66 #define GLX_BLUE_SIZE 10 67 #define GLX_ALPHA_SIZE 11 68 #define GLX_DEPTH_SIZE 12 69 #define GLX_STENCIL_SIZE 13 70 #define GLX_ACCUM_RED_SIZE 14 71 #define GLX_ACCUM_GREEN_SIZE 15 72 #define GLX_ACCUM_BLUE_SIZE 16 73 #define GLX_ACCUM_ALPHA_SIZE 17 74 #define GLX_SAMPLES 0x186a1 75 #define GLX_VISUAL_ID 0x800b 76 77 #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2 78 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 79 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 80 #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 81 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 82 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 83 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 84 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 85 #define GLX_CONTEXT_FLAGS_ARB 0x2094 86 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 87 #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 88 #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 89 #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 90 #define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 91 #define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 92 #define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 93 #define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 94 #define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 95 96 typedef XID GLXWindow; 97 typedef XID GLXDrawable; 98 typedef struct __GLXFBConfig* GLXFBConfig; 99 typedef struct __GLXcontext* GLXContext; 100 typedef void (*__GLXextproc)(void); 101 102 typedef XClassHint* (* PFN_XAllocClassHint)(void); 103 typedef XSizeHints* (* PFN_XAllocSizeHints)(void); 104 typedef XWMHints* (* PFN_XAllocWMHints)(void); 105 typedef int (* PFN_XChangeProperty)(Display*,Window,Atom,Atom,int,int,const unsigned char*,int); 106 typedef int (* PFN_XChangeWindowAttributes)(Display*,Window,unsigned long,XSetWindowAttributes*); 107 typedef Bool (* PFN_XCheckIfEvent)(Display*,XEvent*,Bool(*)(Display*,XEvent*,XPointer),XPointer); 108 typedef Bool (* PFN_XCheckTypedWindowEvent)(Display*,Window,int,XEvent*); 109 typedef int (* PFN_XCloseDisplay)(Display*); 110 typedef Status (* PFN_XCloseIM)(XIM); 111 typedef int (* PFN_XConvertSelection)(Display*,Atom,Atom,Atom,Window,Time); 112 typedef Colormap (* PFN_XCreateColormap)(Display*,Window,Visual*,int); 113 typedef Cursor (* PFN_XCreateFontCursor)(Display*,unsigned int); 114 typedef XIC (* PFN_XCreateIC)(XIM,...); 115 typedef Region (* PFN_XCreateRegion)(void); 116 typedef Window (* PFN_XCreateWindow)(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*); 117 typedef int (* PFN_XDefineCursor)(Display*,Window,Cursor); 118 typedef int (* PFN_XDeleteContext)(Display*,XID,XContext); 119 typedef int (* PFN_XDeleteProperty)(Display*,Window,Atom); 120 typedef void (* PFN_XDestroyIC)(XIC); 121 typedef int (* PFN_XDestroyRegion)(Region); 122 typedef int (* PFN_XDestroyWindow)(Display*,Window); 123 typedef int (* PFN_XDisplayKeycodes)(Display*,int*,int*); 124 typedef int (* PFN_XEventsQueued)(Display*,int); 125 typedef Bool (* PFN_XFilterEvent)(XEvent*,Window); 126 typedef int (* PFN_XFindContext)(Display*,XID,XContext,XPointer*); 127 typedef int (* PFN_XFlush)(Display*); 128 typedef int (* PFN_XFree)(void*); 129 typedef int (* PFN_XFreeColormap)(Display*,Colormap); 130 typedef int (* PFN_XFreeCursor)(Display*,Cursor); 131 typedef void (* PFN_XFreeEventData)(Display*,XGenericEventCookie*); 132 typedef int (* PFN_XGetErrorText)(Display*,int,char*,int); 133 typedef Bool (* PFN_XGetEventData)(Display*,XGenericEventCookie*); 134 typedef char* (* PFN_XGetICValues)(XIC,...); 135 typedef char* (* PFN_XGetIMValues)(XIM,...); 136 typedef int (* PFN_XGetInputFocus)(Display*,Window*,int*); 137 typedef KeySym* (* PFN_XGetKeyboardMapping)(Display*,KeyCode,int,int*); 138 typedef int (* PFN_XGetScreenSaver)(Display*,int*,int*,int*,int*); 139 typedef Window (* PFN_XGetSelectionOwner)(Display*,Atom); 140 typedef XVisualInfo* (* PFN_XGetVisualInfo)(Display*,long,XVisualInfo*,int*); 141 typedef Status (* PFN_XGetWMNormalHints)(Display*,Window,XSizeHints*,long*); 142 typedef Status (* PFN_XGetWindowAttributes)(Display*,Window,XWindowAttributes*); 143 typedef int (* PFN_XGetWindowProperty)(Display*,Window,Atom,long,long,Bool,Atom,Atom*,int*,unsigned long*,unsigned long*,unsigned char**); 144 typedef int (* PFN_XGrabPointer)(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time); 145 typedef Status (* PFN_XIconifyWindow)(Display*,Window,int); 146 typedef Status (* PFN_XInitThreads)(void); 147 typedef Atom (* PFN_XInternAtom)(Display*,const char*,Bool); 148 typedef int (* PFN_XLookupString)(XKeyEvent*,char*,int,KeySym*,XComposeStatus*); 149 typedef int (* PFN_XMapRaised)(Display*,Window); 150 typedef int (* PFN_XMapWindow)(Display*,Window); 151 typedef int (* PFN_XMoveResizeWindow)(Display*,Window,int,int,unsigned int,unsigned int); 152 typedef int (* PFN_XMoveWindow)(Display*,Window,int,int); 153 typedef int (* PFN_XNextEvent)(Display*,XEvent*); 154 typedef Display* (* PFN_XOpenDisplay)(const char*); 155 typedef XIM (* PFN_XOpenIM)(Display*,XrmDatabase*,char*,char*); 156 typedef int (* PFN_XPeekEvent)(Display*,XEvent*); 157 typedef int (* PFN_XPending)(Display*); 158 typedef Bool (* PFN_XQueryExtension)(Display*,const char*,int*,int*,int*); 159 typedef Bool (* PFN_XQueryPointer)(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*); 160 typedef int (* PFN_XRaiseWindow)(Display*,Window); 161 typedef Bool (* PFN_XRegisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer); 162 typedef int (* PFN_XResizeWindow)(Display*,Window,unsigned int,unsigned int); 163 typedef char* (* PFN_XResourceManagerString)(Display*); 164 typedef int (* PFN_XSaveContext)(Display*,XID,XContext,const char*); 165 typedef int (* PFN_XSelectInput)(Display*,Window,long); 166 typedef Status (* PFN_XSendEvent)(Display*,Window,Bool,long,XEvent*); 167 typedef int (* PFN_XSetClassHint)(Display*,Window,XClassHint*); 168 typedef XErrorHandler (* PFN_XSetErrorHandler)(XErrorHandler); 169 typedef void (* PFN_XSetICFocus)(XIC); 170 typedef char* (* PFN_XSetIMValues)(XIM,...); 171 typedef int (* PFN_XSetInputFocus)(Display*,Window,int,Time); 172 typedef char* (* PFN_XSetLocaleModifiers)(const char*); 173 typedef int (* PFN_XSetScreenSaver)(Display*,int,int,int,int); 174 typedef int (* PFN_XSetSelectionOwner)(Display*,Atom,Window,Time); 175 typedef int (* PFN_XSetWMHints)(Display*,Window,XWMHints*); 176 typedef void (* PFN_XSetWMNormalHints)(Display*,Window,XSizeHints*); 177 typedef Status (* PFN_XSetWMProtocols)(Display*,Window,Atom*,int); 178 typedef Bool (* PFN_XSupportsLocale)(void); 179 typedef int (* PFN_XSync)(Display*,Bool); 180 typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*); 181 typedef int (* PFN_XUndefineCursor)(Display*,Window); 182 typedef int (* PFN_XUngrabPointer)(Display*,Time); 183 typedef int (* PFN_XUnmapWindow)(Display*,Window); 184 typedef void (* PFN_XUnsetICFocus)(XIC); 185 typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*); 186 typedef int (* PFN_XWarpPointer)(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int); 187 typedef void (* PFN_XkbFreeKeyboard)(XkbDescPtr,unsigned int,Bool); 188 typedef void (* PFN_XkbFreeNames)(XkbDescPtr,unsigned int,Bool); 189 typedef XkbDescPtr (* PFN_XkbGetMap)(Display*,unsigned int,unsigned int); 190 typedef Status (* PFN_XkbGetNames)(Display*,unsigned int,XkbDescPtr); 191 typedef Status (* PFN_XkbGetState)(Display*,unsigned int,XkbStatePtr); 192 typedef KeySym (* PFN_XkbKeycodeToKeysym)(Display*,KeyCode,int,int); 193 typedef Bool (* PFN_XkbQueryExtension)(Display*,int*,int*,int*,int*,int*); 194 typedef Bool (* PFN_XkbSelectEventDetails)(Display*,unsigned int,unsigned int,unsigned long,unsigned long); 195 typedef Bool (* PFN_XkbSetDetectableAutoRepeat)(Display*,Bool,Bool*); 196 typedef void (* PFN_XrmDestroyDatabase)(XrmDatabase); 197 typedef Bool (* PFN_XrmGetResource)(XrmDatabase,const char*,const char*,char**,XrmValue*); 198 typedef XrmDatabase (* PFN_XrmGetStringDatabase)(const char*); 199 typedef void (* PFN_XrmInitialize)(void); 200 typedef XrmQuark (* PFN_XrmUniqueQuark)(void); 201 typedef Bool (* PFN_XUnregisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer); 202 typedef int (* PFN_Xutf8LookupString)(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*); 203 typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char*,char**,int,XSizeHints*,XWMHints*,XClassHint*); 204 #define XAllocClassHint _glfw.x11.xlib.AllocClassHint 205 #define XAllocSizeHints _glfw.x11.xlib.AllocSizeHints 206 #define XAllocWMHints _glfw.x11.xlib.AllocWMHints 207 #define XChangeProperty _glfw.x11.xlib.ChangeProperty 208 #define XChangeWindowAttributes _glfw.x11.xlib.ChangeWindowAttributes 209 #define XCheckIfEvent _glfw.x11.xlib.CheckIfEvent 210 #define XCheckTypedWindowEvent _glfw.x11.xlib.CheckTypedWindowEvent 211 #define XCloseDisplay _glfw.x11.xlib.CloseDisplay 212 #define XCloseIM _glfw.x11.xlib.CloseIM 213 #define XConvertSelection _glfw.x11.xlib.ConvertSelection 214 #define XCreateColormap _glfw.x11.xlib.CreateColormap 215 #define XCreateFontCursor _glfw.x11.xlib.CreateFontCursor 216 #define XCreateIC _glfw.x11.xlib.CreateIC 217 #define XCreateRegion _glfw.x11.xlib.CreateRegion 218 #define XCreateWindow _glfw.x11.xlib.CreateWindow 219 #define XDefineCursor _glfw.x11.xlib.DefineCursor 220 #define XDeleteContext _glfw.x11.xlib.DeleteContext 221 #define XDeleteProperty _glfw.x11.xlib.DeleteProperty 222 #define XDestroyIC _glfw.x11.xlib.DestroyIC 223 #define XDestroyRegion _glfw.x11.xlib.DestroyRegion 224 #define XDestroyWindow _glfw.x11.xlib.DestroyWindow 225 #define XDisplayKeycodes _glfw.x11.xlib.DisplayKeycodes 226 #define XEventsQueued _glfw.x11.xlib.EventsQueued 227 #define XFilterEvent _glfw.x11.xlib.FilterEvent 228 #define XFindContext _glfw.x11.xlib.FindContext 229 #define XFlush _glfw.x11.xlib.Flush 230 #define XFree _glfw.x11.xlib.Free 231 #define XFreeColormap _glfw.x11.xlib.FreeColormap 232 #define XFreeCursor _glfw.x11.xlib.FreeCursor 233 #define XFreeEventData _glfw.x11.xlib.FreeEventData 234 #define XGetErrorText _glfw.x11.xlib.GetErrorText 235 #define XGetEventData _glfw.x11.xlib.GetEventData 236 #define XGetICValues _glfw.x11.xlib.GetICValues 237 #define XGetIMValues _glfw.x11.xlib.GetIMValues 238 #define XGetInputFocus _glfw.x11.xlib.GetInputFocus 239 #define XGetKeyboardMapping _glfw.x11.xlib.GetKeyboardMapping 240 #define XGetScreenSaver _glfw.x11.xlib.GetScreenSaver 241 #define XGetSelectionOwner _glfw.x11.xlib.GetSelectionOwner 242 #define XGetVisualInfo _glfw.x11.xlib.GetVisualInfo 243 #define XGetWMNormalHints _glfw.x11.xlib.GetWMNormalHints 244 #define XGetWindowAttributes _glfw.x11.xlib.GetWindowAttributes 245 #define XGetWindowProperty _glfw.x11.xlib.GetWindowProperty 246 #define XGrabPointer _glfw.x11.xlib.GrabPointer 247 #define XIconifyWindow _glfw.x11.xlib.IconifyWindow 248 #define XInternAtom _glfw.x11.xlib.InternAtom 249 #define XLookupString _glfw.x11.xlib.LookupString 250 #define XMapRaised _glfw.x11.xlib.MapRaised 251 #define XMapWindow _glfw.x11.xlib.MapWindow 252 #define XMoveResizeWindow _glfw.x11.xlib.MoveResizeWindow 253 #define XMoveWindow _glfw.x11.xlib.MoveWindow 254 #define XNextEvent _glfw.x11.xlib.NextEvent 255 #define XOpenIM _glfw.x11.xlib.OpenIM 256 #define XPeekEvent _glfw.x11.xlib.PeekEvent 257 #define XPending _glfw.x11.xlib.Pending 258 #define XQueryExtension _glfw.x11.xlib.QueryExtension 259 #define XQueryPointer _glfw.x11.xlib.QueryPointer 260 #define XRaiseWindow _glfw.x11.xlib.RaiseWindow 261 #define XRegisterIMInstantiateCallback _glfw.x11.xlib.RegisterIMInstantiateCallback 262 #define XResizeWindow _glfw.x11.xlib.ResizeWindow 263 #define XResourceManagerString _glfw.x11.xlib.ResourceManagerString 264 #define XSaveContext _glfw.x11.xlib.SaveContext 265 #define XSelectInput _glfw.x11.xlib.SelectInput 266 #define XSendEvent _glfw.x11.xlib.SendEvent 267 #define XSetClassHint _glfw.x11.xlib.SetClassHint 268 #define XSetErrorHandler _glfw.x11.xlib.SetErrorHandler 269 #define XSetICFocus _glfw.x11.xlib.SetICFocus 270 #define XSetIMValues _glfw.x11.xlib.SetIMValues 271 #define XSetInputFocus _glfw.x11.xlib.SetInputFocus 272 #define XSetLocaleModifiers _glfw.x11.xlib.SetLocaleModifiers 273 #define XSetScreenSaver _glfw.x11.xlib.SetScreenSaver 274 #define XSetSelectionOwner _glfw.x11.xlib.SetSelectionOwner 275 #define XSetWMHints _glfw.x11.xlib.SetWMHints 276 #define XSetWMNormalHints _glfw.x11.xlib.SetWMNormalHints 277 #define XSetWMProtocols _glfw.x11.xlib.SetWMProtocols 278 #define XSupportsLocale _glfw.x11.xlib.SupportsLocale 279 #define XSync _glfw.x11.xlib.Sync 280 #define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates 281 #define XUndefineCursor _glfw.x11.xlib.UndefineCursor 282 #define XUngrabPointer _glfw.x11.xlib.UngrabPointer 283 #define XUnmapWindow _glfw.x11.xlib.UnmapWindow 284 #define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus 285 #define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual 286 #define XWarpPointer _glfw.x11.xlib.WarpPointer 287 #define XkbFreeKeyboard _glfw.x11.xkb.FreeKeyboard 288 #define XkbFreeNames _glfw.x11.xkb.FreeNames 289 #define XkbGetMap _glfw.x11.xkb.GetMap 290 #define XkbGetNames _glfw.x11.xkb.GetNames 291 #define XkbGetState _glfw.x11.xkb.GetState 292 #define XkbKeycodeToKeysym _glfw.x11.xkb.KeycodeToKeysym 293 #define XkbQueryExtension _glfw.x11.xkb.QueryExtension 294 #define XkbSelectEventDetails _glfw.x11.xkb.SelectEventDetails 295 #define XkbSetDetectableAutoRepeat _glfw.x11.xkb.SetDetectableAutoRepeat 296 #define XrmDestroyDatabase _glfw.x11.xrm.DestroyDatabase 297 #define XrmGetResource _glfw.x11.xrm.GetResource 298 #define XrmGetStringDatabase _glfw.x11.xrm.GetStringDatabase 299 #define XrmUniqueQuark _glfw.x11.xrm.UniqueQuark 300 #define XUnregisterIMInstantiateCallback _glfw.x11.xlib.UnregisterIMInstantiateCallback 301 #define Xutf8LookupString _glfw.x11.xlib.utf8LookupString 302 #define Xutf8SetWMProperties _glfw.x11.xlib.utf8SetWMProperties 303 304 typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int); 305 typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*); 306 typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*); 307 typedef void (* PFN_XRRFreeOutputInfo)(XRROutputInfo*); 308 typedef void (* PFN_XRRFreeScreenResources)(XRRScreenResources*); 309 typedef XRRCrtcGamma* (* PFN_XRRGetCrtcGamma)(Display*,RRCrtc); 310 typedef int (* PFN_XRRGetCrtcGammaSize)(Display*,RRCrtc); 311 typedef XRRCrtcInfo* (* PFN_XRRGetCrtcInfo) (Display*,XRRScreenResources*,RRCrtc); 312 typedef XRROutputInfo* (* PFN_XRRGetOutputInfo)(Display*,XRRScreenResources*,RROutput); 313 typedef RROutput (* PFN_XRRGetOutputPrimary)(Display*,Window); 314 typedef XRRScreenResources* (* PFN_XRRGetScreenResourcesCurrent)(Display*,Window); 315 typedef Bool (* PFN_XRRQueryExtension)(Display*,int*,int*); 316 typedef Status (* PFN_XRRQueryVersion)(Display*,int*,int*); 317 typedef void (* PFN_XRRSelectInput)(Display*,Window,int); 318 typedef Status (* PFN_XRRSetCrtcConfig)(Display*,XRRScreenResources*,RRCrtc,Time,int,int,RRMode,Rotation,RROutput*,int); 319 typedef void (* PFN_XRRSetCrtcGamma)(Display*,RRCrtc,XRRCrtcGamma*); 320 typedef int (* PFN_XRRUpdateConfiguration)(XEvent*); 321 #define XRRAllocGamma _glfw.x11.randr.AllocGamma 322 #define XRRFreeCrtcInfo _glfw.x11.randr.FreeCrtcInfo 323 #define XRRFreeGamma _glfw.x11.randr.FreeGamma 324 #define XRRFreeOutputInfo _glfw.x11.randr.FreeOutputInfo 325 #define XRRFreeScreenResources _glfw.x11.randr.FreeScreenResources 326 #define XRRGetCrtcGamma _glfw.x11.randr.GetCrtcGamma 327 #define XRRGetCrtcGammaSize _glfw.x11.randr.GetCrtcGammaSize 328 #define XRRGetCrtcInfo _glfw.x11.randr.GetCrtcInfo 329 #define XRRGetOutputInfo _glfw.x11.randr.GetOutputInfo 330 #define XRRGetOutputPrimary _glfw.x11.randr.GetOutputPrimary 331 #define XRRGetScreenResourcesCurrent _glfw.x11.randr.GetScreenResourcesCurrent 332 #define XRRQueryExtension _glfw.x11.randr.QueryExtension 333 #define XRRQueryVersion _glfw.x11.randr.QueryVersion 334 #define XRRSelectInput _glfw.x11.randr.SelectInput 335 #define XRRSetCrtcConfig _glfw.x11.randr.SetCrtcConfig 336 #define XRRSetCrtcGamma _glfw.x11.randr.SetCrtcGamma 337 #define XRRUpdateConfiguration _glfw.x11.randr.UpdateConfiguration 338 339 typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int); 340 typedef void (* PFN_XcursorImageDestroy)(XcursorImage*); 341 typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*); 342 typedef char* (* PFN_XcursorGetTheme)(Display*); 343 typedef int (* PFN_XcursorGetDefaultSize)(Display*); 344 typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int); 345 #define XcursorImageCreate _glfw.x11.xcursor.ImageCreate 346 #define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy 347 #define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor 348 #define XcursorGetTheme _glfw.x11.xcursor.GetTheme 349 #define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize 350 #define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage 351 352 typedef Bool (* PFN_XineramaIsActive)(Display*); 353 typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*); 354 typedef XineramaScreenInfo* (* PFN_XineramaQueryScreens)(Display*,int*); 355 #define XineramaIsActive _glfw.x11.xinerama.IsActive 356 #define XineramaQueryExtension _glfw.x11.xinerama.QueryExtension 357 #define XineramaQueryScreens _glfw.x11.xinerama.QueryScreens 358 359 typedef XID xcb_window_t; 360 typedef XID xcb_visualid_t; 361 typedef struct xcb_connection_t xcb_connection_t; 362 typedef xcb_connection_t* (* PFN_XGetXCBConnection)(Display*); 363 #define XGetXCBConnection _glfw.x11.x11xcb.GetXCBConnection 364 365 typedef Bool (* PFN_XF86VidModeQueryExtension)(Display*,int*,int*); 366 typedef Bool (* PFN_XF86VidModeGetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*); 367 typedef Bool (* PFN_XF86VidModeSetGammaRamp)(Display*,int,int,unsigned short*,unsigned short*,unsigned short*); 368 typedef Bool (* PFN_XF86VidModeGetGammaRampSize)(Display*,int,int*); 369 #define XF86VidModeQueryExtension _glfw.x11.vidmode.QueryExtension 370 #define XF86VidModeGetGammaRamp _glfw.x11.vidmode.GetGammaRamp 371 #define XF86VidModeSetGammaRamp _glfw.x11.vidmode.SetGammaRamp 372 #define XF86VidModeGetGammaRampSize _glfw.x11.vidmode.GetGammaRampSize 373 374 typedef Status (* PFN_XIQueryVersion)(Display*,int*,int*); 375 #ifndef USE_DUMMPY_XINPUT2 376 typedef int (* PFN_XISelectEvents)(Display*,Window,XIEventMask*,int); 377 #endif 378 #define XIQueryVersion _glfw.x11.xi.QueryVersion 379 #ifndef USE_DUMMPY_XINPUT2 380 #define XISelectEvents _glfw.x11.xi.SelectEvents 381 #endif 382 383 typedef Bool (* PFN_XRenderQueryExtension)(Display*,int*,int*); 384 typedef Status (* PFN_XRenderQueryVersion)(Display*dpy,int*,int*); 385 typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const*); 386 #define XRenderQueryExtension _glfw.x11.xrender.QueryExtension 387 #define XRenderQueryVersion _glfw.x11.xrender.QueryVersion 388 #define XRenderFindVisualFormat _glfw.x11.xrender.FindVisualFormat 389 390 typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*); 391 typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*); 392 typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int); 393 typedef void (* PFN_XShapeCombineMask)(Display*,Window,int,int,int,Pixmap,int); 394 395 #define XShapeQueryExtension _glfw.x11.xshape.QueryExtension 396 #define XShapeQueryVersion _glfw.x11.xshape.QueryVersion 397 #define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion 398 #define XShapeCombineMask _glfw.x11.xshape.ShapeCombineMask 399 400 typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*); 401 typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int); 402 typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*); 403 typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*); 404 typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext); 405 typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext); 406 typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable); 407 typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int); 408 typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*); 409 typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool); 410 typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName); 411 typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int); 412 typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig); 413 typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*); 414 typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow); 415 416 typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); 417 typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int); 418 typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*); 419 420 // libGL.so function pointer typedefs 421 #define glXGetFBConfigs _glfw.glx.GetFBConfigs 422 #define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib 423 #define glXGetClientString _glfw.glx.GetClientString 424 #define glXQueryExtension _glfw.glx.QueryExtension 425 #define glXQueryVersion _glfw.glx.QueryVersion 426 #define glXDestroyContext _glfw.glx.DestroyContext 427 #define glXMakeCurrent _glfw.glx.MakeCurrent 428 #define glXSwapBuffers _glfw.glx.SwapBuffers 429 #define glXQueryExtensionsString _glfw.glx.QueryExtensionsString 430 #define glXCreateNewContext _glfw.glx.CreateNewContext 431 #define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig 432 #define glXCreateWindow _glfw.glx.CreateWindow 433 #define glXDestroyWindow _glfw.glx.DestroyWindow 434 435 typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 436 typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 437 438 typedef struct VkXlibSurfaceCreateInfoKHR 439 { 440 VkStructureType sType; 441 const void* pNext; 442 VkXlibSurfaceCreateFlagsKHR flags; 443 Display* dpy; 444 Window window; 445 } VkXlibSurfaceCreateInfoKHR; 446 447 typedef struct VkXcbSurfaceCreateInfoKHR 448 { 449 VkStructureType sType; 450 const void* pNext; 451 VkXcbSurfaceCreateFlagsKHR flags; 452 xcb_connection_t* connection; 453 xcb_window_t window; 454 } VkXcbSurfaceCreateInfoKHR; 455 456 typedef VkResult (APIENTRY *PFN_vkCreateXlibSurfaceKHR)(VkInstance,const VkXlibSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); 457 typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice,uint32_t,Display*,VisualID); 458 typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); 459 typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t); 460 461 #include "xkb_unicode.h" 462 #include "posix_poll.h" 463 464 #define GLFW_X11_WINDOW_STATE _GLFWwindowX11 x11; 465 #define GLFW_X11_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11; 466 #define GLFW_X11_MONITOR_STATE _GLFWmonitorX11 x11; 467 #define GLFW_X11_CURSOR_STATE _GLFWcursorX11 x11; 468 469 #define GLFW_GLX_CONTEXT_STATE _GLFWcontextGLX glx; 470 #define GLFW_GLX_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx; 471 472 473 // GLX-specific per-context data 474 // 475 typedef struct _GLFWcontextGLX 476 { 477 GLXContext handle; 478 GLXWindow window; 479 } _GLFWcontextGLX; 480 481 // GLX-specific global data 482 // 483 typedef struct _GLFWlibraryGLX 484 { 485 int major, minor; 486 int eventBase; 487 int errorBase; 488 489 void* handle; 490 491 // GLX 1.3 functions 492 PFNGLXGETFBCONFIGSPROC GetFBConfigs; 493 PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib; 494 PFNGLXGETCLIENTSTRINGPROC GetClientString; 495 PFNGLXQUERYEXTENSIONPROC QueryExtension; 496 PFNGLXQUERYVERSIONPROC QueryVersion; 497 PFNGLXDESTROYCONTEXTPROC DestroyContext; 498 PFNGLXMAKECURRENTPROC MakeCurrent; 499 PFNGLXSWAPBUFFERSPROC SwapBuffers; 500 PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString; 501 PFNGLXCREATENEWCONTEXTPROC CreateNewContext; 502 PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig; 503 PFNGLXCREATEWINDOWPROC CreateWindow; 504 PFNGLXDESTROYWINDOWPROC DestroyWindow; 505 506 // GLX 1.4 and extension functions 507 PFNGLXGETPROCADDRESSPROC GetProcAddress; 508 PFNGLXGETPROCADDRESSPROC GetProcAddressARB; 509 PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; 510 PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; 511 PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; 512 PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; 513 GLFWbool SGI_swap_control; 514 GLFWbool EXT_swap_control; 515 GLFWbool MESA_swap_control; 516 GLFWbool ARB_multisample; 517 GLFWbool ARB_framebuffer_sRGB; 518 GLFWbool EXT_framebuffer_sRGB; 519 GLFWbool ARB_create_context; 520 GLFWbool ARB_create_context_profile; 521 GLFWbool ARB_create_context_robustness; 522 GLFWbool EXT_create_context_es2_profile; 523 GLFWbool ARB_create_context_no_error; 524 GLFWbool ARB_context_flush_control; 525 } _GLFWlibraryGLX; 526 527 // X11-specific per-window data 528 // 529 typedef struct _GLFWwindowX11 530 { 531 Colormap colormap; 532 Window handle; 533 Window parent; 534 XIC ic; 535 536 GLFWbool overrideRedirect; 537 GLFWbool iconified; 538 GLFWbool maximized; 539 540 // Whether the visual supports framebuffer transparency 541 GLFWbool transparent; 542 543 // Cached position and size used to filter out duplicate events 544 int width, height; 545 int xpos, ypos; 546 547 // The last received cursor position, regardless of source 548 int lastCursorPosX, lastCursorPosY; 549 // The last position the cursor was warped to by GLFW 550 int warpCursorPosX, warpCursorPosY; 551 552 // The time of the last KeyPress event per keycode, for discarding 553 // duplicate key events generated for some keys by ibus 554 Time keyPressTimes[256]; 555 } _GLFWwindowX11; 556 557 // X11-specific global data 558 // 559 typedef struct _GLFWlibraryX11 560 { 561 Display* display; 562 int screen; 563 Window root; 564 565 // System content scale 566 float contentScaleX, contentScaleY; 567 // Helper window for IPC 568 Window helperWindowHandle; 569 // Invisible cursor for hidden cursor mode 570 Cursor hiddenCursorHandle; 571 // Context for mapping window XIDs to _GLFWwindow pointers 572 XContext context; 573 // XIM input method 574 XIM im; 575 // The previous X error handler, to be restored later 576 XErrorHandler errorHandler; 577 // Most recent error code received by X error handler 578 int errorCode; 579 // Primary selection string (while the primary selection is owned) 580 char* primarySelectionString; 581 // Clipboard string (while the selection is owned) 582 char* clipboardString; 583 // Key name string 584 char keynames[GLFW_KEY_LAST + 1][5]; 585 // X11 keycode to GLFW key LUT 586 short int keycodes[256]; 587 // GLFW key to X11 keycode LUT 588 short int scancodes[GLFW_KEY_LAST + 1]; 589 // Where to place the cursor when re-enabled 590 double restoreCursorPosX, restoreCursorPosY; 591 // The window whose disabled cursor mode is active 592 _GLFWwindow* disabledCursorWindow; 593 int emptyEventPipe[2]; 594 595 // Window manager atoms 596 Atom NET_SUPPORTED; 597 Atom NET_SUPPORTING_WM_CHECK; 598 Atom WM_PROTOCOLS; 599 Atom WM_STATE; 600 Atom WM_DELETE_WINDOW; 601 Atom NET_WM_NAME; 602 Atom NET_WM_ICON_NAME; 603 Atom NET_WM_ICON; 604 Atom NET_WM_PID; 605 Atom NET_WM_PING; 606 Atom NET_WM_WINDOW_TYPE; 607 Atom NET_WM_WINDOW_TYPE_NORMAL; 608 Atom NET_WM_STATE; 609 Atom NET_WM_STATE_ABOVE; 610 Atom NET_WM_STATE_FULLSCREEN; 611 Atom NET_WM_STATE_MAXIMIZED_VERT; 612 Atom NET_WM_STATE_MAXIMIZED_HORZ; 613 Atom NET_WM_STATE_DEMANDS_ATTENTION; 614 Atom NET_WM_BYPASS_COMPOSITOR; 615 Atom NET_WM_FULLSCREEN_MONITORS; 616 Atom NET_WM_WINDOW_OPACITY; 617 Atom NET_WM_CM_Sx; 618 Atom NET_WORKAREA; 619 Atom NET_CURRENT_DESKTOP; 620 Atom NET_ACTIVE_WINDOW; 621 Atom NET_FRAME_EXTENTS; 622 Atom NET_REQUEST_FRAME_EXTENTS; 623 Atom MOTIF_WM_HINTS; 624 625 // Xdnd (drag and drop) atoms 626 Atom XdndAware; 627 Atom XdndEnter; 628 Atom XdndPosition; 629 Atom XdndStatus; 630 Atom XdndActionCopy; 631 Atom XdndDrop; 632 Atom XdndFinished; 633 Atom XdndSelection; 634 Atom XdndTypeList; 635 Atom text_uri_list; 636 637 // Selection (clipboard) atoms 638 Atom TARGETS; 639 Atom MULTIPLE; 640 Atom INCR; 641 Atom CLIPBOARD; 642 Atom PRIMARY; 643 Atom CLIPBOARD_MANAGER; 644 Atom SAVE_TARGETS; 645 Atom NULL_; 646 Atom UTF8_STRING; 647 Atom COMPOUND_STRING; 648 Atom ATOM_PAIR; 649 Atom GLFW_SELECTION; 650 651 struct { 652 void* handle; 653 GLFWbool utf8; 654 PFN_XAllocClassHint AllocClassHint; 655 PFN_XAllocSizeHints AllocSizeHints; 656 PFN_XAllocWMHints AllocWMHints; 657 PFN_XChangeProperty ChangeProperty; 658 PFN_XChangeWindowAttributes ChangeWindowAttributes; 659 PFN_XCheckIfEvent CheckIfEvent; 660 PFN_XCheckTypedWindowEvent CheckTypedWindowEvent; 661 PFN_XCloseDisplay CloseDisplay; 662 PFN_XCloseIM CloseIM; 663 PFN_XConvertSelection ConvertSelection; 664 PFN_XCreateColormap CreateColormap; 665 PFN_XCreateFontCursor CreateFontCursor; 666 PFN_XCreateIC CreateIC; 667 PFN_XCreateRegion CreateRegion; 668 PFN_XCreateWindow CreateWindow; 669 PFN_XDefineCursor DefineCursor; 670 PFN_XDeleteContext DeleteContext; 671 PFN_XDeleteProperty DeleteProperty; 672 PFN_XDestroyIC DestroyIC; 673 PFN_XDestroyRegion DestroyRegion; 674 PFN_XDestroyWindow DestroyWindow; 675 PFN_XDisplayKeycodes DisplayKeycodes; 676 PFN_XEventsQueued EventsQueued; 677 PFN_XFilterEvent FilterEvent; 678 PFN_XFindContext FindContext; 679 PFN_XFlush Flush; 680 PFN_XFree Free; 681 PFN_XFreeColormap FreeColormap; 682 PFN_XFreeCursor FreeCursor; 683 PFN_XFreeEventData FreeEventData; 684 PFN_XGetErrorText GetErrorText; 685 PFN_XGetEventData GetEventData; 686 PFN_XGetICValues GetICValues; 687 PFN_XGetIMValues GetIMValues; 688 PFN_XGetInputFocus GetInputFocus; 689 PFN_XGetKeyboardMapping GetKeyboardMapping; 690 PFN_XGetScreenSaver GetScreenSaver; 691 PFN_XGetSelectionOwner GetSelectionOwner; 692 PFN_XGetVisualInfo GetVisualInfo; 693 PFN_XGetWMNormalHints GetWMNormalHints; 694 PFN_XGetWindowAttributes GetWindowAttributes; 695 PFN_XGetWindowProperty GetWindowProperty; 696 PFN_XGrabPointer GrabPointer; 697 PFN_XIconifyWindow IconifyWindow; 698 PFN_XInternAtom InternAtom; 699 PFN_XLookupString LookupString; 700 PFN_XMapRaised MapRaised; 701 PFN_XMapWindow MapWindow; 702 PFN_XMoveResizeWindow MoveResizeWindow; 703 PFN_XMoveWindow MoveWindow; 704 PFN_XNextEvent NextEvent; 705 PFN_XOpenIM OpenIM; 706 PFN_XPeekEvent PeekEvent; 707 PFN_XPending Pending; 708 PFN_XQueryExtension QueryExtension; 709 PFN_XQueryPointer QueryPointer; 710 PFN_XRaiseWindow RaiseWindow; 711 PFN_XRegisterIMInstantiateCallback RegisterIMInstantiateCallback; 712 PFN_XResizeWindow ResizeWindow; 713 PFN_XResourceManagerString ResourceManagerString; 714 PFN_XSaveContext SaveContext; 715 PFN_XSelectInput SelectInput; 716 PFN_XSendEvent SendEvent; 717 PFN_XSetClassHint SetClassHint; 718 PFN_XSetErrorHandler SetErrorHandler; 719 PFN_XSetICFocus SetICFocus; 720 PFN_XSetIMValues SetIMValues; 721 PFN_XSetInputFocus SetInputFocus; 722 PFN_XSetLocaleModifiers SetLocaleModifiers; 723 PFN_XSetScreenSaver SetScreenSaver; 724 PFN_XSetSelectionOwner SetSelectionOwner; 725 PFN_XSetWMHints SetWMHints; 726 PFN_XSetWMNormalHints SetWMNormalHints; 727 PFN_XSetWMProtocols SetWMProtocols; 728 PFN_XSupportsLocale SupportsLocale; 729 PFN_XSync Sync; 730 PFN_XTranslateCoordinates TranslateCoordinates; 731 PFN_XUndefineCursor UndefineCursor; 732 PFN_XUngrabPointer UngrabPointer; 733 PFN_XUnmapWindow UnmapWindow; 734 PFN_XUnsetICFocus UnsetICFocus; 735 PFN_XVisualIDFromVisual VisualIDFromVisual; 736 PFN_XWarpPointer WarpPointer; 737 PFN_XUnregisterIMInstantiateCallback UnregisterIMInstantiateCallback; 738 PFN_Xutf8LookupString utf8LookupString; 739 PFN_Xutf8SetWMProperties utf8SetWMProperties; 740 } xlib; 741 742 struct { 743 PFN_XrmDestroyDatabase DestroyDatabase; 744 PFN_XrmGetResource GetResource; 745 PFN_XrmGetStringDatabase GetStringDatabase; 746 PFN_XrmUniqueQuark UniqueQuark; 747 } xrm; 748 749 struct { 750 GLFWbool available; 751 void* handle; 752 int eventBase; 753 int errorBase; 754 int major; 755 int minor; 756 GLFWbool gammaBroken; 757 GLFWbool monitorBroken; 758 PFN_XRRAllocGamma AllocGamma; 759 PFN_XRRFreeCrtcInfo FreeCrtcInfo; 760 PFN_XRRFreeGamma FreeGamma; 761 PFN_XRRFreeOutputInfo FreeOutputInfo; 762 PFN_XRRFreeScreenResources FreeScreenResources; 763 PFN_XRRGetCrtcGamma GetCrtcGamma; 764 PFN_XRRGetCrtcGammaSize GetCrtcGammaSize; 765 PFN_XRRGetCrtcInfo GetCrtcInfo; 766 PFN_XRRGetOutputInfo GetOutputInfo; 767 PFN_XRRGetOutputPrimary GetOutputPrimary; 768 PFN_XRRGetScreenResourcesCurrent GetScreenResourcesCurrent; 769 PFN_XRRQueryExtension QueryExtension; 770 PFN_XRRQueryVersion QueryVersion; 771 PFN_XRRSelectInput SelectInput; 772 PFN_XRRSetCrtcConfig SetCrtcConfig; 773 PFN_XRRSetCrtcGamma SetCrtcGamma; 774 PFN_XRRUpdateConfiguration UpdateConfiguration; 775 } randr; 776 777 struct { 778 GLFWbool available; 779 GLFWbool detectable; 780 int majorOpcode; 781 int eventBase; 782 int errorBase; 783 int major; 784 int minor; 785 unsigned int group; 786 PFN_XkbFreeKeyboard FreeKeyboard; 787 PFN_XkbFreeNames FreeNames; 788 PFN_XkbGetMap GetMap; 789 PFN_XkbGetNames GetNames; 790 PFN_XkbGetState GetState; 791 PFN_XkbKeycodeToKeysym KeycodeToKeysym; 792 PFN_XkbQueryExtension QueryExtension; 793 PFN_XkbSelectEventDetails SelectEventDetails; 794 PFN_XkbSetDetectableAutoRepeat SetDetectableAutoRepeat; 795 } xkb; 796 797 struct { 798 int count; 799 int timeout; 800 int interval; 801 int blanking; 802 int exposure; 803 } saver; 804 805 struct { 806 int version; 807 Window source; 808 Atom format; 809 } xdnd; 810 811 struct { 812 void* handle; 813 PFN_XcursorImageCreate ImageCreate; 814 PFN_XcursorImageDestroy ImageDestroy; 815 PFN_XcursorImageLoadCursor ImageLoadCursor; 816 PFN_XcursorGetTheme GetTheme; 817 PFN_XcursorGetDefaultSize GetDefaultSize; 818 PFN_XcursorLibraryLoadImage LibraryLoadImage; 819 } xcursor; 820 821 struct { 822 GLFWbool available; 823 void* handle; 824 int major; 825 int minor; 826 PFN_XineramaIsActive IsActive; 827 PFN_XineramaQueryExtension QueryExtension; 828 PFN_XineramaQueryScreens QueryScreens; 829 } xinerama; 830 831 struct { 832 void* handle; 833 PFN_XGetXCBConnection GetXCBConnection; 834 } x11xcb; 835 836 struct { 837 GLFWbool available; 838 void* handle; 839 int eventBase; 840 int errorBase; 841 PFN_XF86VidModeQueryExtension QueryExtension; 842 PFN_XF86VidModeGetGammaRamp GetGammaRamp; 843 PFN_XF86VidModeSetGammaRamp SetGammaRamp; 844 PFN_XF86VidModeGetGammaRampSize GetGammaRampSize; 845 } vidmode; 846 847 struct { 848 GLFWbool available; 849 void* handle; 850 int majorOpcode; 851 int eventBase; 852 int errorBase; 853 int major; 854 int minor; 855 PFN_XIQueryVersion QueryVersion; 856 #ifndef USE_DUMMPY_XINPUT2 857 PFN_XISelectEvents SelectEvents; 858 #endif 859 } xi; 860 861 struct { 862 GLFWbool available; 863 void* handle; 864 int major; 865 int minor; 866 int eventBase; 867 int errorBase; 868 PFN_XRenderQueryExtension QueryExtension; 869 PFN_XRenderQueryVersion QueryVersion; 870 PFN_XRenderFindVisualFormat FindVisualFormat; 871 } xrender; 872 873 struct { 874 GLFWbool available; 875 void* handle; 876 int major; 877 int minor; 878 int eventBase; 879 int errorBase; 880 PFN_XShapeQueryExtension QueryExtension; 881 PFN_XShapeCombineRegion ShapeCombineRegion; 882 PFN_XShapeQueryVersion QueryVersion; 883 PFN_XShapeCombineMask ShapeCombineMask; 884 } xshape; 885 } _GLFWlibraryX11; 886 887 // X11-specific per-monitor data 888 // 889 typedef struct _GLFWmonitorX11 890 { 891 RROutput output; 892 RRCrtc crtc; 893 RRMode oldMode; 894 895 // Index of corresponding Xinerama screen, 896 // for EWMH full screen window placement 897 int index; 898 } _GLFWmonitorX11; 899 900 // X11-specific per-cursor data 901 // 902 typedef struct _GLFWcursorX11 903 { 904 Cursor handle; 905 } _GLFWcursorX11; 906 907 908 GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform); 909 int _glfwInitX11(void); 910 void _glfwTerminateX11(void); 911 912 GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); 913 void _glfwDestroyWindowX11(_GLFWwindow* window); 914 void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title); 915 void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images); 916 void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos); 917 void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos); 918 void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height); 919 void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height); 920 void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); 921 void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom); 922 void _glfwGetFramebufferSizeX11(_GLFWwindow* window, int* width, int* height); 923 void _glfwGetWindowFrameSizeX11(_GLFWwindow* window, int* left, int* top, int* right, int* bottom); 924 void _glfwGetWindowContentScaleX11(_GLFWwindow* window, float* xscale, float* yscale); 925 void _glfwIconifyWindowX11(_GLFWwindow* window); 926 void _glfwRestoreWindowX11(_GLFWwindow* window); 927 void _glfwMaximizeWindowX11(_GLFWwindow* window); 928 void _glfwShowWindowX11(_GLFWwindow* window); 929 void _glfwHideWindowX11(_GLFWwindow* window); 930 void _glfwRequestWindowAttentionX11(_GLFWwindow* window); 931 void _glfwFocusWindowX11(_GLFWwindow* window); 932 void _glfwSetWindowMonitorX11(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); 933 GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window); 934 GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window); 935 GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window); 936 GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window); 937 GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window); 938 GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window); 939 void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled); 940 void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled); 941 void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled); 942 float _glfwGetWindowOpacityX11(_GLFWwindow* window); 943 void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity); 944 void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled); 945 946 void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled); 947 GLFWbool _glfwRawMouseMotionSupportedX11(void); 948 949 void _glfwPollEventsX11(void); 950 void _glfwWaitEventsX11(void); 951 void _glfwWaitEventsTimeoutX11(double timeout); 952 void _glfwPostEmptyEventX11(void); 953 954 void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos); 955 void _glfwSetCursorPosX11(_GLFWwindow* window, double xpos, double ypos); 956 void _glfwSetCursorModeX11(_GLFWwindow* window, int mode); 957 const char* _glfwGetScancodeNameX11(int scancode); 958 int _glfwGetKeyScancodeX11(int key); 959 GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); 960 GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape); 961 void _glfwDestroyCursorX11(_GLFWcursor* cursor); 962 void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor); 963 void _glfwSetClipboardStringX11(const char* string); 964 const char* _glfwGetClipboardStringX11(void); 965 966 EGLenum _glfwGetEGLPlatformX11(EGLint** attribs); 967 EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void); 968 EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window); 969 970 void _glfwGetRequiredInstanceExtensionsX11(char** extensions); 971 GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); 972 VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); 973 974 void _glfwFreeMonitorX11(_GLFWmonitor* monitor); 975 void _glfwGetMonitorPosX11(_GLFWmonitor* monitor, int* xpos, int* ypos); 976 void _glfwGetMonitorContentScaleX11(_GLFWmonitor* monitor, float* xscale, float* yscale); 977 void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); 978 GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count); 979 GLFWbool _glfwGetVideoModeX11(_GLFWmonitor* monitor, GLFWvidmode* mode); 980 GLFWbool _glfwGetGammaRampX11(_GLFWmonitor* monitor, GLFWgammaramp* ramp); 981 void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); 982 983 void _glfwPollMonitorsX11(void); 984 void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired); 985 void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor); 986 987 Cursor _glfwCreateNativeCursorX11(const GLFWimage* image, int xhot, int yhot); 988 989 unsigned long _glfwGetWindowPropertyX11(Window window, 990 Atom property, 991 Atom type, 992 unsigned char** value); 993 GLFWbool _glfwIsVisualTransparentX11(Visual* visual); 994 995 void _glfwGrabErrorHandlerX11(void); 996 void _glfwReleaseErrorHandlerX11(void); 997 void _glfwInputErrorX11(int error, const char* message); 998 999 void _glfwPushSelectionToManagerX11(void); 1000 void _glfwCreateInputContextX11(_GLFWwindow* window); 1001 1002 GLFWbool _glfwInitGLX(void); 1003 void _glfwTerminateGLX(void); 1004 GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, 1005 const _GLFWctxconfig* ctxconfig, 1006 const _GLFWfbconfig* fbconfig); 1007 void _glfwDestroyContextGLX(_GLFWwindow* window); 1008 GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, 1009 const _GLFWctxconfig* ctxconfig, 1010 const _GLFWfbconfig* fbconfig, 1011 Visual** visual, int* depth); 1012 1013