master
ブランチ master
Tetris / deps / raylib / src / external / glfw / src / x11_platform.h
43.7 KB、1004行 生 Blame 履歴
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 <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#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#include "posix_poll.h"
457
458#define GLFW_X11_WINDOW_STATE _GLFWwindowX11 x11;
459#define GLFW_X11_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11;
460#define GLFW_X11_MONITOR_STATE _GLFWmonitorX11 x11;
461#define GLFW_X11_CURSOR_STATE _GLFWcursorX11 x11;
462
463#define GLFW_GLX_CONTEXT_STATE _GLFWcontextGLX glx;
464#define GLFW_GLX_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx;
465
466
467// GLX-specific per-context data
468//
469typedef struct _GLFWcontextGLX
470{
471 GLXContext handle;
472 GLXWindow window;
473} _GLFWcontextGLX;
474
475// GLX-specific global data
476//
477typedef struct _GLFWlibraryGLX
478{
479 int major, minor;
480 int eventBase;
481 int errorBase;
482
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 // The previous X error handler, to be restored later
570 XErrorHandler errorHandler;
571 // Most recent error code received by X error handler
572 int errorCode;
573 // Primary selection string (while the primary selection is owned)
574 char* primarySelectionString;
575 // Clipboard string (while the selection is owned)
576 char* clipboardString;
577 // Key name string
578 char keynames[GLFW_KEY_LAST + 1][5];
579 // X11 keycode to GLFW key LUT
580 short int keycodes[256];
581 // GLFW key to X11 keycode LUT
582 short int scancodes[GLFW_KEY_LAST + 1];
583 // Where to place the cursor when re-enabled
584 double restoreCursorPosX, restoreCursorPosY;
585 // The window whose disabled cursor mode is active
586 _GLFWwindow* disabledCursorWindow;
587 int emptyEventPipe[2];
588
589 // Window manager atoms
590 Atom NET_SUPPORTED;
591 Atom NET_SUPPORTING_WM_CHECK;
592 Atom WM_PROTOCOLS;
593 Atom WM_STATE;
594 Atom WM_DELETE_WINDOW;
595 Atom NET_WM_NAME;
596 Atom NET_WM_ICON_NAME;
597 Atom NET_WM_ICON;
598 Atom NET_WM_PID;
599 Atom NET_WM_PING;
600 Atom NET_WM_WINDOW_TYPE;
601 Atom NET_WM_WINDOW_TYPE_NORMAL;
602 Atom NET_WM_STATE;
603 Atom NET_WM_STATE_ABOVE;
604 Atom NET_WM_STATE_FULLSCREEN;
605 Atom NET_WM_STATE_MAXIMIZED_VERT;
606 Atom NET_WM_STATE_MAXIMIZED_HORZ;
607 Atom NET_WM_STATE_DEMANDS_ATTENTION;
608 Atom NET_WM_BYPASS_COMPOSITOR;
609 Atom NET_WM_FULLSCREEN_MONITORS;
610 Atom NET_WM_WINDOW_OPACITY;
611 Atom NET_WM_CM_Sx;
612 Atom NET_WORKAREA;
613 Atom NET_CURRENT_DESKTOP;
614 Atom NET_ACTIVE_WINDOW;
615 Atom NET_FRAME_EXTENTS;
616 Atom NET_REQUEST_FRAME_EXTENTS;
617 Atom MOTIF_WM_HINTS;
618
619 // Xdnd (drag and drop) atoms
620 Atom XdndAware;
621 Atom XdndEnter;
622 Atom XdndPosition;
623 Atom XdndStatus;
624 Atom XdndActionCopy;
625 Atom XdndDrop;
626 Atom XdndFinished;
627 Atom XdndSelection;
628 Atom XdndTypeList;
629 Atom text_uri_list;
630
631 // Selection (clipboard) atoms
632 Atom TARGETS;
633 Atom MULTIPLE;
634 Atom INCR;
635 Atom CLIPBOARD;
636 Atom PRIMARY;
637 Atom CLIPBOARD_MANAGER;
638 Atom SAVE_TARGETS;
639 Atom NULL_;
640 Atom UTF8_STRING;
641 Atom COMPOUND_STRING;
642 Atom ATOM_PAIR;
643 Atom GLFW_SELECTION;
644
645 struct {
646 void* handle;
647 GLFWbool utf8;
648 PFN_XAllocClassHint AllocClassHint;
649 PFN_XAllocSizeHints AllocSizeHints;
650 PFN_XAllocWMHints AllocWMHints;
651 PFN_XChangeProperty ChangeProperty;
652 PFN_XChangeWindowAttributes ChangeWindowAttributes;
653 PFN_XCheckIfEvent CheckIfEvent;
654 PFN_XCheckTypedWindowEvent CheckTypedWindowEvent;
655 PFN_XCloseDisplay CloseDisplay;
656 PFN_XCloseIM CloseIM;
657 PFN_XConvertSelection ConvertSelection;
658 PFN_XCreateColormap CreateColormap;
659 PFN_XCreateFontCursor CreateFontCursor;
660 PFN_XCreateIC CreateIC;
661 PFN_XCreateRegion CreateRegion;
662 PFN_XCreateWindow CreateWindow;
663 PFN_XDefineCursor DefineCursor;
664 PFN_XDeleteContext DeleteContext;
665 PFN_XDeleteProperty DeleteProperty;
666 PFN_XDestroyIC DestroyIC;
667 PFN_XDestroyRegion DestroyRegion;
668 PFN_XDestroyWindow DestroyWindow;
669 PFN_XDisplayKeycodes DisplayKeycodes;
670 PFN_XEventsQueued EventsQueued;
671 PFN_XFilterEvent FilterEvent;
672 PFN_XFindContext FindContext;
673 PFN_XFlush Flush;
674 PFN_XFree Free;
675 PFN_XFreeColormap FreeColormap;
676 PFN_XFreeCursor FreeCursor;
677 PFN_XFreeEventData FreeEventData;
678 PFN_XGetErrorText GetErrorText;
679 PFN_XGetEventData GetEventData;
680 PFN_XGetICValues GetICValues;
681 PFN_XGetIMValues GetIMValues;
682 PFN_XGetInputFocus GetInputFocus;
683 PFN_XGetKeyboardMapping GetKeyboardMapping;
684 PFN_XGetScreenSaver GetScreenSaver;
685 PFN_XGetSelectionOwner GetSelectionOwner;
686 PFN_XGetVisualInfo GetVisualInfo;
687 PFN_XGetWMNormalHints GetWMNormalHints;
688 PFN_XGetWindowAttributes GetWindowAttributes;
689 PFN_XGetWindowProperty GetWindowProperty;
690 PFN_XGrabPointer GrabPointer;
691 PFN_XIconifyWindow IconifyWindow;
692 PFN_XInternAtom InternAtom;
693 PFN_XLookupString LookupString;
694 PFN_XMapRaised MapRaised;
695 PFN_XMapWindow MapWindow;
696 PFN_XMoveResizeWindow MoveResizeWindow;
697 PFN_XMoveWindow MoveWindow;
698 PFN_XNextEvent NextEvent;
699 PFN_XOpenIM OpenIM;
700 PFN_XPeekEvent PeekEvent;
701 PFN_XPending Pending;
702 PFN_XQueryExtension QueryExtension;
703 PFN_XQueryPointer QueryPointer;
704 PFN_XRaiseWindow RaiseWindow;
705 PFN_XRegisterIMInstantiateCallback RegisterIMInstantiateCallback;
706 PFN_XResizeWindow ResizeWindow;
707 PFN_XResourceManagerString ResourceManagerString;
708 PFN_XSaveContext SaveContext;
709 PFN_XSelectInput SelectInput;
710 PFN_XSendEvent SendEvent;
711 PFN_XSetClassHint SetClassHint;
712 PFN_XSetErrorHandler SetErrorHandler;
713 PFN_XSetICFocus SetICFocus;
714 PFN_XSetIMValues SetIMValues;
715 PFN_XSetInputFocus SetInputFocus;
716 PFN_XSetLocaleModifiers SetLocaleModifiers;
717 PFN_XSetScreenSaver SetScreenSaver;
718 PFN_XSetSelectionOwner SetSelectionOwner;
719 PFN_XSetWMHints SetWMHints;
720 PFN_XSetWMNormalHints SetWMNormalHints;
721 PFN_XSetWMProtocols SetWMProtocols;
722 PFN_XSupportsLocale SupportsLocale;
723 PFN_XSync Sync;
724 PFN_XTranslateCoordinates TranslateCoordinates;
725 PFN_XUndefineCursor UndefineCursor;
726 PFN_XUngrabPointer UngrabPointer;
727 PFN_XUnmapWindow UnmapWindow;
728 PFN_XUnsetICFocus UnsetICFocus;
729 PFN_XVisualIDFromVisual VisualIDFromVisual;
730 PFN_XWarpPointer WarpPointer;
731 PFN_XUnregisterIMInstantiateCallback UnregisterIMInstantiateCallback;
732 PFN_Xutf8LookupString utf8LookupString;
733 PFN_Xutf8SetWMProperties utf8SetWMProperties;
734 } xlib;
735
736 struct {
737 PFN_XrmDestroyDatabase DestroyDatabase;
738 PFN_XrmGetResource GetResource;
739 PFN_XrmGetStringDatabase GetStringDatabase;
740 PFN_XrmUniqueQuark UniqueQuark;
741 } xrm;
742
743 struct {
744 GLFWbool available;
745 void* handle;
746 int eventBase;
747 int errorBase;
748 int major;
749 int minor;
750 GLFWbool gammaBroken;
751 GLFWbool monitorBroken;
752 PFN_XRRAllocGamma AllocGamma;
753 PFN_XRRFreeCrtcInfo FreeCrtcInfo;
754 PFN_XRRFreeGamma FreeGamma;
755 PFN_XRRFreeOutputInfo FreeOutputInfo;
756 PFN_XRRFreeScreenResources FreeScreenResources;
757 PFN_XRRGetCrtcGamma GetCrtcGamma;
758 PFN_XRRGetCrtcGammaSize GetCrtcGammaSize;
759 PFN_XRRGetCrtcInfo GetCrtcInfo;
760 PFN_XRRGetOutputInfo GetOutputInfo;
761 PFN_XRRGetOutputPrimary GetOutputPrimary;
762 PFN_XRRGetScreenResourcesCurrent GetScreenResourcesCurrent;
763 PFN_XRRQueryExtension QueryExtension;
764 PFN_XRRQueryVersion QueryVersion;
765 PFN_XRRSelectInput SelectInput;
766 PFN_XRRSetCrtcConfig SetCrtcConfig;
767 PFN_XRRSetCrtcGamma SetCrtcGamma;
768 PFN_XRRUpdateConfiguration UpdateConfiguration;
769 } randr;
770
771 struct {
772 GLFWbool available;
773 GLFWbool detectable;
774 int majorOpcode;
775 int eventBase;
776 int errorBase;
777 int major;
778 int minor;
779 unsigned int group;
780 PFN_XkbFreeKeyboard FreeKeyboard;
781 PFN_XkbFreeNames FreeNames;
782 PFN_XkbGetMap GetMap;
783 PFN_XkbGetNames GetNames;
784 PFN_XkbGetState GetState;
785 PFN_XkbKeycodeToKeysym KeycodeToKeysym;
786 PFN_XkbQueryExtension QueryExtension;
787 PFN_XkbSelectEventDetails SelectEventDetails;
788 PFN_XkbSetDetectableAutoRepeat SetDetectableAutoRepeat;
789 } xkb;
790
791 struct {
792 int count;
793 int timeout;
794 int interval;
795 int blanking;
796 int exposure;
797 } saver;
798
799 struct {
800 int version;
801 Window source;
802 Atom format;
803 } xdnd;
804
805 struct {
806 void* handle;
807 PFN_XcursorImageCreate ImageCreate;
808 PFN_XcursorImageDestroy ImageDestroy;
809 PFN_XcursorImageLoadCursor ImageLoadCursor;
810 PFN_XcursorGetTheme GetTheme;
811 PFN_XcursorGetDefaultSize GetDefaultSize;
812 PFN_XcursorLibraryLoadImage LibraryLoadImage;
813 } xcursor;
814
815 struct {
816 GLFWbool available;
817 void* handle;
818 int major;
819 int minor;
820 PFN_XineramaIsActive IsActive;
821 PFN_XineramaQueryExtension QueryExtension;
822 PFN_XineramaQueryScreens QueryScreens;
823 } xinerama;
824
825 struct {
826 void* handle;
827 PFN_XGetXCBConnection GetXCBConnection;
828 } x11xcb;
829
830 struct {
831 GLFWbool available;
832 void* handle;
833 int eventBase;
834 int errorBase;
835 PFN_XF86VidModeQueryExtension QueryExtension;
836 PFN_XF86VidModeGetGammaRamp GetGammaRamp;
837 PFN_XF86VidModeSetGammaRamp SetGammaRamp;
838 PFN_XF86VidModeGetGammaRampSize GetGammaRampSize;
839 } vidmode;
840
841 struct {
842 GLFWbool available;
843 void* handle;
844 int majorOpcode;
845 int eventBase;
846 int errorBase;
847 int major;
848 int minor;
849 PFN_XIQueryVersion QueryVersion;
850 PFN_XISelectEvents SelectEvents;
851 } xi;
852
853 struct {
854 GLFWbool available;
855 void* handle;
856 int major;
857 int minor;
858 int eventBase;
859 int errorBase;
860 PFN_XRenderQueryExtension QueryExtension;
861 PFN_XRenderQueryVersion QueryVersion;
862 PFN_XRenderFindVisualFormat FindVisualFormat;
863 } xrender;
864
865 struct {
866 GLFWbool available;
867 void* handle;
868 int major;
869 int minor;
870 int eventBase;
871 int errorBase;
872 PFN_XShapeQueryExtension QueryExtension;
873 PFN_XShapeCombineRegion ShapeCombineRegion;
874 PFN_XShapeQueryVersion QueryVersion;
875 PFN_XShapeCombineMask ShapeCombineMask;
876 } xshape;
877} _GLFWlibraryX11;
878
879// X11-specific per-monitor data
880//
881typedef struct _GLFWmonitorX11
882{
883 RROutput output;
884 RRCrtc crtc;
885 RRMode oldMode;
886
887 // Index of corresponding Xinerama screen,
888 // for EWMH full screen window placement
889 int index;
890} _GLFWmonitorX11;
891
892// X11-specific per-cursor data
893//
894typedef struct _GLFWcursorX11
895{
896 Cursor handle;
897} _GLFWcursorX11;
898
899
900GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform);
901int _glfwInitX11(void);
902void _glfwTerminateX11(void);
903
904GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
905void _glfwDestroyWindowX11(_GLFWwindow* window);
906void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title);
907void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images);
908void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos);
909void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos);
910void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height);
911void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height);
912void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
913void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom);
914void _glfwGetFramebufferSizeX11(_GLFWwindow* window, int* width, int* height);
915void _glfwGetWindowFrameSizeX11(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
916void _glfwGetWindowContentScaleX11(_GLFWwindow* window, float* xscale, float* yscale);
917void _glfwIconifyWindowX11(_GLFWwindow* window);
918void _glfwRestoreWindowX11(_GLFWwindow* window);
919void _glfwMaximizeWindowX11(_GLFWwindow* window);
920void _glfwShowWindowX11(_GLFWwindow* window);
921void _glfwHideWindowX11(_GLFWwindow* window);
922void _glfwRequestWindowAttentionX11(_GLFWwindow* window);
923void _glfwFocusWindowX11(_GLFWwindow* window);
924void _glfwSetWindowMonitorX11(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
925GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window);
926GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window);
927GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window);
928GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window);
929GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window);
930GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window);
931void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled);
932void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled);
933void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled);
934float _glfwGetWindowOpacityX11(_GLFWwindow* window);
935void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity);
936void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled);
937
938void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled);
939GLFWbool _glfwRawMouseMotionSupportedX11(void);
940
941void _glfwPollEventsX11(void);
942void _glfwWaitEventsX11(void);
943void _glfwWaitEventsTimeoutX11(double timeout);
944void _glfwPostEmptyEventX11(void);
945
946void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos);
947void _glfwSetCursorPosX11(_GLFWwindow* window, double xpos, double ypos);
948void _glfwSetCursorModeX11(_GLFWwindow* window, int mode);
949const char* _glfwGetScancodeNameX11(int scancode);
950int _glfwGetKeyScancodeX11(int key);
951GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
952GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape);
953void _glfwDestroyCursorX11(_GLFWcursor* cursor);
954void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor);
955void _glfwSetClipboardStringX11(const char* string);
956const char* _glfwGetClipboardStringX11(void);
957
958EGLenum _glfwGetEGLPlatformX11(EGLint** attribs);
959EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void);
960EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window);
961
962void _glfwGetRequiredInstanceExtensionsX11(char** extensions);
963GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
964VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
965
966void _glfwFreeMonitorX11(_GLFWmonitor* monitor);
967void _glfwGetMonitorPosX11(_GLFWmonitor* monitor, int* xpos, int* ypos);
968void _glfwGetMonitorContentScaleX11(_GLFWmonitor* monitor, float* xscale, float* yscale);
969void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
970GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count);
971GLFWbool _glfwGetVideoModeX11(_GLFWmonitor* monitor, GLFWvidmode* mode);
972GLFWbool _glfwGetGammaRampX11(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
973void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
974
975void _glfwPollMonitorsX11(void);
976void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired);
977void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor);
978
979Cursor _glfwCreateNativeCursorX11(const GLFWimage* image, int xhot, int yhot);
980
981unsigned long _glfwGetWindowPropertyX11(Window window,
982 Atom property,
983 Atom type,
984 unsigned char** value);
985GLFWbool _glfwIsVisualTransparentX11(Visual* visual);
986
987void _glfwGrabErrorHandlerX11(void);
988void _glfwReleaseErrorHandlerX11(void);
989void _glfwInputErrorX11(int error, const char* message);
990
991void _glfwPushSelectionToManagerX11(void);
992void _glfwCreateInputContextX11(_GLFWwindow* window);
993
994GLFWbool _glfwInitGLX(void);
995void _glfwTerminateGLX(void);
996GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
997 const _GLFWctxconfig* ctxconfig,
998 const _GLFWfbconfig* fbconfig);
999void _glfwDestroyContextGLX(_GLFWwindow* window);
1000GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
1001 const _GLFWctxconfig* ctxconfig,
1002 const _GLFWfbconfig* fbconfig,
1003 Visual** visual, int* depth);
1004