mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
@@ -1632,6 +1632,61 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
||||
int minwidth, int minheight,
|
||||
int maxwidth, int maxheight)
|
||||
{
|
||||
long supplied;
|
||||
XSizeHints* hints = XAllocSizeHints();
|
||||
|
||||
if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied))
|
||||
{
|
||||
if (minwidth == GLFW_DONT_CARE || minwidth == GLFW_DONT_CARE)
|
||||
hints->flags &= ~PMinSize;
|
||||
else
|
||||
{
|
||||
hints->flags |= PMinSize;
|
||||
hints->min_width = minwidth;
|
||||
hints->min_height = minheight;
|
||||
}
|
||||
|
||||
if (maxwidth == GLFW_DONT_CARE || maxwidth == GLFW_DONT_CARE)
|
||||
hints->flags &= ~PMaxSize;
|
||||
else
|
||||
{
|
||||
hints->flags |= PMaxSize;
|
||||
hints->max_width = maxwidth;
|
||||
hints->max_height = maxheight;
|
||||
}
|
||||
|
||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||
}
|
||||
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
|
||||
{
|
||||
long supplied;
|
||||
XSizeHints* hints = XAllocSizeHints();
|
||||
|
||||
if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied))
|
||||
{
|
||||
if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE)
|
||||
hints->flags &= ~PAspect;
|
||||
else
|
||||
{
|
||||
hints->flags |= PAspect;
|
||||
hints->min_aspect.x = hints->max_aspect.x = numer;
|
||||
hints->min_aspect.y = hints->max_aspect.y = denom;
|
||||
}
|
||||
|
||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||
}
|
||||
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
|
||||
{
|
||||
_glfwPlatformGetWindowSize(window, width, height);
|
||||
|
||||
Reference in New Issue
Block a user