mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 15:23:17 +01:00
Wayland: Fix size limits for fallback decorations
The size limits set on our XDG surface did not include the sizes of the fallback decorations on all sides, when in use. This led to its content area being too small. Related to #2127
This commit is contained in:
@@ -617,13 +617,6 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
||||
if (window->wl.title)
|
||||
xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title);
|
||||
|
||||
if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE)
|
||||
xdg_toplevel_set_min_size(window->wl.xdg.toplevel,
|
||||
window->minwidth, window->minheight);
|
||||
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
|
||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel,
|
||||
window->maxwidth, window->maxheight);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel,
|
||||
@@ -642,6 +635,34 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
||||
setXdgDecorations(window);
|
||||
}
|
||||
|
||||
if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE)
|
||||
{
|
||||
int minwidth = window->minwidth;
|
||||
int minheight = window->minheight;
|
||||
|
||||
if (window->wl.decorations.top.surface)
|
||||
{
|
||||
minwidth += GLFW_BORDER_SIZE * 2;
|
||||
minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
|
||||
}
|
||||
|
||||
xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
|
||||
}
|
||||
|
||||
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
|
||||
{
|
||||
int maxwidth = window->maxwidth;
|
||||
int maxheight = window->maxheight;
|
||||
|
||||
if (window->wl.decorations.top.surface)
|
||||
{
|
||||
maxwidth += GLFW_BORDER_SIZE * 2;
|
||||
maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
|
||||
}
|
||||
|
||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
||||
}
|
||||
|
||||
wl_surface_commit(window->wl.surface);
|
||||
wl_display_roundtrip(_glfw.wl.display);
|
||||
|
||||
@@ -1877,8 +1898,26 @@ void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window,
|
||||
{
|
||||
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
|
||||
minwidth = minheight = 0;
|
||||
else
|
||||
{
|
||||
if (window->wl.decorations.top.surface)
|
||||
{
|
||||
minwidth += GLFW_BORDER_SIZE * 2;
|
||||
minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
|
||||
maxwidth = maxheight = 0;
|
||||
else
|
||||
{
|
||||
if (window->wl.decorations.top.surface)
|
||||
{
|
||||
maxwidth += GLFW_BORDER_SIZE * 2;
|
||||
maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
|
||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
||||
wl_surface_commit(window->wl.surface);
|
||||
|
||||
Reference in New Issue
Block a user