mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 18:34:34 +00:00
CHANGE: Changed code to alllow ISO C90 compilation, why do we compile using a 32 years old standard with has been replaced more than once
This commit is contained in:
parent
5cdc469a86
commit
e01fb0f6de
37
src/window.c
37
src/window.c
@ -974,15 +974,30 @@ static _rect _get_intersection(_rect* ra, _rect* rb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI GLFWmonitor* glfwGetMonitorFromWindow(GLFWwindow* window)
|
GLFWAPI GLFWmonitor* glfwGetMonitorFromWindow(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
|
GLFWmonitor* result = NULL;
|
||||||
|
|
||||||
|
int monitorCount;
|
||||||
|
GLFWmonitor** monitors;
|
||||||
|
const GLFWvidmode* vidmode;
|
||||||
|
|
||||||
|
int windowWidth, windowHeight;
|
||||||
|
int windowFrameLeft, windowFrameTop, windowFrameRight, windowFrameBottom;
|
||||||
|
|
||||||
|
unsigned int currentDim, overlapDim;
|
||||||
|
int overlapMonitor;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
_rect windowRect;
|
||||||
|
_rect monitorRect;
|
||||||
|
_rect currentRect = { 0, 0, 0, 0 };
|
||||||
|
_rect overlapRect = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
|
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
GLFWmonitor* result = NULL;
|
monitors = glfwGetMonitors(&monitorCount);
|
||||||
|
|
||||||
int monitorCount;
|
|
||||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
|
||||||
|
|
||||||
if (monitorCount == 1)
|
if (monitorCount == 1)
|
||||||
{
|
{
|
||||||
@ -990,14 +1005,11 @@ GLFWAPI GLFWmonitor* glfwGetMonitorFromWindow(GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
else if (monitorCount > 1)
|
else if (monitorCount > 1)
|
||||||
{
|
{
|
||||||
_rect windowRect;
|
|
||||||
glfwGetWindowPos(window, &windowRect.x, &windowRect.y);
|
glfwGetWindowPos(window, &windowRect.x, &windowRect.y);
|
||||||
int windowWidth, windowHeight;
|
|
||||||
glfwGetWindowSize(window, &windowWidth, &windowHeight);
|
glfwGetWindowSize(window, &windowWidth, &windowHeight);
|
||||||
windowRect.w = windowWidth;
|
windowRect.w = windowWidth;
|
||||||
windowRect.h = windowHeight;
|
windowRect.h = windowHeight;
|
||||||
|
|
||||||
int windowFrameLeft, windowFrameTop, windowFrameRight, windowFrameBottom;
|
|
||||||
glfwGetWindowFrameSize(window, &windowFrameLeft, &windowFrameTop,
|
glfwGetWindowFrameSize(window, &windowFrameLeft, &windowFrameTop,
|
||||||
&windowFrameRight, &windowFrameBottom);
|
&windowFrameRight, &windowFrameBottom);
|
||||||
|
|
||||||
@ -1006,18 +1018,13 @@ GLFWAPI GLFWmonitor* glfwGetMonitorFromWindow(GLFWwindow* window)
|
|||||||
windowRect.w += windowFrameLeft + windowFrameRight;
|
windowRect.w += windowFrameLeft + windowFrameRight;
|
||||||
windowRect.h += windowFrameTop + windowFrameBottom;
|
windowRect.h += windowFrameTop + windowFrameBottom;
|
||||||
|
|
||||||
_rect currentRect = { 0, 0, 0, 0 };
|
overlapMonitor = -1;
|
||||||
_rect overlapRect = { 0, 0, 0, 0 };
|
|
||||||
unsigned int currentDim, overlapDim;
|
|
||||||
int overlapMonitor = -1;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
for (i = 0; i < monitorCount; i++)
|
||||||
{
|
{
|
||||||
_rect monitorRect;
|
|
||||||
glfwGetMonitorPos(monitors[i], &monitorRect.x, &monitorRect.y);
|
glfwGetMonitorPos(monitors[i], &monitorRect.x, &monitorRect.y);
|
||||||
|
|
||||||
const GLFWvidmode* vidmode = glfwGetVideoMode(monitors[i]);
|
vidmode = glfwGetVideoMode(monitors[i]);
|
||||||
monitorRect.w = vidmode->width;
|
monitorRect.w = vidmode->width;
|
||||||
monitorRect.h = vidmode->height;
|
monitorRect.h = vidmode->height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user