• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Standards conformance {#compat_guide}
2
3[TOC]
4
5This guide describes the various API extensions used by this version of GLFW.
6It lists what are essentially implementation details, but which are nonetheless
7vital knowledge for developers intending to deploy their applications on a wide
8range of machines.
9
10The information in this guide is not a part of GLFW API, but merely
11preconditions for some parts of the library to function on a given machine.  Any
12part of this information may change in future versions of GLFW and that will not
13be considered a breaking API change.
14
15
16## X11 extensions, protocols and IPC standards {#compat_x11}
17
18As GLFW uses Xlib directly, without any intervening toolkit library, it has sole
19responsibility for interacting well with the many and varied window managers in
20use on Unix-like systems.  In order for applications and window managers to work
21well together, a number of standards and conventions have been developed that
22regulate behavior outside the scope of the X11 API; most importantly the
23[Inter-Client Communication Conventions Manual][ICCCM] (ICCCM) and [Extended
24Window Manager Hints][EWMH] (EWMH) standards.
25
26[ICCCM]: https://www.tronche.com/gui/x/icccm/
27[EWMH]: https://standards.freedesktop.org/wm-spec/wm-spec-latest.html
28
29GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
30If the running window manager does not support this property, the
31`GLFW_DECORATED` hint will have no effect.
32
33GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
34attempting to close the GLFW window.  If the running window manager does not
35support this protocol, the close callback will never be called.
36
37GLFW uses the EWMH `_NET_WM_PING` protocol, allowing the window manager notify
38the user when the application has stopped responding, i.e. when it has ceased to
39process events.  If the running window manager does not support this protocol,
40the user will not be notified if the application locks up.
41
42GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window
43manager to make the GLFW window full screen.  If the running window manager does
44not support this state, full screen windows may not work properly.  GLFW has
45a fallback code path in case this state is unavailable, but every window manager
46behaves slightly differently in this regard.
47
48GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a
49compositing window manager to un-redirect full screen GLFW windows.  If the
50running window manager uses compositing but does not support this property then
51additional copying may be performed for each buffer swap of full screen windows.
52
53GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard
54string (i.e. selection) owned by a GLFW window about to be destroyed to the
55clipboard manager.  If there is no running clipboard manager, the clipboard
56string will be unavailable once the window has been destroyed.
57
58[clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/
59
60GLFW uses the [X drag-and-drop protocol][XDND] to provide file drop events.  If
61the application originating the drag does not support this protocol, drag and
62drop will not work.
63
64[XDND]: https://www.freedesktop.org/wiki/Specifications/XDND/
65
66GLFW uses the XRandR 1.3 extension to provide multi-monitor support.  If the
67running X server does not support this version of this extension, multi-monitor
68support will not function and only a single, desktop-spanning monitor will be
69reported.
70
71GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp
72support.  If the running X server does not support either or both of these
73extensions, gamma ramp support will not function.
74
75GLFW uses the Xkb extension and detectable auto-repeat to provide keyboard
76input.  If the running X server does not support this extension, a non-Xkb
77fallback path is used.
78
79GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion
80when the cursor is disabled.  If the running X server does not support this
81extension, regular accelerated mouse motion will be used.
82
83GLFW uses both the XRender extension and the compositing manager to support
84transparent window framebuffers.  If the running X server does not support this
85extension or there is no running compositing manager, the
86`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
87
88GLFW uses both the Xcursor extension and the freedesktop cursor conventions to
89provide an expanded set of standard cursor shapes.  If the running X server does
90not support this extension or the current cursor theme does not support the
91conventions, the `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR` and
92`GLFW_NOT_ALLOWED_CURSOR` shapes will not be available and other shapes may use
93legacy images.
94
95
96## Wayland protocols and IPC standards {#compat_wayland}
97
98As GLFW uses libwayland directly, without any intervening toolkit library, it
99has sole responsibility for interacting well with every compositor in use on
100Unix-like systems.  Most of the features are provided by the core protocol,
101while cursor support is provided by the libwayland-cursor helper library, EGL
102integration by libwayland-egl, and keyboard handling by
103[libxkbcommon](https://xkbcommon.org/).  In addition, GLFW uses some additional
104Wayland protocols to implement certain features if the compositor supports them.
105
106GLFW uses xkbcommon 0.5.0 to provide key and text input support.  Earlier
107versions are not supported.
108
109GLFW uses the [xdg-shell][] protocol to provide better window management.  This
110protocol is mandatory for GLFW to display a window.
111
112[xdg-shell]: https://wayland.app/protocols/xdg-shell
113
114GLFW uses the [relative-pointer-unstable-v1][] protocol alongside the
115[pointer-constraints-unstable-v1][] protocol to implement disabled cursor.  If
116the running compositor does not support both of these protocols, disabling the
117cursor will have no effect.
118
119[relative-pointer-unstable-v1]: https://wayland.app/protocols/relative-pointer-unstable-v1
120[pointer-constraints-unstable-v1]: https://wayland.app/protocols/pointer-constraints-unstable-v1
121
122GLFW uses the [idle-inhibit-unstable-v1][] protocol to prohibit the screensaver
123from starting.  If the running compositor does not support this protocol, the
124screensaver may start even for full screen windows.
125
126[idle-inhibit-unstable-v1]: https://wayland.app/protocols/idle-inhibit-unstable-v1
127
128GLFW uses the [libdecor][] library for window decorations, where available.
129This in turn provides good quality client-side decorations (drawn by the
130application) on desktop systems that do not support server-side decorations
131(drawn by the window manager).  On systems that do not provide either libdecor
132or xdg-decoration, very basic window decorations are provided.  These do not
133include the window title or any caption buttons.
134
135[libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
136
137GLFW uses the [xdg-decoration-unstable-v1][] protocol to request decorations to
138be drawn around its windows.  This protocol is part of wayland-protocols 1.15,
139and mandatory at build time.  If the running compositor does not support this
140protocol, a very simple frame will be drawn by GLFW itself, using the
141[viewporter][] protocol alongside subsurfaces.  If the running compositor does
142not support these protocols either, no decorations will be drawn around windows.
143
144[xdg-decoration-unstable-v1]: https://wayland.app/protocols/xdg-decoration-unstable-v1
145[viewporter]: https://wayland.app/protocols/viewporter
146
147GLFW uses the [xdg-activation-v1][] protocol to implement window focus and
148attention requests.  If the running compositor does not support this protocol,
149window focus and attention requests do nothing.
150
151[xdg-activation-v1]: https://wayland.app/protocols/xdg-activation-v1
152
153GLFW uses the [fractional-scale-v1][] protocol to implement fine-grained
154framebuffer scaling.  If the running compositor does not support this protocol,
155the @ref GLFW_SCALE_FRAMEBUFFER window hint will only be able to scale the
156framebuffer by integer scales.  This will typically be the smallest integer not
157less than the actual scale.
158
159[fractional-scale-v1]: https://wayland.app/protocols/fractional-scale-v1
160
161
162## GLX extensions {#compat_glx}
163
164The GLX API is the default API used to create OpenGL contexts on Unix-like
165systems using the X Window System.
166
167GLFW uses the GLX 1.3 `GLXFBConfig` functions to enumerate and select framebuffer pixel
168formats.  If GLX 1.3 is not supported, @ref glfwInit will fail.
169
170GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
171`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
172(or _vsync_), in that order of preference.  When none of these extensions are
173available, calling @ref glfwSwapInterval will have no effect.
174
175GLFW uses the `GLX_ARB_multisample` extension to create contexts with
176multisampling anti-aliasing.  Where this extension is unavailable, the
177`GLFW_SAMPLES` hint will have no effect.
178
179GLFW uses the `GLX_ARB_create_context` extension when available, even when
180creating OpenGL contexts of version 2.1 and below.  Where this extension is
181unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
182hints will only be partially supported, the `GLFW_CONTEXT_DEBUG` hint will have
183no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT`
184hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail.
185
186GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
187context profiles.  Where this extension is unavailable, setting the
188`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting
189`GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` or `GLFW_NO_API` will cause
190@ref glfwCreateWindow to fail.
191
192GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over
193whether a context is flushed when it is released (made non-current).  Where this
194extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
195effect and the context will always be flushed when released.
196
197GLFW uses the `GLX_ARB_framebuffer_sRGB` and `GLX_EXT_framebuffer_sRGB`
198extensions to provide support for sRGB framebuffers.  Where both of these
199extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
200
201
202## WGL extensions {#compat_wgl}
203
204The WGL API is used to create OpenGL contexts on Microsoft Windows and other
205implementations of the Win32 API, such as Wine.
206
207GLFW uses either the `WGL_EXT_extension_string` or the
208`WGL_ARB_extension_string` extension to check for the presence of all other WGL
209extensions listed below.  If both are available, the EXT one is preferred.  If
210neither is available, no other extensions are used and many GLFW features
211related to context creation will have no effect or cause errors when used.
212
213GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace
214synchronization (or _vsync_).  Where this extension is unavailable, calling @ref
215glfwSwapInterval will have no effect.
216
217GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to
218create contexts with multisampling anti-aliasing.  Where these extensions are
219unavailable, the `GLFW_SAMPLES` hint will have no effect.
220
221GLFW uses the `WGL_ARB_create_context` extension when available, even when
222creating OpenGL contexts of version 2.1 and below.  Where this extension is
223unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
224hints will only be partially supported, the `GLFW_CONTEXT_DEBUG` hint will have
225no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT`
226hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail.
227
228GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
229context profiles.  Where this extension is unavailable, setting the
230`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE` will cause
231@ref glfwCreateWindow to fail.
232
233GLFW uses the `WGL_ARB_context_flush_control` extension to provide control over
234whether a context is flushed when it is released (made non-current).  Where this
235extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no
236effect and the context will always be flushed when released.
237
238GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB`
239extensions to provide support for sRGB framebuffers.  When both of these
240extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
241
242
243## OpenGL on macOS {#compat_osx}
244
245macOS (as of version 14) still provides OpenGL but it has been deprecated by
246Apple.  While the API is still available, it is poorly maintained and frequently
247develops new issues.  On modern systems, OpenGL is implemented on top of Metal
248and is not fully thread-safe.
249
250macOS does not support OpenGL stereo rendering.  If the `GLFW_STEREO` hint is
251set to true, OpenGL context creation will always fail.
252
253macOS only supports OpenGL core profile contexts that are forward-compatible,
254but the `GLFW_OPENGL_FORWARD_COMPAT` hint is ignored since GLFW 3.4.  Even if
255this hint is set to false (the default), a forward-compatible context will be
256returned if available.
257
258macOS does not support OpenGL debug contexts, no-error contexts or robustness.
259The `GLFW_CONTEXT_DEBUG`, `GLFW_CONTEXT_NO_ERROR` and `GLFW_CONTEXT_ROBUSTNESS`
260hints will be ignored and a context without these features will be returned.
261
262macOS does not flush OpenGL contexts when they are made non-current.  The
263`GLFW_CONTEXT_RELEASE_BEHAVIOR` hint is ignored and the release behavior will
264always be the equivalent of `GLFW_RELEASE_BEHAVIOR_NONE`.  If you need a context
265to be flushed, call `glFlush` before making it non-current.
266
267
268## Vulkan loader and API {#compat_vulkan}
269
270By default, GLFW uses the standard system-wide Vulkan loader to access the
271Vulkan API on all platforms except macOS.  This is installed by both graphics
272drivers and Vulkan SDKs.  If either the loader or at least one minimally
273functional ICD is missing, @ref glfwVulkanSupported will return `GLFW_FALSE` and
274all other Vulkan-related functions will fail with an @ref GLFW_API_UNAVAILABLE
275error.
276
277
278## Vulkan WSI extensions {#compat_wsi}
279
280The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on
281all supported platforms.
282
283GLFW uses the `VK_KHR_surface` and `VK_KHR_win32_surface` extensions to create
284surfaces on Microsoft Windows.  If any of these extensions are not available,
285@ref glfwGetRequiredInstanceExtensions will return an empty list and window
286surface creation will fail.
287
288GLFW uses the `VK_KHR_surface` and either the `VK_MVK_macos_surface` or
289`VK_EXT_metal_surface` extensions to create surfaces on macOS.  If any of these
290extensions are not available, @ref glfwGetRequiredInstanceExtensions will
291return an empty list and window surface creation will fail.
292
293GLFW uses the `VK_KHR_surface` and either the `VK_KHR_xlib_surface` or
294`VK_KHR_xcb_surface` extensions to create surfaces on X11.  If `VK_KHR_surface`
295or both `VK_KHR_xlib_surface` and `VK_KHR_xcb_surface` are not available, @ref
296glfwGetRequiredInstanceExtensions will return an empty list and window surface
297creation will fail.
298
299GLFW uses the `VK_KHR_surface` and `VK_KHR_wayland_surface` extensions to create
300surfaces on Wayland.  If any of these extensions are not available, @ref
301glfwGetRequiredInstanceExtensions will return an empty list and window surface
302creation will fail.
303
304