Improve handling of output names

Now can use panel --output-name list to list available outputs.
Also, --output-name works on macOS
This commit is contained in:
Kovid Goyal
2025-05-13 15:29:37 +05:30
parent 67c1ce7280
commit 88f4c829eb
15 changed files with 100 additions and 24 deletions

15
glfw/monitor.c vendored
View File

@@ -186,7 +186,8 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
_glfwFreeGammaArrays(&monitor->currentRamp);
free(monitor->modes);
free(monitor->name);
free((void*)monitor->name);
free((void*)monitor->description);
free(monitor);
}
@@ -393,9 +394,19 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return monitor->name;
return monitor->name ? monitor->name : "";
}
GLFWAPI const char* glfwGetMonitorDescription(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return monitor->description ? monitor->description : "";
}
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* handle, void* pointer)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;