Replaced glfwGetMonitorParam with glfwGetMonitor*.

Having one way to retrieve the cursor position and another (more
verbose) way to retrieve the monitor position is inconsistent.  Having
them both work the same way is the least surprising thing.

The expected glfwGetMonitorSize function gets an added Physical in its
name so users won't confuse it with glfwGetVideoMode.
This commit is contained in:
Camilla Berglund
2013-01-24 19:10:17 +01:00
parent cb02a693b4
commit ee5f30ea8f
5 changed files with 44 additions and 45 deletions
+6 -4
View File
@@ -344,17 +344,19 @@ void monitor_callback(GLFWmonitor* monitor, int event)
{
if (event == GLFW_CONNECTED)
{
int x, y, widthMM, heightMM;
GLFWvidmode mode = glfwGetVideoMode(monitor);
glfwGetMonitorPos(monitor, &x, &y);
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
printf("%08x at %0.3f: Monitor %s (%ix%i at %ix%i, %ix%i mm) was connected\n",
counter++,
glfwGetTime(),
glfwGetMonitorName(monitor),
mode.width, mode.height,
glfwGetMonitorParam(monitor, GLFW_POSITION_X),
glfwGetMonitorParam(monitor, GLFW_POSITION_Y),
glfwGetMonitorParam(monitor, GLFW_MONITOR_WIDTH_MM),
glfwGetMonitorParam(monitor, GLFW_MONITOR_HEIGHT_MM));
x, y,
widthMM, heightMM);
}
else
{
+5 -6
View File
@@ -92,20 +92,19 @@ static void key_callback(GLFWwindow* window, int key, int action)
static void list_modes(GLFWmonitor* monitor)
{
int count, widthMM, heightMM, dpi, i;
int count, x, y, widthMM, heightMM, dpi, i;
GLFWvidmode mode = glfwGetVideoMode(monitor);
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
glfwGetMonitorPos(monitor, &x, &y);
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
printf("Name: %s (%s)\n",
glfwGetMonitorName(monitor),
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
printf("Current mode: %s\n", format_mode(&mode));
printf("Virtual position: %i %i\n",
glfwGetMonitorParam(monitor, GLFW_POSITION_X),
glfwGetMonitorParam(monitor, GLFW_POSITION_Y));
printf("Virtual position: %i %i\n", x, y);
widthMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_WIDTH_MM);
heightMM = glfwGetMonitorParam(monitor, GLFW_MONITOR_HEIGHT_MM);
dpi = (int) ((float) mode.width * 25.4f / (float) widthMM);
printf("Physical size: %i x %i mm (%i dpi)\n", widthMM, heightMM, dpi);