From 0331c873f90e3570bc4d2321aacce82f25a6d89c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 30 Oct 2026 09:07:45 +0530 Subject: [PATCH] Run autoformat --- glfw/glfw3.h | 2 +- glfw/linux_desktop_settings.c | 85 +++++++++++++----- glfw/linux_desktop_settings.h | 15 +--- glfw/wl_client_side_decorations.c | 139 ++++++++++++++++-------------- glfw/wl_platform.h | 2 +- kitty/glfw.c | 4 +- 6 files changed, 146 insertions(+), 101 deletions(-) diff --git a/glfw/glfw3.h b/glfw/glfw3.h index 449f2424e..6a10167af 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -1421,7 +1421,7 @@ typedef struct GLFWLayerShellConfig { } GLFWLayerShellConfig; typedef struct GLFWTitlebarFont { - const char *family; // NULL means use the default font + const char *family; // NULL means use the default font double point_size, text_scale; bool bold, italic; } GLFWTitlebarFont; diff --git a/glfw/linux_desktop_settings.c b/glfw/linux_desktop_settings.c index a95c5527f..61e7f91be 100644 --- a/glfw/linux_desktop_settings.c +++ b/glfw/linux_desktop_settings.c @@ -32,18 +32,20 @@ GLFWTitlebarAction glfw_current_titlebar_action(GLFWTitlebarGesture gesture) { return gesture < arraysz(titlebar_actions) ? titlebar_actions[gesture] : TITLEBAR_ACTION_NONE; } -static GLFWTitlebarButtonLayout button_layout = { - .right = {TITLEBAR_BUTTON_MINIMIZE, TITLEBAR_BUTTON_MAXIMIZE, TITLEBAR_BUTTON_CLOSE}, .right_count = 3}; +static GLFWTitlebarButtonLayout button_layout = {.right = {TITLEBAR_BUTTON_MINIMIZE, TITLEBAR_BUTTON_MAXIMIZE, TITLEBAR_BUTTON_CLOSE}, .right_count = 3}; const GLFWTitlebarButtonLayout * -glfw_current_titlebar_button_layout(void) { return &button_layout; } +glfw_current_titlebar_button_layout(void) { + return &button_layout; +} static char current_titlebar_family[256]; static GLFWTitlebarFont current_titlebar_font = {.point_size = 11, .text_scale = 1, .bold = true}; static bool is_one_of(const char *word, const char **names) { - for (; *names; names++) if (strcasecmp(word, *names) == 0) return true; + for (; *names; names++) + if (strcasecmp(word, *names) == 0) return true; return false; } @@ -64,15 +66,53 @@ parse_font_description(const char *description, bool default_bold, char *family, // Parses the subset of Pango font descriptions used in practice: // "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE[px]]" static const char *bold_weights[] = { - "semi-bold", "semibold", "demi-bold", "demibold", "bold", "ultra-bold", "ultrabold", "extra-bold", "extrabold", - "heavy", "ultra-heavy", "ultraheavy", "black", "ultra-black", "ultrablack", "extra-black", "extrablack", NULL}; + "semi-bold", + "semibold", + "demi-bold", + "demibold", + "bold", + "ultra-bold", + "ultrabold", + "extra-bold", + "extrabold", + "heavy", + "ultra-heavy", + "ultraheavy", + "black", + "ultra-black", + "ultrablack", + "extra-black", + "extrablack", + NULL}; static const char *normal_weights[] = { - "thin", "ultra-light", "ultralight", "extra-light", "extralight", "light", "semi-light", "semilight", "demi-light", - "demilight", "book", "regular", "normal", "medium", "roman", NULL}; + "thin", + "ultra-light", + "ultralight", + "extra-light", + "extralight", + "light", + "semi-light", + "semilight", + "demi-light", + "demilight", + "book", + "regular", + "normal", + "medium", + "roman", + NULL}; static const char *italic_styles[] = {"italic", "oblique", NULL}; static const char *ignored_styles[] = { - "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", - "extra-expanded", "ultra-expanded", "small-caps", NULL}; + "ultra-condensed", + "extra-condensed", + "condensed", + "semi-condensed", + "semi-expanded", + "expanded", + "extra-expanded", + "ultra-expanded", + "small-caps", + NULL}; char buf[256]; snprintf(buf, sizeof(buf), "%s", description ? description : ""); ans->point_size = 11; @@ -110,7 +150,9 @@ parse_font_description(const char *description, bool default_bold, char *family, } const GLFWTitlebarFont * -glfw_current_titlebar_font(void) { return ¤t_titlebar_font; } +glfw_current_titlebar_font(void) { + return ¤t_titlebar_font; +} unsigned glfw_current_titlebar_height(void) { @@ -124,8 +166,7 @@ redraw_titlebars(void) { const bool use_system_font = titlebar_uses_system_font || !titlebar_font[0]; // GNOME uses a bold version of the interface font for titles parse_font_description( - use_system_font ? interface_font : titlebar_font, use_system_font, current_titlebar_family, sizeof(current_titlebar_family), - ¤t_titlebar_font); + use_system_font ? interface_font : titlebar_font, use_system_font, current_titlebar_family, sizeof(current_titlebar_family), ¤t_titlebar_font); current_titlebar_font.text_scale = titlebar_text_scale; #ifndef _GLFW_X11 _glfwPlatformTitlebarSettingsChanged(); @@ -151,9 +192,10 @@ parse_button_layout(const char *value, GLFWTitlebarButtonLayout *out) { while (*token == ' ') token++; char *end = token + strlen(token); while (end > token && end[-1] == ' ') *--end = 0; - const GLFWTitlebarButton id = strcmp(token, "close") == 0 ? TITLEBAR_BUTTON_CLOSE : - strcmp(token, "maximize") == 0 ? TITLEBAR_BUTTON_MAXIMIZE : - strcmp(token, "minimize") == 0 ? TITLEBAR_BUTTON_MINIMIZE : TITLEBAR_BUTTON_NONE; + const GLFWTitlebarButton id = strcmp(token, "close") == 0 ? TITLEBAR_BUTTON_CLOSE + : strcmp(token, "maximize") == 0 ? TITLEBAR_BUTTON_MAXIMIZE + : strcmp(token, "minimize") == 0 ? TITLEBAR_BUTTON_MINIMIZE + : TITLEBAR_BUTTON_NONE; if (id && !seen[id]) { seen[id] = true; if (side) out->right[out->right_count++] = id; @@ -203,9 +245,10 @@ process_wm_setting(const char *key, DBusMessageIter *value) { const char *name; dbus_message_iter_get_basic(value, &name); // xdg-shell has no lower/shade or one-axis maximize request. - GLFWTitlebarAction action = strcmp(name, "menu") == 0 ? TITLEBAR_ACTION_MENU : - strcmp(name, "toggle-maximize") == 0 ? TITLEBAR_ACTION_MAXIMIZE : - strcmp(name, "minimize") == 0 ? TITLEBAR_ACTION_MINIMIZE : TITLEBAR_ACTION_NONE; + GLFWTitlebarAction action = strcmp(name, "menu") == 0 ? TITLEBAR_ACTION_MENU + : strcmp(name, "toggle-maximize") == 0 ? TITLEBAR_ACTION_MAXIMIZE + : strcmp(name, "minimize") == 0 ? TITLEBAR_ACTION_MINIMIZE + : TITLEBAR_ACTION_NONE; changed |= action != titlebar_actions[i]; titlebar_actions[i] = action; break; @@ -519,8 +562,8 @@ setting_changed(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data U if (strcmp(key, FDO_APPEARANCE_KEY) == 0) { on_color_scheme_change(msg); } } else if (strcmp(namespace, GNOME_DESKTOP_NAMESPACE) == 0 || strcmp(namespace, GNOME_WM_NAMESPACE) == 0) { DBusMessageIter iter, value; - if (dbus_message_iter_init(msg, &iter) && dbus_message_iter_next(&iter) && dbus_message_iter_next(&iter) - && dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { + if (dbus_message_iter_init(msg, &iter) && dbus_message_iter_next(&iter) && dbus_message_iter_next(&iter) && + dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { dbus_message_iter_recurse(&iter, &value); if (strcmp(namespace, GNOME_WM_NAMESPACE) == 0) process_wm_setting(key, &value); else process_gnome_setting(key, &value); diff --git a/glfw/linux_desktop_settings.h b/glfw/linux_desktop_settings.h index ad4086b5c..9122d1c7f 100644 --- a/glfw/linux_desktop_settings.h +++ b/glfw/linux_desktop_settings.h @@ -15,13 +15,7 @@ void glfw_wait_for_desktop_settings(monotonic_t timeout); void glfw_current_cursor_theme(const char **theme, int *size); GLFWColorScheme glfw_current_system_color_theme(bool); -typedef enum { - TITLEBAR_BUTTON_NONE, - TITLEBAR_BUTTON_CLOSE, - TITLEBAR_BUTTON_MAXIMIZE, - TITLEBAR_BUTTON_MINIMIZE, - TITLEBAR_BUTTON_COUNT -} GLFWTitlebarButton; +typedef enum { TITLEBAR_BUTTON_NONE, TITLEBAR_BUTTON_CLOSE, TITLEBAR_BUTTON_MAXIMIZE, TITLEBAR_BUTTON_MINIMIZE, TITLEBAR_BUTTON_COUNT } GLFWTitlebarButton; typedef struct { GLFWTitlebarButton left[TITLEBAR_BUTTON_COUNT - 1], right[TITLEBAR_BUTTON_COUNT - 1]; @@ -29,12 +23,7 @@ typedef struct { } GLFWTitlebarButtonLayout; typedef enum { TITLEBAR_ACTION_NONE, TITLEBAR_ACTION_MENU, TITLEBAR_ACTION_MAXIMIZE, TITLEBAR_ACTION_MINIMIZE } GLFWTitlebarAction; -typedef enum { - TITLEBAR_GESTURE_DOUBLE_CLICK, - TITLEBAR_GESTURE_MIDDLE_CLICK, - TITLEBAR_GESTURE_RIGHT_CLICK, - TITLEBAR_GESTURE_COUNT -} GLFWTitlebarGesture; +typedef enum { TITLEBAR_GESTURE_DOUBLE_CLICK, TITLEBAR_GESTURE_MIDDLE_CLICK, TITLEBAR_GESTURE_RIGHT_CLICK, TITLEBAR_GESTURE_COUNT } GLFWTitlebarGesture; GLFWTitlebarAction glfw_current_titlebar_action(GLFWTitlebarGesture gesture); const GLFWTitlebarButtonLayout *glfw_current_titlebar_button_layout(void); unsigned glfw_current_titlebar_height(void); diff --git a/glfw/wl_client_side_decorations.c b/glfw/wl_client_side_decorations.c index 3a3ec977e..c942a73d5 100644 --- a/glfw/wl_client_side_decorations.c +++ b/glfw/wl_client_side_decorations.c @@ -129,21 +129,22 @@ create_shadow_tile(_GLFWwindow *window) { if (!mask) return margin; st.data = malloc(sizeof(st.data[0]) * st.stride * st.stride); if (st.data) - for (size_t y = 0; y < st.stride; y++) for (size_t x = 0; x < st.stride; x++) { - double alpha = mask[y * st.stride + x]; - // The blur has finite buffers. Fade to a rounded outer envelope - // instead of exposing their rectangular edges on the desktop. - const double feather = fmax(1, 3 * decs.for_window_state.fscale); - const bool upper = y < st.stride / 2; - const double radius = margin * (upper && !decs.titlebar_hidden ? 2. : 1.); - const double dx = fmax(radius - x - .5, x + .5 - (st.stride - radius)); - const double dy = upper ? radius - y - .5 : y + .5 - (st.stride - radius); - double distance = fmin(fmin(x + .5, st.stride - x - .5), fmin(y + .5, st.stride - y - .5)); - if (dx > 0 && dy > 0) distance = radius - hypot(dx, dy); - double coverage = fmax(0, fmin(1, distance / feather)); - alpha *= coverage * coverage * (3 - 2 * coverage); - st.data[y * st.stride + x] = ((uint32_t)(alpha * 255)) << 24; - } + for (size_t y = 0; y < st.stride; y++) + for (size_t x = 0; x < st.stride; x++) { + double alpha = mask[y * st.stride + x]; + // The blur has finite buffers. Fade to a rounded outer envelope + // instead of exposing their rectangular edges on the desktop. + const double feather = fmax(1, 3 * decs.for_window_state.fscale); + const bool upper = y < st.stride / 2; + const double radius = margin * (upper && !decs.titlebar_hidden ? 2. : 1.); + const double dx = fmax(radius - x - .5, x + .5 - (st.stride - radius)); + const double dy = upper ? radius - y - .5 : y + .5 - (st.stride - radius); + double distance = fmin(fmin(x + .5, st.stride - x - .5), fmin(y + .5, st.stride - y - .5)); + if (dx > 0 && dy > 0) distance = radius - hypot(dx, dy); + double coverage = fmax(0, fmin(1, distance / feather)); + alpha *= coverage * coverage * (3 - 2 * coverage); + st.data[y * st.stride + x] = ((uint32_t)(alpha * 255)) << 24; + } free(mask); return margin; } @@ -301,7 +302,8 @@ is_titlebar_button_available(_GLFWwindow *window, GLFWTitlebarButton which) { case TITLEBAR_BUTTON_CLOSE: return true; case TITLEBAR_BUTTON_MAXIMIZE: return window->wl.wm_capabilities.maximize; case TITLEBAR_BUTTON_MINIMIZE: return window->wl.wm_capabilities.minimize; - case TITLEBAR_BUTTON_NONE: case TITLEBAR_BUTTON_COUNT: break; + case TITLEBAR_BUTTON_NONE: + case TITLEBAR_BUTTON_COUNT: break; } return false; } @@ -337,11 +339,12 @@ layout_titlebar_buttons(_GLFWwindow *window, int width, int slot, int pad, Place for (unsigned side = 0; side < 2; side++) { const GLFWTitlebarButton *buttons = side ? layout->right : layout->left; const unsigned n = side ? layout->right_count : layout->left_count; - for (unsigned i = 0; i < n; i++) if (visible[buttons[i]]) side_count[side]++; + for (unsigned i = 0; i < n; i++) + if (visible[buttons[i]]) side_count[side]++; int left = side ? width - pad - side_count[side] * slot : pad; for (unsigned i = 0; i < n; i++) { if (visible[buttons[i]]) { - visible[buttons[i]] = false; // guard against duplicates + visible[buttons[i]] = false; // guard against duplicates ans[used].which = buttons[i]; ans[used++].left = left; left += slot; @@ -354,27 +357,35 @@ layout_titlebar_buttons(_GLFWwindow *window, int width, int slot, int pad, Place static void render_titlebar_button( - uint32_t *pixels, int width, int height, int left, int slot, double scale, GLFWTitlebarButton which, bool maximized, uint32_t fill, - uint32_t fg, uint32_t bg) { - for (int y = 0; y < height; y++) for (int x = left; x < left + slot; x++) { - const double lx = (x + .5 - left - slot / 2.) / scale, ly = (y + .5 - height / 2.) / scale; - // a circle of radius 12 with the icon drawn as lines of width 1 - const double coverage = fmax(0, fmin(1, (12 - hypot(lx, ly)) * scale + .5)); - double d; - switch (which) { - case TITLEBAR_BUTTON_CLOSE: - d = fmin(segment_distance(lx, ly, -4, -4, 4, 4), segment_distance(lx, ly, -4, 4, 4, -4)); - break; - case TITLEBAR_BUTTON_MINIMIZE: d = segment_distance(lx, ly, -4, 3, 4, 3); break; - default: { - const double bx = fabs(lx) - 3.5, by = fabs(ly) - 3.5; - d = (bx > 0 || by > 0) ? hypot(fmax(0, bx), fmax(0, by)) : fmin(-bx, -by); - if (maximized && fmin(segment_distance(lx, ly, -1, -5, 5, -5), segment_distance(lx, ly, 5, -5, 5, 1)) < .75) d = 0; - } break; + uint32_t *pixels, + int width, + int height, + int left, + int slot, + double scale, + GLFWTitlebarButton which, + bool maximized, + uint32_t fill, + uint32_t fg, + uint32_t bg) { + for (int y = 0; y < height; y++) + for (int x = left; x < left + slot; x++) { + const double lx = (x + .5 - left - slot / 2.) / scale, ly = (y + .5 - height / 2.) / scale; + // a circle of radius 12 with the icon drawn as lines of width 1 + const double coverage = fmax(0, fmin(1, (12 - hypot(lx, ly)) * scale + .5)); + double d; + switch (which) { + case TITLEBAR_BUTTON_CLOSE: d = fmin(segment_distance(lx, ly, -4, -4, 4, 4), segment_distance(lx, ly, -4, 4, 4, -4)); break; + case TITLEBAR_BUTTON_MINIMIZE: d = segment_distance(lx, ly, -4, 3, 4, 3); break; + default: { + const double bx = fabs(lx) - 3.5, by = fabs(ly) - 3.5; + d = (bx > 0 || by > 0) ? hypot(fmax(0, bx), fmax(0, by)) : fmin(-bx, -by); + if (maximized && fmin(segment_distance(lx, ly, -1, -5, 5, -5), segment_distance(lx, ly, 5, -5, 5, 1)) < .75) d = 0; + } break; + } + const double ink = (.5 - d) * scale + .5; + pixels[y * width + x] = blend_colors(bg, blend_colors(fill, fg, ink), coverage); } - const double ink = (.5 - d) * scale + .5; - pixels[y * width + x] = blend_colors(bg, blend_colors(fill, fg, ink), coverage); - } } // Rounds the upper corners of the titlebar, filling the cutouts with the @@ -383,21 +394,22 @@ static void render_titlebar_corners(_GLFWwindow *window, uint32_t *pixels, int width, int height, double scale, bool focused) { const size_t shadow_margin = create_shadow_tile(window); const double radius = fmin(12 * scale, fmin(width / 2., height)); - for (int y = 0; y < (int)ceil(radius); y++) for (int x = 0; x < width; x++) { - const double dx = x < width / 2 ? radius - x - .5 : x + .5 - (width - radius); - if (dx <= 0) continue; - const double coverage = fmax(0, fmin(1, radius - hypot(dx, radius - y - .5) + .5)); - uint32_t color = coverage_pixel(pixels[y * width + x], coverage); - if (decs.shadow_tile.data) { - const size_t sx = x < width / 2 ? shadow_margin + x : decs.shadow_tile.stride - shadow_margin - (width - x); - const size_t sy = shadow_margin + y; - unsigned shadow_alpha = A(decs.shadow_tile.data[sy * decs.shadow_tile.stride + sx]); - if (!focused) shadow_alpha /= 2; - const unsigned alpha = A(color) + (unsigned)(shadow_alpha * (1 - coverage)); - color = (color & 0xffffff) | (alpha << 24); + for (int y = 0; y < (int)ceil(radius); y++) + for (int x = 0; x < width; x++) { + const double dx = x < width / 2 ? radius - x - .5 : x + .5 - (width - radius); + if (dx <= 0) continue; + const double coverage = fmax(0, fmin(1, radius - hypot(dx, radius - y - .5) + .5)); + uint32_t color = coverage_pixel(pixels[y * width + x], coverage); + if (decs.shadow_tile.data) { + const size_t sx = x < width / 2 ? shadow_margin + x : decs.shadow_tile.stride - shadow_margin - (width - x); + const size_t sy = shadow_margin + y; + unsigned shadow_alpha = A(decs.shadow_tile.data[sy * decs.shadow_tile.stride + sx]); + if (!focused) shadow_alpha /= 2; + const unsigned alpha = A(color) + (unsigned)(shadow_alpha * (1 - coverage)); + color = (color & 0xffffff) | (alpha << 24); + } + pixels[y * width + x] = color; } - pixels[y * width + x] = color; - } } static void @@ -418,13 +430,13 @@ render_title_bar(_GLFWwindow *window, bool to_front_buffer) { int margin; const unsigned num_buttons = layout_titlebar_buttons(window, width, slot, pad, buttons, &margin); if (width > 2 * margin && window->wl.title && _glfw.callbacks.draw_text) - _glfw.callbacks.draw_text( - (GLFWwindow *)window, window->wl.title, colors.fg, colors.bg, (uint8_t *)pixels, width, height, margin, 0, margin, false); + _glfw.callbacks.draw_text((GLFWwindow *)window, window->wl.title, colors.fg, colors.bg, (uint8_t *)pixels, width, height, margin, 0, margin, false); decs.minimize.width = decs.maximize.width = decs.close.width = 0; for (unsigned i = 0; i < num_buttons; i++) { - __typeof__(decs.close) *state = buttons[i].which == TITLEBAR_BUTTON_CLOSE ? &decs.close : - buttons[i].which == TITLEBAR_BUTTON_MAXIMIZE ? &decs.maximize : &decs.minimize; + __typeof__(decs.close) *state = buttons[i].which == TITLEBAR_BUTTON_CLOSE ? &decs.close + : buttons[i].which == TITLEBAR_BUTTON_MAXIMIZE ? &decs.maximize + : &decs.minimize; state->left = buttons[i].left; state->width = slot; uint32_t fill = colors.button; @@ -936,8 +948,7 @@ perform_titlebar_action(_GLFWwindow *window, GLFWTitlebarAction action) { case TITLEBAR_ACTION_MENU: if (!window->wl.xdg.toplevel) break; if (window->wl.wm_capabilities.window_menu) - xdg_toplevel_show_window_menu( - window->wl.xdg.toplevel, _glfw.wl.seat, _glfw.wl.pointer_serial, (int32_t)x, (int32_t)y - decs.metrics.top); + xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, _glfw.wl.seat, _glfw.wl.pointer_serial, (int32_t)x, (int32_t)y - decs.metrics.top); else _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland compositor does not support showing window menu"); break; case TITLEBAR_ACTION_MAXIMIZE: @@ -961,8 +972,10 @@ handle_pointer_button(_GLFWwindow *window, uint32_t button, uint32_t state) { case CENTRAL_WINDOW: break; case CSD_titlebar: if (has_hovered_button(window) || decs.pressed_button) { - const GLFWTitlebarButton hovered = decs.close.hovered ? TITLEBAR_BUTTON_CLOSE : - decs.maximize.hovered ? TITLEBAR_BUTTON_MAXIMIZE : decs.minimize.hovered ? TITLEBAR_BUTTON_MINIMIZE : TITLEBAR_BUTTON_NONE; + const GLFWTitlebarButton hovered = decs.close.hovered ? TITLEBAR_BUTTON_CLOSE + : decs.maximize.hovered ? TITLEBAR_BUTTON_MAXIMIZE + : decs.minimize.hovered ? TITLEBAR_BUTTON_MINIMIZE + : TITLEBAR_BUTTON_NONE; decs.dragging = false; decs.titlebar_needs_update = true; decs.last_click_on_top_decoration_at = 0; @@ -978,7 +991,8 @@ handle_pointer_button(_GLFWwindow *window, uint32_t button, uint32_t state) { if (window->wl.current.toplevel_states & TOPLEVEL_STATE_MAXIMIZED) _glfwPlatformRestoreWindow(window); else _glfwPlatformMaximizeWindow(window); break; - case TITLEBAR_BUTTON_NONE: case TITLEBAR_BUTTON_COUNT: break; + case TITLEBAR_BUTTON_NONE: + case TITLEBAR_BUTTON_COUNT: break; } } } @@ -1007,8 +1021,7 @@ handle_pointer_button(_GLFWwindow *window, uint32_t button, uint32_t state) { if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE) xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, _glfw.wl.pointer_serial, edges); } else if ((button == BTN_RIGHT || button == BTN_MIDDLE) && state == WL_POINTER_BUTTON_STATE_PRESSED) { if (decs.focus == CSD_titlebar) - perform_titlebar_action( - window, glfw_current_titlebar_action(button == BTN_MIDDLE ? TITLEBAR_GESTURE_MIDDLE_CLICK : TITLEBAR_GESTURE_RIGHT_CLICK)); + perform_titlebar_action(window, glfw_current_titlebar_action(button == BTN_MIDDLE ? TITLEBAR_GESTURE_MIDDLE_CLICK : TITLEBAR_GESTURE_RIGHT_CLICK)); } } diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 1650f6d9f..b1176b5ec 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -241,7 +241,7 @@ typedef struct _GLFWwindowWayland { } pointerLock; struct { - int pressed_button; // a GLFWTitlebarButton + int pressed_button; // a GLFWTitlebarButton bool serverSide, buffer_destroyed, titlebar_needs_update, dragging, titlebar_hidden; _GLFWCSDSurface focus; diff --git a/kitty/glfw.c b/kitty/glfw.c index 0827038e2..04068a54e 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -1521,8 +1521,8 @@ static struct { static FreeTypeRenderCtx csd_title_render_ctx_for(const GLFWTitlebarFont *font) { const char *family = font->family ? font->family : ""; - if (csd_title_render_ctx_key.initialized && csd_title_render_ctx_key.bold == font->bold && - csd_title_render_ctx_key.italic == font->italic && strcmp(csd_title_render_ctx_key.family, family) == 0) + if (csd_title_render_ctx_key.initialized && csd_title_render_ctx_key.bold == font->bold && csd_title_render_ctx_key.italic == font->italic && + strcmp(csd_title_render_ctx_key.family, family) == 0) return csd_title_render_ctx; // Remember failures as well, so as to not retry and report them on every redraw release_freetype_render_context(csd_title_render_ctx);