Fix hiding on window decorations not working with new CSD code

This commit is contained in:
Kovid Goyal 2021-04-01 12:32:48 +05:30
parent bbb40f2a21
commit a1669267b3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 12 deletions

View File

@ -159,6 +159,7 @@ create_csd_surfaces(_GLFWwindow *window, _GLFWWaylandCSDEdge *s) {
bool
ensure_csd_resources(_GLFWwindow *window) {
if (!window->decorated || window->wl.decorations.serverSide) return false;
const bool is_focused = window->id == _glfw.focusedWindowId;
const bool focus_changed = is_focused != decs.for_window_state.focused;
const bool size_changed = (
@ -212,11 +213,13 @@ free_all_csd_resources(_GLFWwindow *window) {
void
resize_csd(_GLFWwindow *window) {
if (!window->decorated || window->wl.decorations.serverSide) return;
ensure_csd_resources(window);
}
void
change_csd_title(_GLFWwindow *window) {
if (!window->decorated || window->wl.decorations.serverSide) return;
if (ensure_csd_resources(window)) return; // CSD were re-rendered for other reasons
if (decs.top.surface) {
update_title_bar(window);

16
glfw/wl_window.c vendored
View File

@ -257,13 +257,6 @@ static void dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, in
}
static void
createDecorations(_GLFWwindow* window) {
if (!window->decorated || window->wl.decorations.serverSide) return;
ensure_csd_resources(window);
}
static void xdgDecorationHandleConfigure(void* data,
struct zxdg_toplevel_decoration_v1* decoration UNUSED,
uint32_t mode)
@ -272,8 +265,7 @@ static void xdgDecorationHandleConfigure(void* data,
window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
if (!window->wl.decorations.serverSide)
createDecorations(window);
if (!window->wl.decorations.serverSide) ensure_csd_resources(window);
}
static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = {
@ -391,7 +383,7 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, bool on)
} else {
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
if (!_glfw.wl.decorationManager)
createDecorations(window);
ensure_csd_resources(window);
}
}
setIdleInhibitor(window, on);
@ -503,7 +495,7 @@ static void setXdgDecorations(_GLFWwindow* window)
else
{
window->wl.decorations.serverSide = false;
createDecorations(window);
ensure_csd_resources(window);
}
}
@ -1086,7 +1078,7 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
if (!window->monitor)
{
if (enabled)
createDecorations(window);
ensure_csd_resources(window);
else
free_csd_surfaces(window);
}