Commit graph

30 commits

Author SHA1 Message Date
Kovid Goyal
b8a70cf3d0
Desktop settings: Avoid duplicate portal queries and coalesce titlebar redraws
When the color scheme is queried at startup, wait for the reply to the
pending ReadAll request instead of making a second blocking ReadOne call,
only falling back to ReadOne if ReadAll failed or did not reply in time.
Session bus dispatching is now guarded against re-entrancy so this wait is
safe even when called from inside a DBus callback.

Coalesce titlebar redraws: settings changes only mark the titlebar dirty,
redrawing once after the initial ReadAll reply and once per burst of
SettingChanged signals via a short one-shot timer.

Fix the legacy Read color-scheme handler checking a stale type for the
nested variant and reading the value without verifying it is a uint32.
2026-10-30 10:07:13 +05:30
Kovid Goyal
0c87f8ce94
Wayland CSD: Fix various correctness issues
- Dont re-render the titlebar on every pointer motion event. This both
  wasted CPU re-shaping the title and rendered into the buffer last
  attached to the titlebar surface without attaching the result.
- Notify of the window size change when the titlebar height changes in a
  docked window, as is done for configure events, and never set a non
  positive content height.
- Only wait for the desktop settings when creating the first window, since
  dispatching DBus from inside a DBus callback is not re-entrant.
- Apply cursor theme changes received via SettingChanged instead of
  silently updating the theme name.
2026-10-30 09:14:43 +05:30
Kovid Goyal
0331c873f9
Run autoformat 2026-10-30 09:07:45 +05:30
Kovid Goyal
e37f4cd223
Wayland CSD: Cleanup titlebar rendering and button handling
Use enums for titlebar buttons and gestures instead of magic numbers
shared between files. Split up the titlebar renderer. Derive button
colors from the titlebar color so they fit in with custom titlebar
colors. Parse button layouts without a colon the way GTK does, all
buttons on the left. Restore the error message when the compositor
does not support showing the window menu.
2026-10-30 09:06:15 +05:30
Kovid Goyal
a2aa9b739d
Wayland CSD: Parse the titlebar font description once in glfw
Replace glfwGetSystemFont(), which returned a raw Pango font description
that was parsed separately in glfw and kitty, with glfwGetTitlebarFont()
that returns the parsed family, size and style. The parser now handles
font family lists, pixel sizes and the full set of Pango weight and style
names. A text scale less than one is now applied to the header height as
well. The FreeType context for the title font is released on exit and
failures to create it are not retried and reported on every redraw.
2026-10-30 09:03:46 +05:30
Kovid Goyal
53ba16881d
Wayland CSD: Wait briefly for desktop settings before creating a decorated window
On compositors without xdg-decoration, such as mutter, the titlebar height
depends on desktop settings that arrive asynchronously from the portal. If
they arrive after the window is mapped, the window visibly resizes. Wait
up to 200ms for the reply before creating the first such window.
2026-10-30 09:01:46 +05:30
Kovid Goyal
a5c48a3644
Wayland CSD: With system titlebar color and no desktop preference follow the window background
This was the behavior before the GNOME style CSD changes. Also restore
the previous semantics of the initial color scheme notification.
2026-10-30 08:59:34 +05:30
Kovid Goyal
6d6134ce16
Wayland CSD: Move titlebar settings handling into the Wayland backend
The desktop settings module is shared with X11 and should not walk the
window list and poke at Wayland decoration state. Use a platform hook
like the existing one for cursor theme changes. Also dont recompute
metrics and change window geometry on every title change, only when the
titlebar settings actually change.
2026-10-30 08:59:11 +05:30
Manuel Villanueva
401d8795f3
Wayland: default CSD to dark when desktop appearance is unavailable 2026-10-29 15:53:45 -06:00
Manuel Villanueva
45282eef7d
Wayland: inherit GNOME titlebar preferences through the desktop portal 2026-10-29 15:35:48 -06:00
Manuel Villanueva
c28c460e34
Wayland: use GNOME CSD by default and follow desktop appearance 2026-10-29 15:16:12 -06:00
Manuel Villanueva
96976d85b6
Wayland: add opt-in built-in GNOME-style window decorations 2026-10-28 23:01:00 -06:00
Kovid Goyal
643f18f292
Fix #10604
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-10-05 04:49:44 +05:30
Kovid Goyal
2af2d313de
autoformat c/objc code, using clang-format with left alignment for line continuation chars 2026-08-05 19:37:00 +05:30
Kovid Goyal
4c6467814b
autoformat c/objc code, using clang-format 2026-08-05 19:10:55 +05:30
Kovid Goyal
76f9cdc426
... 2025-11-22 20:03:01 +05:30
Kovid Goyal
8a14a5638a
... 2025-05-08 15:30:09 +05:30
Kovid Goyal
2fed0ec562
Linux: Handle desktop settings portals that are so old they don't implement ReadOne
Sigh, outdated Linux software, just creating busy work for everyone.
2025-05-08 15:22:42 +05:30
Kovid Goyal
b0ebd340fe
Function to get the current system color theme 2024-11-07 12:47:06 +05:30
Kovid Goyal
239e08f268
When reading desktop settings from the portal provide a list of supported namespaces
The wlr portal doesnt work with an empty list. Sigh.
2024-11-07 11:10:27 +05:30
Kovid Goyal
754288557d
Track initial color scheme preference read on Linux 2024-11-07 10:38:13 +05:30
Kovid Goyal
191ccf2d54
Wire up color scheme change notifications on X11 as well 2024-08-11 22:20:39 +05:30
Kovid Goyal
b5022cbd81
DRYer 2024-05-16 20:17:15 +05:30
Kovid Goyal
1bffe89b5d
Wayland GNOME: titlebar color now follows system theme
When GNOME system theme is default, the color matches the background
color. When it is dark it is dark.
2024-04-04 21:52:56 +05:30
Jin Liu
293cd40509 Get cursor theme from desktop portal in non-GNOME desktops
Even if current DE is not GNOME, it may still use the GNOME
desktop portal as a fallback for Settings (e.g. KDE). So if
the user installed xdg-desktop-portal-gtk, and KDE synced
its cursor theme with GNOME, then we can still get it from
the GNOME namespace in the Settings.ReadAll result from the
portal.
2023-12-02 15:00:03 +08:00
Kovid Goyal
66801b6b28
GLFW API to track system color scheme dark/light
Implemented only on macOS and Wayland.
2023-04-13 13:16:33 +05:30
pagedown
06108d66b1
Replace tab with four spaces indent 2022-08-08 22:31:55 +05:30
Kovid Goyal
c2bc24de35
Read appearance setting from desktop portal as well 2022-04-05 15:44:27 +05:30
Kovid Goyal
906be21b8d
Make GNOME detection a bit more tolerant 2022-03-22 11:36:09 +05:30
Kovid Goyal
63a50ec066
Use the correct mouse cursor theme on GNOME
Relies on a working desktop settings portal (xdg-desktop-portal-gtk)
2021-03-25 12:20:13 +05:30