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

Add the start of size of each monitor and modes.

This commit is contained in:
BrandonSchaefer 2014-11-06 00:26:39 -08:00 committed by Camilla Berglund
parent 50cf4cfda3
commit d76d56ce74
4 changed files with 78 additions and 27 deletions

View File

@ -43,7 +43,6 @@ int _glfwPlatformInit(void)
_glfw.mir.native_display = mir_connection_get_egl_native_display(_glfw.mir.connection);
// TODO Add in bits to get the correct monitors and screen sizes...
// Ill just hard code in my own right now to jump ahead to surface and events.

View File

@ -34,26 +34,68 @@
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
{
// FIXME Work out the best way to get this from mir, as we'll end up looping
// through all of that info... best to store it before we get here.
_GLFWmonitor** monitors = calloc(1, sizeof(_GLFWmonitor*));
return monitors;
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*));
// TODO Break this loop down into the other functions there
for (d = 0; d < display_config->num_outputs; d++)
{
MirDisplayOutput const* out = display_config->outputs + d;
if (out->used &&
out->connected &&
out->num_modes &&
out->current_mode < out->num_modes)
{
_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->modes = calloc(out->num_modes, sizeof(GLFWvidmode));
found++;
int n_mode;
for (n_mode = 0; n_mode < out->num_modes; n_mode++)
{
monitor->modes[n_mode].width = out->modes[n_mode].horizontal_resolution;
monitor->modes[n_mode].height = out->modes[n_mode].vertical_resolution;
monitor->modes[n_mode].refreshRate = out->modes[n_mode].refresh_rate;
}
monitors[d] = monitor;
}
}
*count = found;
mir_display_config_destroy(display_config);
return monitors;
}
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
return 0;
return first->mir.output_id == second->mir.output_id;
}
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
{
if (xpos)
*xpos = monitor->mir.x;
if (ypos)
*ypos = monitor->mir.y;
}
// FIXME Break down the top function into these functions
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
{
return NULL;
return NULL;
}
// FIXME Break down the top function into these functions
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
{
}

View File

@ -60,17 +60,21 @@ typedef struct _GLFWwindowMir
typedef struct _GLFWmonitorMir
{
int num_modes;
int output_id;
int x;
int y;
} _GLFWmonitorMir;
typedef struct _GLFWlibraryMir
{
MirConnection* connection;
MirEGLNativeDisplayType native_display;
} _GLFWlibraryMir;
// TODO Only system cursors are implemented in mir atm. Need to wait for support.
typedef struct _GLFWcursorMir
{
} _GLFWcursorMir;

View File

@ -381,6 +381,18 @@ void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
"Mir: Unsupported Function %s!\n", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported Function %s!\n", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported Function %s!\n", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@ -401,9 +413,19 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
{
mir_surface_set_type(window->mir.surface, mir_surface_state_restored);
}
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
mir_surface_set_type(window->mir.surface, mir_surface_state_minimized);
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
}
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
{
}
@ -426,24 +448,6 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* heigh
*height = window->mir.height;
}
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported Function %s!\n", __PRETTY_FUNCTION__);
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
}
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
{
}
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
{
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@ -458,6 +462,8 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported Function %s!\n", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)