mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00: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:
parent
0f5b095042
commit
a7b6f35500
@ -345,6 +345,7 @@ information on what to include when reporting a bug.
|
||||
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
||||
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
||||
(#1991,#2115,#2127)
|
||||
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user