wayland: Implement wl_surface retrieval from a GLFWwindow.

This commit is contained in:
Emmanuel Gil Peyrot 2015-06-13 00:40:41 +01:00
parent 7935a366f4
commit f2141bca35
2 changed files with 31 additions and 0 deletions

View File

@ -86,6 +86,8 @@ extern "C" {
#elif defined(GLFW_EXPOSE_NATIVE_X11) #elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client-protocol.h>
#else #else
#error "No window API selected" #error "No window API selected"
#endif #endif
@ -301,6 +303,23 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
#endif #endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_surface*` of the specified window.
*
* @return The `struct wl_surface*` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandSurface(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL) #if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW. /*! @brief Returns the `EGLDisplay` used by GLFW.
* *

View File

@ -529,3 +529,15 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
return NULL; return NULL;
} }
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI struct wl_surface* glfwGetWaylandSurface(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->wl.surface;
}