Added more input functions to clarify internal API.

This commit is contained in:
Camilla Berglund
2011-10-09 17:10:40 +02:00
parent 792034c42d
commit d0840bdea1
5 changed files with 109 additions and 104 deletions
+14 -42
View File
@@ -1194,33 +1194,27 @@ static void processSingleEvent(void)
event.xmotion.y != window->X11.cursorPosY)
{
// The mouse cursor was moved and we didn't do it
int x, y;
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
{
if (_glfwLibrary.activeWindow != window)
break;
window->mousePosX += event.xmotion.x -
window->X11.cursorPosX;
window->mousePosY += event.xmotion.y -
window->X11.cursorPosY;
x = event.xmotion.x - window->X11.cursorPosX;
y = event.xmotion.y - window->X11.cursorPosY;
}
else
{
window->mousePosX = event.xmotion.x;
window->mousePosY = event.xmotion.y;
x = event.xmotion.x;
x = event.xmotion.y;
}
window->X11.cursorPosX = event.xmotion.x;
window->X11.cursorPosY = event.xmotion.y;
window->X11.cursorCentered = GL_FALSE;
if (_glfwLibrary.mousePosCallback)
{
_glfwLibrary.mousePosCallback(window,
window->mousePosX,
window->mousePosY);
}
_glfwInputCursorMotion(window, x, y);
}
break;
@@ -1236,27 +1230,13 @@ static void processSingleEvent(void)
return;
}
if (event.xconfigure.width != window->width ||
event.xconfigure.height != window->height)
{
// The window was resized
_glfwInputWindowSize(window,
event.xconfigure.width,
event.xconfigure.height);
window->width = event.xconfigure.width;
window->height = event.xconfigure.height;
if (_glfwLibrary.windowSizeCallback)
{
_glfwLibrary.windowSizeCallback(window,
window->width,
window->height);
}
}
if (event.xconfigure.x != window->positionX ||
event.xconfigure.y != window->positionY)
{
window->positionX = event.xconfigure.x;
window->positionY = event.xconfigure.y;
}
_glfwInputWindowPos(window,
event.xconfigure.x,
event.xconfigure.y);
break;
}
@@ -1305,11 +1285,7 @@ static void processSingleEvent(void)
return;
}
window->iconified = GL_FALSE;
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
_glfwInputWindowIconify(window, GL_FALSE);
break;
}
@@ -1323,11 +1299,7 @@ static void processSingleEvent(void)
return;
}
window->iconified = GL_TRUE;
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
_glfwInputWindowIconify(window, GL_TRUE);
break;
}