diff --git a/docs/changelog.rst b/docs/changelog.rst index 1b417512697..6e649be6ece 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -48,6 +48,8 @@ Detailed list of changes - macOS: Fix a regression that caused the titlebar to be translucent even for non-translucent windows (:iss:`6450`) +- GNOME: Fix :opt:`wayland_titlebar_color` not being applied until the color is changed at least once (:iss:`6447`) + - Remote control launch: Fix ``--env`` not implemented when using ``--cwd=current`` with the SSH kitten (:iss:`6438`) 0.29.0 [2023-07-10] diff --git a/kitty/glfw.c b/kitty/glfw.c index fc16d469580..97b16f3ffa2 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -920,9 +920,9 @@ init_window_chrome_state(WindowChromeState *s, color_type active_window_bg, bool s->background_opacity = background_opacity; } -#ifdef __APPLE__ static void apply_window_chrome_state(GLFWwindow *w, WindowChromeState new_state, int width, int height, bool window_decorations_changed) { +#ifdef __APPLE__ glfwCocoaSetWindowChrome(w, new_state.color, new_state.use_system_color, new_state.system_color, new_state.background_blur, new_state.hide_window_decorations, @@ -931,8 +931,19 @@ apply_window_chrome_state(GLFWwindow *w, WindowChromeState new_state, int width, ); // Need to resize the window again after hiding decorations or title bar to take up screen space if (window_decorations_changed) glfwSetWindowSize(w, width, height); -} +#else + if (window_decorations_changed) { + bool hide_window_decorations = new_state.hide_window_decorations & 1; + glfwSetWindowAttrib(w, GLFW_DECORATED, !hide_window_decorations); + glfwSetWindowSize(w, width, height); + } + if (global_state.is_wayland) { + if (glfwWaylandSetTitlebarColor) glfwWaylandSetTitlebarColor(w, new_state.color, new_state.use_system_color); + } else { + glfwSetX11WindowBlurred(w, new_state.background_blur > 0); + } #endif +} void set_os_window_chrome(OSWindow *w) { @@ -955,20 +966,7 @@ set_os_window_chrome(OSWindow *w) { int width, height; glfwGetWindowSize(w->handle, &width, &height); bool window_decorations_changed = new_state.hide_window_decorations != w->last_window_chrome.hide_window_decorations; -#ifdef __APPLE__ apply_window_chrome_state(w->handle, new_state, width, height, window_decorations_changed); -#else - if (window_decorations_changed) { - bool hide_window_decorations = new_state.hide_window_decorations & 1; - glfwSetWindowAttrib(w->handle, GLFW_DECORATED, !hide_window_decorations); - glfwSetWindowSize(w->handle, width, height); - } - if (global_state.is_wayland) { - if (glfwWaylandSetTitlebarColor) glfwWaylandSetTitlebarColor(w->handle, new_state.color, new_state.use_system_color); - } else { - glfwSetX11WindowBlurred(w->handle, new_state.background_blur > 0); - } -#endif w->last_window_chrome = new_state; } } @@ -1171,6 +1169,8 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) { init_window_chrome_state(&w->last_window_chrome, OPT(background), w->is_semi_transparent, w->background_opacity); #ifdef __APPLE__ apply_window_chrome_state(w->handle, w->last_window_chrome, width, height, OPT(hide_window_decorations) != 0); +#else + apply_window_chrome_state(w->handle, w->last_window_chrome, width, height, false); #endif // Update window state // We do not call glfwWindowHint to set GLFW_MAXIMIZED before the window is created.