Finish up the monitor work.
This commit is contained in:
parent
ac73c2bd6c
commit
f4f525549c
@ -39,7 +39,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
|
|
||||||
_GLFWmonitor** monitors = NULL;
|
_GLFWmonitor** monitors = NULL;
|
||||||
|
|
||||||
// TODO Break this loop down into the other functions there
|
|
||||||
for (d = 0; d < display_config->num_outputs; d++)
|
for (d = 0; d < display_config->num_outputs; d++)
|
||||||
{
|
{
|
||||||
MirDisplayOutput const* out = display_config->outputs + d;
|
MirDisplayOutput const* out = display_config->outputs + d;
|
||||||
@ -57,7 +56,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
monitor->mir.x = out->position_x;
|
monitor->mir.x = out->position_x;
|
||||||
monitor->mir.y = out->position_y;
|
monitor->mir.y = out->position_y;
|
||||||
monitor->mir.output_id = out->output_id;
|
monitor->mir.output_id = out->output_id;
|
||||||
monitor->mir.num_modes = out->num_modes;
|
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 = calloc(out->num_modes, sizeof(GLFWvidmode));
|
monitor->modes = calloc(out->num_modes, sizeof(GLFWvidmode));
|
||||||
|
|
||||||
int n_mode;
|
int n_mode;
|
||||||
@ -68,6 +71,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
monitor->modes[n_mode].refreshRate = out->modes[n_mode].refresh_rate;
|
monitor->modes[n_mode].refreshRate = out->modes[n_mode].refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
|
||||||
|
|
||||||
monitors[d] = monitor;
|
monitors[d] = monitor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,15 +96,22 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
|||||||
*ypos = monitor->mir.y;
|
*ypos = monitor->mir.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Break down the top function into these functions
|
|
||||||
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||||
{
|
{
|
||||||
return NULL;
|
GLFWvidmode* modes = NULL;
|
||||||
|
int i, count = monitor->modeCount;
|
||||||
|
|
||||||
|
modes = calloc(count, sizeof(GLFWvidmode));
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
modes[i] = monitor->modes[i];
|
||||||
|
|
||||||
|
*found = count;
|
||||||
|
return modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Break down the top function into these functions
|
|
||||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
|
*mode = monitor->modes[monitor->mir.cur_mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
|
@ -60,7 +60,7 @@ typedef struct _GLFWwindowMir
|
|||||||
|
|
||||||
typedef struct _GLFWmonitorMir
|
typedef struct _GLFWmonitorMir
|
||||||
{
|
{
|
||||||
int num_modes;
|
int cur_mode;
|
||||||
int output_id;
|
int output_id;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
Loading…
Reference in New Issue
Block a user