mirror of
https://github.com/glfw/glfw.git
synced 2025-10-02 21:00:57 +00:00
Merge 6a7935b65e
into 1cbd06c8a2
This commit is contained in:
commit
0657c1b64b
@ -1363,10 +1363,6 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
|||||||
*
|
*
|
||||||
* @note The window manager may put limits on what positions are allowed.
|
* @note The window manager may put limits on what positions are allowed.
|
||||||
*
|
*
|
||||||
* @bug **X11:** Some window managers ignore the set position of hidden (i.e.
|
|
||||||
* unmapped) windows, instead placing them where it thinks is appropriate once
|
|
||||||
* they are shown.
|
|
||||||
*
|
|
||||||
* @sa glfwGetWindowPos
|
* @sa glfwGetWindowPos
|
||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
@ -1038,6 +1038,20 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
||||||
{
|
{
|
||||||
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
long flags;
|
||||||
|
|
||||||
|
XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &flags);
|
||||||
|
|
||||||
|
// Tell the window manager that we want to decide the initial position in case the window isn't open yet
|
||||||
|
|
||||||
|
hints->flags |= (PPosition | USPosition);
|
||||||
|
hints->x = xpos;
|
||||||
|
hints->y = ypos;
|
||||||
|
|
||||||
|
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||||
|
XFree(hints);
|
||||||
|
|
||||||
XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos);
|
XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos);
|
||||||
XFlush(_glfw.x11.display);
|
XFlush(_glfw.x11.display);
|
||||||
}
|
}
|
||||||
@ -1069,20 +1083,29 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
XSizeHints* hints = XAllocSizeHints();
|
||||||
|
long flags;
|
||||||
|
|
||||||
|
XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &flags);
|
||||||
|
|
||||||
|
// Tell the window manager that we want to decide the initial size in case the window isn't open yet
|
||||||
|
|
||||||
|
hints->flags |= (PSize | USSize);
|
||||||
|
hints->width = width;
|
||||||
|
hints->height = height;
|
||||||
|
|
||||||
if (!window->resizable)
|
if (!window->resizable)
|
||||||
{
|
{
|
||||||
// Update window size restrictions to match new window size
|
// Update window size restrictions to match new window size
|
||||||
|
|
||||||
XSizeHints* hints = XAllocSizeHints();
|
|
||||||
|
|
||||||
hints->flags |= (PMinSize | PMaxSize);
|
hints->flags |= (PMinSize | PMaxSize);
|
||||||
hints->min_width = hints->max_width = width;
|
hints->min_width = hints->max_width = width;
|
||||||
hints->min_height = hints->max_height = height;
|
hints->min_height = hints->max_height = height;
|
||||||
|
|
||||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
|
||||||
XFree(hints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||||
|
XFree(hints);
|
||||||
|
|
||||||
XResizeWindow(_glfw.x11.display, window->x11.handle, width, height);
|
XResizeWindow(_glfw.x11.display, window->x11.handle, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user