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