mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Renamed monitor helper functions for clarity.
This commit is contained in:
parent
beb7e5909f
commit
0548c713e8
@ -273,8 +273,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
int j;
|
||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||
|
||||
monitors[found] = _glfwCreateMonitor(getDisplayName(displays[i]),
|
||||
size.width, size.height);
|
||||
monitors[found] = _glfwAllocMonitor(getDisplayName(displays[i]),
|
||||
size.width, size.height);
|
||||
|
||||
monitors[found]->ns.displayID = displays[i];
|
||||
|
||||
@ -299,7 +299,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
"Cocoa: Failed to find NSScreen for CGDisplay %s",
|
||||
monitors[found]->name);
|
||||
|
||||
_glfwDestroyMonitor(monitors[found]);
|
||||
_glfwFreeMonitor(monitors[found]);
|
||||
monitors[found] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ GLFWAPI void glfwTerminate(void)
|
||||
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
|
||||
}
|
||||
|
||||
_glfwDestroyMonitors(_glfw.monitors, _glfw.monitorCount);
|
||||
_glfwFreeMonitors(_glfw.monitors, _glfw.monitorCount);
|
||||
_glfw.monitors = NULL;
|
||||
_glfw.monitorCount = 0;
|
||||
|
||||
|
@ -761,15 +761,15 @@ void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
||||
* @return The newly created object.
|
||||
* @ingroup utility
|
||||
*/
|
||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM);
|
||||
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
|
||||
|
||||
/*! @brief Frees a monitor object and any data associated with it.
|
||||
* @ingroup utility
|
||||
*/
|
||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor);
|
||||
void _glfwFreeMonitor(_GLFWmonitor* monitor);
|
||||
|
||||
/*! @ingroup utility
|
||||
*/
|
||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count);
|
||||
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count);
|
||||
|
||||
#endif // _internal_h_
|
||||
|
@ -113,7 +113,7 @@ void _glfwInputMonitorChange(void)
|
||||
{
|
||||
if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j]))
|
||||
{
|
||||
_glfwDestroyMonitor(_glfw.monitors[i]);
|
||||
_glfwFreeMonitor(_glfw.monitors[i]);
|
||||
_glfw.monitors[i] = monitors[j];
|
||||
break;
|
||||
}
|
||||
@ -167,7 +167,7 @@ void _glfwInputMonitorChange(void)
|
||||
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||
}
|
||||
|
||||
_glfwDestroyMonitors(monitors, monitorCount);
|
||||
_glfwFreeMonitors(monitors, monitorCount);
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ void _glfwInputMonitorChange(void)
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
||||
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
||||
{
|
||||
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
|
||||
monitor->name = strdup(name);
|
||||
@ -185,7 +185,7 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
||||
return monitor;
|
||||
}
|
||||
|
||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
||||
void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
||||
{
|
||||
if (monitor == NULL)
|
||||
return;
|
||||
@ -198,12 +198,12 @@ void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
||||
free(monitor);
|
||||
}
|
||||
|
||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count)
|
||||
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
_glfwDestroyMonitor(monitors[i]);
|
||||
_glfwFreeMonitor(monitors[i]);
|
||||
|
||||
free(monitors);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
name = _glfwCreateUTF8FromWideString(display.DeviceString);
|
||||
if (!name)
|
||||
{
|
||||
_glfwDestroyMonitors(monitors, found);
|
||||
_glfwFreeMonitors(monitors, found);
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Failed to convert string to UTF-8");
|
||||
|
||||
@ -156,7 +156,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
monitors[found] = _glfwCreateMonitor(name,
|
||||
monitors[found] = _glfwAllocMonitor(name,
|
||||
GetDeviceCaps(dc, HORZSIZE),
|
||||
GetDeviceCaps(dc, VERTSIZE));
|
||||
|
||||
|
@ -218,8 +218,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
continue;
|
||||
}
|
||||
|
||||
monitors[found] = _glfwCreateMonitor(oi->name,
|
||||
oi->mm_width, oi->mm_height);
|
||||
monitors[found] = _glfwAllocMonitor(oi->name,
|
||||
oi->mm_width, oi->mm_height);
|
||||
|
||||
monitors[found]->x11.output = output;
|
||||
monitors[found]->x11.crtc = oi->crtc;
|
||||
@ -254,11 +254,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
else
|
||||
{
|
||||
monitors = calloc(1, sizeof(_GLFWmonitor*));
|
||||
monitors[0] = _glfwCreateMonitor("Display",
|
||||
DisplayWidthMM(_glfw.x11.display,
|
||||
_glfw.x11.screen),
|
||||
DisplayHeightMM(_glfw.x11.display,
|
||||
_glfw.x11.screen));
|
||||
monitors[0] = _glfwAllocMonitor("Display",
|
||||
DisplayWidthMM(_glfw.x11.display,
|
||||
_glfw.x11.screen),
|
||||
DisplayHeightMM(_glfw.x11.display,
|
||||
_glfw.x11.screen));
|
||||
*count = 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user