mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 16:44:11 +00:00
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:
+6
-4
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user