Returns the audio_app without a window

This commit is contained in:
Lucio Asnaghi 2024-12-04 01:48:11 +01:00
parent de06756d4d
commit 09efa97ef5
3 changed files with 17 additions and 6 deletions

View File

@ -660,9 +660,21 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
#endif #endif
#if defined(GLFW_EXPOSE_NATIVE_ANDROID) #if defined(GLFW_EXPOSE_NATIVE_ANDROID)
/*! @brief Returns the `struct android_app` of the specified window. /*! @brief Returns the `struct android_app` of the current application.
*
* @return The `struct android_app` of the current, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.5.
*
* @ingroup native
*/ */
GLFWAPI struct android_app* glfwGetAndroidApp(GLFWwindow* window); GLFWAPI struct android_app* glfwGetAndroidApp(void);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -131,4 +131,4 @@ void _glfwGetRequiredInstanceExtensionsAndroid(char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportAndroid(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportAndroid(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceAndroid(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceAndroid(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
GLFWAPI struct android_app* glfwGetAndroidApp(GLFWwindow* handle); GLFWAPI struct android_app* glfwGetAndroidApp(void);

View File

@ -555,9 +555,8 @@ VkResult _glfwCreateWindowSurfaceAndroid(VkInstance instance,
////// GLFW native API ////// ////// GLFW native API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
GLFWAPI struct android_app* glfwGetAndroidApp(GLFWwindow* handle) GLFWAPI struct android_app* glfwGetAndroidApp(void)
{ {
_GLFWwindow* window = (_GLFWwindow*)handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->android; return _glfw.gstate.app;
} }