1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Monitor enumeration cleanup.

This commit is contained in:
Camilla Berglund 2013-04-18 15:30:28 +02:00
parent dc58dd1bef
commit 37a137559e
2 changed files with 4 additions and 10 deletions

View File

@ -131,7 +131,7 @@ GLFWAPI int glfwInit(void)
}
_glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount);
if (!_glfw.monitors)
if (_glfw.monitors == NULL || _glfw.monitorCount == 0)
{
_glfwErrorCallback(GLFW_PLATFORM_ERROR, "No monitors found");
_glfwPlatformTerminate();

View File

@ -106,8 +106,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
for (;;)
{
// Enumerate display adapters
DISPLAY_DEVICE adapter, display;
char* name;
HDC dc;
@ -148,7 +146,9 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
name = _glfwCreateUTF8FromWideString(display.DeviceString);
if (!name)
{
// TODO: wat
_glfwDestroyMonitors(monitors, found);
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to convert string to UTF-8");
return NULL;
}
@ -159,12 +159,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
free(name);
DeleteDC(dc);
if (!monitors[found])
{
// TODO: wat
return NULL;
}
wcscpy(monitors[found]->win32.name, adapter.DeviceName);
found++;
}