1010# # Turning ``glfwMakeContextCurrent(window)`` into ``window.makeContextCurrent()``.
1111# #
1212# # You can check the original documentation `here <http://www.glfw.org/docs/latest/>`_.
13+ # #
14+ # # **By using the native access functions you assert that you know what you're
15+ # # doing and how to fix problems caused by using them. If you don't, you
16+ # # shouldn't be using them.**
17+ # #
18+ # # Please assert that you are using the right system for the right procedures.
1319
1420import glfw
1521
@@ -21,6 +27,27 @@ when defined(glfwDLL):
2127 else :
2228 const glfw_dll* = " libglfw.so.3"
2329
30+ when defined (windows):
31+ {.passC : " -DGLFW_EXPOSE_NATIVE_WIN32" .}
32+ if not defined (vulkan):
33+ {.passC : " -DGLFW_EXPOSE_NATIVE_WGL" .}
34+ elif defined (macosx):
35+ {.passC : " -DGLFW_EXPOSE_NATIVE_COCOA" .}
36+ if not defined (vulkan):
37+ {.passC : " -DGLFW_EXPOSE_NATIVE_NSGL" .}
38+ else :
39+ if defined (wayland):
40+ {.passC : " -DGLFW_EXPOSE_NATIVE_WAYLAND" .}
41+ else :
42+ {.passC : " -DGLFW_EXPOSE_NATIVE_X11" .}
43+
44+ if defined (mesa):
45+ {.passC : " -DGLFW_EXPOSE_NATIVE_OSMESA" .}
46+ elif defined (egl):
47+ {.passC : " -DGLFW_EXPOSE_NATIVE_EGL" .}
48+ elif not defined (vulkan):
49+ {.passC : " -DGLFW_EXPOSE_NATIVE_GLX" .}
50+
2451# Procs
2552when defined (glfwDLL):
2653 {.push dynlib : glfw_dll, cdecl .}
@@ -231,7 +258,7 @@ proc getGLXWindow*(window: GLFWWindow): pointer #[GLXWindow]# {.importc: "glfwGe
231258 # # @since Added in version 3.2.
232259 # #
233260 # # @ingroup native
234- proc wl_display * (): pointer #[ struct]# {.importc : " wl_display* " .}
261+ proc getWaylandDisplay * (): pointer #[ struct]# {.importc : " glfwGetWaylandDisplay " .}
235262 # # @brief Returns the `struct wl_display*` used by GLFW.
236263 # #
237264 # # @return The `struct wl_display*` used by GLFW, or `NULL` if an
@@ -243,7 +270,7 @@ proc wl_display*(): pointer #[struct]# {.importc: "wl_display*".}
243270 # # @since Added in version 3.2.
244271 # #
245272 # # @ingroup native
246- proc wl_output * (monitor: GLFWMonitor ): pointer #[ struct]# {.importc : " wl_output* " .}
273+ proc getWaylandMonitor * (monitor: GLFWMonitor ): pointer #[ struct]# {.importc : " glfwGetWaylandMonitor " .}
247274 # # @brief Returns the `struct wl_output*` of the specified monitor.
248275 # #
249276 # # @return The `struct wl_output*` of the specified monitor, or `NULL` if an
@@ -255,7 +282,7 @@ proc wl_output*(monitor: GLFWMonitor): pointer #[struct]# {.importc: "wl_output*
255282 # # @since Added in version 3.2.
256283 # #
257284 # # @ingroup native
258- proc wl_surface * (window: GLFWWindow ): pointer #[ struct]# {.importc : " wl_surface* " .}
285+ proc getWaylandWindow * (window: GLFWWindow ): pointer #[ struct]# {.importc : " glfwGetWaylandWindow " .}
259286 # # @brief Returns the main `struct wl_surface*` of the specified window.
260287 # #
261288 # # @return The main `struct wl_surface*` of the specified window, or `NULL` if
0 commit comments