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
(cherry picked from commit a7b6f35500
)
This commit is contained in:
parent
cdbcb8c5a7
commit
fead23153e
@ -164,6 +164,7 @@ information on what to include when reporting a bug.
|
|||||||
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
||||||
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
||||||
(#1991,#2115,#2127)
|
(#1991,#2115,#2127)
|
||||||
|
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
@ -660,13 +660,6 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
|||||||
if (window->wl.title)
|
if (window->wl.title)
|
||||||
xdg_toplevel_set_title(window->wl.xdg.toplevel, 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)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel,
|
xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel,
|
||||||
@ -685,6 +678,34 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
|||||||
setXdgDecorations(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_surface_commit(window->wl.surface);
|
||||||
wl_display_roundtrip(_glfw.wl.display);
|
wl_display_roundtrip(_glfw.wl.display);
|
||||||
|
|
||||||
@ -1941,8 +1962,26 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
|
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
|
||||||
minwidth = minheight = 0;
|
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)
|
if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
|
||||||
maxwidth = maxheight = 0;
|
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_min_size(window->wl.xdg.toplevel, minwidth, minheight);
|
||||||
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
|
||||||
wl_surface_commit(window->wl.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user