macOS: Clarify separation between Cocoa and macOS

The timer code uses no part of Cocoa and is in turn used by other
backends than Cocoa on macOS.

The macOS timer code is now labeled macOS.  Cocoa-specific files are now
consistently labeled Cocoa, not macOS.
This commit is contained in:
Camilla Löwy
2026-02-16 15:07:18 +01:00
parent 3d89365fdb
commit 29cd880ab5
8 changed files with 18 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ add_library(glfw ${GLFW_LIBRARY_TYPE}
# The time, thread and module code is shared between all backends on a given OS,
# including the null backend, which still needs those bits to be functional
if (APPLE)
target_sources(glfw PRIVATE cocoa_time.h cocoa_time.c posix_thread.h
target_sources(glfw PRIVATE macos_time.h macos_time.c posix_thread.h
posix_module.c posix_thread.c)
elseif (WIN32)
target_sources(glfw PRIVATE win32_time.h win32_thread.h win32_module.c

View File

@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.5 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//

View File

@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.5 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>

View File

@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.5 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//

View File

@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.5 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//

View File

@@ -26,7 +26,7 @@
#include "internal.h"
#if defined(GLFW_BUILD_COCOA_TIMER)
#if defined(GLFW_BUILD_MACOS_TIMER)
#include <mach/mach_time.h>
@@ -40,7 +40,7 @@ void _glfwPlatformInitTimer(void)
mach_timebase_info_data_t info;
mach_timebase_info(&info);
_glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer;
_glfw.timer.macos.frequency = (info.denom * 1e9) / info.numer;
}
uint64_t _glfwPlatformGetTimerValue(void)
@@ -50,8 +50,8 @@ uint64_t _glfwPlatformGetTimerValue(void)
uint64_t _glfwPlatformGetTimerFrequency(void)
{
return _glfw.timer.ns.frequency;
return _glfw.timer.macos.frequency;
}
#endif // GLFW_BUILD_COCOA_TIMER
#endif // GLFW_BUILD_MACOS_TIMER

View File

@@ -24,12 +24,12 @@
//
//========================================================================
#define GLFW_COCOA_LIBRARY_TIMER_STATE _GLFWtimerNS ns;
#define GLFW_MACOS_LIBRARY_TIMER_STATE _GLFWtimerMacOS macos;
// Cocoa-specific global timer data
// macOS-specific global timer data
//
typedef struct _GLFWtimerNS
typedef struct _GLFWtimerMacOS
{
uint64_t frequency;
} _GLFWtimerNS;
} _GLFWtimerMacOS;

View File

@@ -28,7 +28,7 @@
#if defined(GLFW_BUILD_WIN32_TIMER) || \
defined(GLFW_BUILD_WIN32_MODULE) || \
defined(GLFW_BUILD_WIN32_THREAD) || \
defined(GLFW_BUILD_COCOA_TIMER) || \
defined(GLFW_BUILD_MACOS_TIMER) || \
defined(GLFW_BUILD_POSIX_TIMER) || \
defined(GLFW_BUILD_POSIX_MODULE) || \
defined(GLFW_BUILD_POSIX_THREAD) || \
@@ -184,7 +184,7 @@
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_TIMER
#elif defined(__APPLE__)
#define GLFW_BUILD_COCOA_TIMER
#define GLFW_BUILD_MACOS_TIMER
#else
#define GLFW_BUILD_POSIX_TIMER
#endif
@@ -192,9 +192,9 @@
#if defined(GLFW_BUILD_WIN32_TIMER)
#include "win32_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_COCOA_TIMER)
#include "cocoa_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_MACOS_TIMER)
#include "macos_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_MACOS_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_POSIX_TIMER)
#include "posix_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE