fix(gtk): register the gresource before startup so style.css loads

Ghostty's stylesheets (style.css, style-dark.css, style-hc*.css) were
never loaded. AdwApplication loads them from `resource-base-path` once,
during startup, and only if the resources exist at that moment. Zig's
gresource is registered by a glib-compile-resources C constructor before
main; the Rust build registered it lazily on first template instantiation
(windows, dialogs), i.e. after startup.

Visible effect: every rule in style.css was missing, e.g. the clipboard
confirmation dialog (`clipboard-read = ask`) rendered its preview without
the rounded inset and overlapping the "Remember choice" row.

Registering in Application::new restores parity; the Adwaita
"style-dark.css is deprecated" warnings Zig logs now appear too, which
confirms the files are picked up.

Test Plan:
- clipboard-read = ask, run `printf '\e]52;c;?\a'`: dialog is
  pixel-identical to Ghostty 1.3.1 (nested weston capture)
This commit is contained in:
ddidderr committed 2026-10-12 21:11:39 +02:00
1 parent 733df84eaf
commit 13e682ea92
2 files changed
+8 -1

No files matched your search

@@ -419,6 +419,12 @@ impl Application {
pub fn new(core_app: Rc<dyn CoreApp>) -> Self { pub fn new(core_app: Rc<dyn CoreApp>) -> Self {
init_locale(); init_locale();
// AdwApplication loads style.css & co. from `resource-base-path` once,
// during startup, and only if the resources exist then. Zig's
// gresource is registered by a C constructor before main; ours must
// be registered explicitly before startup.
crate::register_resources();
// Capture GLib/GObject/GTK log messages. // Capture GLib/GObject/GTK log messages.
glib::log_set_writer_func(glib_log_writer); glib::log_set_writer_func(glib_log_writer);
+2 -1
View File
@@ -3,7 +3,8 @@
## Overview / status ## Overview / status
Port of ZIG/src/apprt/gtk (GTK4 + libadwaita, gtk4-rs 0.11 / libadwaita 0.9, baseline GTK 4.14 / adw 1.5). Port of ZIG/src/apprt/gtk (GTK4 + libadwaita, gtk4-rs 0.11 / libadwaita 0.9, baseline GTK 4.14 / adw 1.5).
build.rs compiles resources/ui/**/*.blp with blueprint-compiler and bundles UI+CSS+icons into a gresource build.rs compiles resources/ui/**/*.blp with blueprint-compiler and bundles UI+CSS+icons into a gresource
(`register_resources()`). Inspector/imgui deferred (menu action is a no-op with TODO). Dropped the ghostty-core (`register_resources()`, called in `Application::new` before startup so AdwApplication
auto-loads style.css from `resource-base-path`). Inspector/imgui deferred (menu action is a no-op with TODO). Dropped the ghostty-core
dependency (cycle): the core boundary is the trait set in `src/core.rs`. dependency (cycle): the core boundary is the trait set in `src/core.rs`.
## Core trait boundary (src/core.rs, authoritative spec = the file) ## Core trait boundary (src/core.rs, authoritative spec = the file)