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

Realloc the monitor size for each IN USE monitor.

This commit is contained in:
BrandonSchaefer 2014-11-06 00:27:24 -08:00 committed by Camilla Berglund
parent d76d56ce74
commit cb4ccc59c2

View File

@ -37,8 +37,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
int d, found = 0;
MirDisplayConfiguration* display_config = mir_connection_create_display_config(_glfw.mir.connection);
*count = display_config->num_outputs;
_GLFWmonitor** monitors = calloc(*count, sizeof(_GLFWmonitor*));
_GLFWmonitor** monitors = NULL;
// TODO Break this loop down into the other functions there
for (d = 0; d < display_config->num_outputs; d++)
@ -50,13 +49,16 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
out->num_modes &&
out->current_mode < out->num_modes)
{
found++;
monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found);
_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.num_modes = out->num_modes;
monitor->modes = calloc(out->num_modes, sizeof(GLFWvidmode));
found++;
int n_mode;
for (n_mode = 0; n_mode < out->num_modes; n_mode++)