Removed function duplicating _glfwAllocMonitor.

This commit is contained in:
Camilla Berglund 2014-11-06 23:41:29 +01:00
parent 8d5043f409
commit 10a74924e3

View File

@ -28,11 +28,11 @@
#include <stdlib.h> #include <stdlib.h>
GLFWvidmode* createMonitorModes(MirDisplayOutput const* out) static GLFWvidmode* createMonitorModes(MirDisplayOutput const* out)
{ {
int n_mode;
GLFWvidmode* modes = calloc(out->num_modes, sizeof(GLFWvidmode)); GLFWvidmode* modes = calloc(out->num_modes, sizeof(GLFWvidmode));
int n_mode;
for (n_mode = 0; n_mode < out->num_modes; n_mode++) for (n_mode = 0; n_mode < out->num_modes; n_mode++)
{ {
modes[n_mode].width = out->modes[n_mode].horizontal_resolution; modes[n_mode].width = out->modes[n_mode].horizontal_resolution;
@ -46,23 +46,6 @@ GLFWvidmode* createMonitorModes(MirDisplayOutput const* out)
return modes; return modes;
} }
_GLFWmonitor* createNewMonitor(MirDisplayOutput const* out)
{
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
monitor->mir.x = out->position_x;
monitor->mir.y = out->position_y;
monitor->mir.output_id = out->output_id;
monitor->mir.cur_mode = out->current_mode;
monitor->modeCount = out->num_modes;
monitor->widthMM = out->physical_width_mm;
monitor->heightMM = out->physical_height_mm;
monitor->modes = createMonitorModes(out);
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
return monitor;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW platform API ////// ////// GLFW platform API //////
@ -86,8 +69,20 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
out->current_mode < out->num_modes) out->current_mode < out->num_modes)
{ {
found++; found++;
monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found); monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found);
monitor = createNewMonitor(out); monitor = _glfwAllocMonitor("Unknown",
out->physical_width_mm,
out->physical_height_mm);
monitor->mir.x = out->position_x;
monitor->mir.y = out->position_y;
monitor->mir.output_id = out->output_id;
monitor->mir.cur_mode = out->current_mode;
monitor->modeCount = out->num_modes;
monitor->modes = createMonitorModes(out);
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
monitors[d] = monitor; monitors[d] = monitor;
} }
} }