Added proper monitor comparison.
This commit is contained in:
parent
2891c9629f
commit
7405bc48cd
@ -305,6 +305,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||||
|
{
|
||||||
|
return first->ns.displayID == second->ns.displayID;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
|
const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
|
||||||
|
@ -363,6 +363,16 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
|
|||||||
*/
|
*/
|
||||||
_GLFWmonitor** _glfwPlatformGetMonitors(int* count);
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count);
|
||||||
|
|
||||||
|
/*! @brief Checks whether two monitor objects represent the same monitor.
|
||||||
|
*
|
||||||
|
* @param[in] first The first monitor.
|
||||||
|
* @param[in] second The second monitor.
|
||||||
|
* @return @c GL_TRUE if the monitor objects represent the same monitor, or @c
|
||||||
|
* GL_FALSE otherwise.
|
||||||
|
* @ingroup platform
|
||||||
|
*/
|
||||||
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second);
|
||||||
|
|
||||||
/*! @copydoc glfwGetMonitorPos
|
/*! @copydoc glfwGetMonitorPos
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
|
@ -106,7 +106,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
if (_glfw.monitors[j] == NULL)
|
if (_glfw.monitors[j] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(monitors[i]->name, _glfw.monitors[j]->name) == 0)
|
if (_glfwPlatformIsSameMonitor(monitors[i], _glfw.monitors[j]))
|
||||||
{
|
{
|
||||||
// This monitor was connected before, so re-use the existing
|
// This monitor was connected before, so re-use the existing
|
||||||
// monitor object to preserve its address and user pointer
|
// monitor object to preserve its address and user pointer
|
||||||
|
@ -174,6 +174,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||||
|
{
|
||||||
|
return wcscmp(first->win32.name, second->win32.name);
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
DEVMODE settings;
|
DEVMODE settings;
|
||||||
|
@ -224,6 +224,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* found)
|
|||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
||||||
|
{
|
||||||
|
return first->x11.crtc == second->x11.crtc;
|
||||||
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available)
|
||||||
|
Loading…
Reference in New Issue
Block a user