mirror of
https://github.com/glfw/glfw.git
synced 2026-09-20 16:30:45 +00:00
Fixed cursor outside new full screen windows.
The cursor was not positioned over newly created full screen windows, leading to confusing behavior like invisible cursor or window iconification. This fix is a stop-gap until the direct cursor position work is merged. Fixes #111.
This commit is contained in:
+15
-2
@@ -246,8 +246,21 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
// Restore the previously current context (or NULL)
|
||||
_glfwPlatformMakeContextCurrent(previous);
|
||||
|
||||
if (wndconfig.monitor == NULL && wndconfig.visible)
|
||||
_glfwPlatformShowWindow(window);
|
||||
if (wndconfig.monitor)
|
||||
{
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
|
||||
window->cursorPosX = width / 2;
|
||||
window->cursorPosY = height / 2;
|
||||
|
||||
_glfwPlatformSetCursorPos(window, window->cursorPosX, window->cursorPosY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig.visible)
|
||||
_glfwPlatformShowWindow(window);
|
||||
}
|
||||
|
||||
return (GLFWwindow*) window;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user