MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / _glfwInputMonitor

Function _glfwInputMonitor

extern/glfw/src/monitor.c:97–150  ·  view source on GitHub ↗

Notifies shared code of a monitor connection or disconnection

Source from the content-addressed store, hash-verified

95// Notifies shared code of a monitor connection or disconnection
96//
97void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
98{
99 if (action == GLFW_CONNECTED)
100 {
101 _glfw.monitorCount++;
102 _glfw.monitors =
103 realloc(_glfw.monitors, sizeof(_GLFWmonitor*) * _glfw.monitorCount);
104
105 if (placement == _GLFW_INSERT_FIRST)
106 {
107 memmove(_glfw.monitors + 1,
108 _glfw.monitors,
109 ((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
110 _glfw.monitors[0] = monitor;
111 }
112 else
113 _glfw.monitors[_glfw.monitorCount - 1] = monitor;
114 }
115 else if (action == GLFW_DISCONNECTED)
116 {
117 int i;
118 _GLFWwindow* window;
119
120 for (window = _glfw.windowListHead; window; window = window->next)
121 {
122 if (window->monitor == monitor)
123 {
124 int width, height, xoff, yoff;
125 _glfwPlatformGetWindowSize(window, &width, &height);
126 _glfwPlatformSetWindowMonitor(window, NULL, 0, 0, width, height, 0);
127 _glfwPlatformGetWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
128 _glfwPlatformSetWindowPos(window, xoff, yoff);
129 }
130 }
131
132 for (i = 0; i < _glfw.monitorCount; i++)
133 {
134 if (_glfw.monitors[i] == monitor)
135 {
136 _glfw.monitorCount--;
137 memmove(_glfw.monitors + i,
138 _glfw.monitors + i + 1,
139 ((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
140 break;
141 }
142 }
143 }
144
145 if (_glfw.callbacks.monitor)
146 _glfw.callbacks.monitor((GLFWmonitor*) monitor, action);
147
148 if (action == GLFW_DISCONNECTED)
149 _glfwFreeMonitor(monitor);
150}
151
152// Notifies shared code that a full screen window has acquired or released
153// a monitor

Callers 4

_glfwPollMonitorsX11Function · 0.85
_glfwPollMonitorsWin32Function · 0.85
outputHandleDoneFunction · 0.85

Calls 5

_glfwFreeMonitorFunction · 0.85

Tested by

no test coverage detected