mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
parent
f69829f7b4
commit
980f955f6c
@ -215,15 +215,20 @@ void _glfwPollMonitorsNS(void)
|
|||||||
{
|
{
|
||||||
uint32_t i, j, displayCount, disconnectedCount;
|
uint32_t i, j, displayCount, disconnectedCount;
|
||||||
CGDirectDisplayID* displays;
|
CGDirectDisplayID* displays;
|
||||||
_GLFWmonitor** disconnected;
|
_GLFWmonitor** disconnected = NULL;
|
||||||
|
|
||||||
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
||||||
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||||
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||||
|
|
||||||
disconnectedCount = _glfw.monitorCount;
|
disconnectedCount = _glfw.monitorCount;
|
||||||
|
if (disconnectedCount)
|
||||||
|
{
|
||||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||||
memcpy(disconnected, _glfw.monitors, _glfw.monitorCount * sizeof(_GLFWmonitor*));
|
memcpy(disconnected,
|
||||||
|
_glfw.monitors,
|
||||||
|
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < displayCount; i++)
|
for (i = 0; i < displayCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -91,16 +91,19 @@ static _GLFWmonitor* createMonitor(DISPLAY_DEVICEW* adapter,
|
|||||||
void _glfwPollMonitorsWin32(void)
|
void _glfwPollMonitorsWin32(void)
|
||||||
{
|
{
|
||||||
int i, disconnectedCount;
|
int i, disconnectedCount;
|
||||||
_GLFWmonitor** disconnected;
|
_GLFWmonitor** disconnected = NULL;
|
||||||
DWORD adapterIndex, displayIndex;
|
DWORD adapterIndex, displayIndex;
|
||||||
DISPLAY_DEVICEW adapter, display;
|
DISPLAY_DEVICEW adapter, display;
|
||||||
GLFWbool hasDisplays = GLFW_FALSE;
|
GLFWbool hasDisplays = GLFW_FALSE;
|
||||||
|
|
||||||
disconnectedCount = _glfw.monitorCount;
|
disconnectedCount = _glfw.monitorCount;
|
||||||
|
if (disconnectedCount)
|
||||||
|
{
|
||||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||||
memcpy(disconnected,
|
memcpy(disconnected,
|
||||||
_glfw.monitors,
|
_glfw.monitors,
|
||||||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||||
|
}
|
||||||
|
|
||||||
// HACK: Check if any active adapters have connected displays
|
// HACK: Check if any active adapters have connected displays
|
||||||
// If not, this is a headless system or a VMware guest
|
// If not, this is a headless system or a VMware guest
|
||||||
|
@ -102,7 +102,7 @@ void _glfwPollMonitorsX11(void)
|
|||||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
int i, j, disconnectedCount, screenCount = 0;
|
int i, j, disconnectedCount, screenCount = 0;
|
||||||
_GLFWmonitor** disconnected;
|
_GLFWmonitor** disconnected = NULL;
|
||||||
XineramaScreenInfo* screens = NULL;
|
XineramaScreenInfo* screens = NULL;
|
||||||
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display,
|
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display,
|
||||||
_glfw.x11.root);
|
_glfw.x11.root);
|
||||||
@ -113,10 +113,13 @@ void _glfwPollMonitorsX11(void)
|
|||||||
screens = XineramaQueryScreens(_glfw.x11.display, &screenCount);
|
screens = XineramaQueryScreens(_glfw.x11.display, &screenCount);
|
||||||
|
|
||||||
disconnectedCount = _glfw.monitorCount;
|
disconnectedCount = _glfw.monitorCount;
|
||||||
|
if (disconnectedCount)
|
||||||
|
{
|
||||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||||
memcpy(disconnected,
|
memcpy(disconnected,
|
||||||
_glfw.monitors,
|
_glfw.monitors,
|
||||||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < sr->noutput; i++)
|
for (i = 0; i < sr->noutput; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user