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