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.
- 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.
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.
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.
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.
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.
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.