mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Merge branch 'master' into multi-monitor
Conflicts: include/GL/glfw3.h readme.html src/CMakeLists.txt src/win32_window.c src/window.c src/x11_window.c tests/clipboard.c tests/defaults.c tests/events.c tests/fsfocus.c tests/glfwinfo.c tests/joysticks.c tests/peter.c tests/sharing.c tests/tearing.c tests/title.c tests/windows.c
This commit is contained in:
+19
-14
@@ -119,7 +119,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
|
||||
window->X11.handle = XCreateWindow(_glfwLibrary.X11.display,
|
||||
_glfwLibrary.X11.root,
|
||||
0, 0,
|
||||
wndconfig->positionX, wndconfig->positionY,
|
||||
window->width, window->height,
|
||||
0, // Border width
|
||||
visual->depth, // Color depth
|
||||
@@ -136,6 +136,12 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
_glfwSetError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
// Request a window position to be set once the window is shown
|
||||
// (see _glfwPlatformShowWindow)
|
||||
window->X11.windowPosSet = GL_FALSE;
|
||||
window->X11.positionX = wndconfig->positionX;
|
||||
window->X11.positionY = wndconfig->positionY;
|
||||
}
|
||||
|
||||
if (window->monitor && !_glfwLibrary.X11.hasEWMH)
|
||||
@@ -633,7 +639,7 @@ static void processEvent(XEvent *event)
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
{
|
||||
if (_glfwLibrary.activeWindow != window)
|
||||
if (_glfwLibrary.focusedWindow != window)
|
||||
break;
|
||||
|
||||
x = event->xmotion.x - window->X11.cursorPosX;
|
||||
@@ -1016,16 +1022,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Set the window position.
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
||||
{
|
||||
XMoveWindow(_glfwLibrary.X11.display, window->X11.handle, x, y);
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Window iconification
|
||||
//========================================================================
|
||||
@@ -1070,6 +1066,15 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||
{
|
||||
XMapRaised(_glfwLibrary.X11.display, window->X11.handle);
|
||||
XFlush(_glfwLibrary.X11.display);
|
||||
|
||||
// Set the window position the first time the window is shown
|
||||
// Note: XMoveWindow has no effect before the window has been mapped.
|
||||
if (!window->X11.windowPosSet)
|
||||
{
|
||||
XMoveWindow(_glfwLibrary.X11.display, window->X11.handle,
|
||||
window->X11.positionX, window->X11.positionY);
|
||||
window->X11.windowPosSet = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1123,11 +1128,11 @@ void _glfwPlatformPollEvents(void)
|
||||
processEvent(&event);
|
||||
}
|
||||
|
||||
// Check whether the cursor has moved inside an active window that has
|
||||
// Check whether the cursor has moved inside an focused window that has
|
||||
// captured the cursor (because then it needs to be re-centered)
|
||||
|
||||
_GLFWwindow* window;
|
||||
window = _glfwLibrary.activeWindow;
|
||||
window = _glfwLibrary.focusedWindow;
|
||||
if (window)
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED &&
|
||||
|
||||
Reference in New Issue
Block a user