mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 04:53:50 +00:00
Cocoa: Added glfwGetCocoaView native access function
Resolves #2235 Co-authored-by: mightgoyardstill <mightgoyardstill@users.noreply.github.com>
This commit is contained in:
parent
0bb605cd79
commit
1fb7f0e120
@ -154,6 +154,7 @@ video tutorials.
|
||||
- Jonathan Mercier
|
||||
- Marcel Metz
|
||||
- Liam Middlebrook
|
||||
- mightgoyardstill
|
||||
- Ave Milia
|
||||
- Icyllis Milica
|
||||
- Jonathan Miller
|
||||
|
@ -180,6 +180,7 @@ information on what to include when reporting a bug.
|
||||
- [Win32] Added a version info resource to the GLFW DLL
|
||||
- [Win32] Made hidden helper window use its own window class
|
||||
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
|
||||
- [Cocoa] Added `glfwGetCocoaView` native access function (#2235)
|
||||
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
|
||||
- [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
|
||||
would abort (#1649)
|
||||
|
@ -7,6 +7,12 @@
|
||||
|
||||
### New features in version 3.4 {#features_34}
|
||||
|
||||
#### Cocoa NSView native access function {#native_cocoa_nsview_34}
|
||||
|
||||
GLFW now provides the @ref glfwGetCocoaView native access function
|
||||
for returning the Cocoa NSView.
|
||||
|
||||
|
||||
#### Runtime platform selection {#runtime_platform_34}
|
||||
|
||||
GLFW now supports being compiled for multiple backends and selecting between
|
||||
|
@ -286,6 +286,23 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
|
||||
/*! @brief Returns the `NSView` of the specified window.
|
||||
*
|
||||
* @return The `NSView` of the specified window, or `nil` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
* @since Added in version 3.4.
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
|
@ -2053,5 +2053,20 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle)
|
||||
return window->ns.object;
|
||||
}
|
||||
|
||||
GLFWAPI id glfwGetCocoaView(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
|
||||
"Cocoa: Platform not initialized");
|
||||
return nil;
|
||||
}
|
||||
|
||||
return window->ns.view;
|
||||
}
|
||||
|
||||
#endif // _GLFW_COCOA
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user