apprt/gtk-ng: background-opacity doesn't need to be a window property
We only need properties for things that are bound via the blueprint files. Otherwise, its kind of just a pain. This fixes a bug where it wasn't being properly set initially anyways because we didn't trigger syncAppearance.pull/8146/head
parent
55c68d809d
commit
8c85bae931
|
|
@ -117,23 +117,6 @@ pub const Window = extern struct {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const @"background-opaque" = struct {
|
|
||||||
pub const name = "background-opaque";
|
|
||||||
const impl = gobject.ext.defineProperty(
|
|
||||||
name,
|
|
||||||
Self,
|
|
||||||
bool,
|
|
||||||
.{
|
|
||||||
.nick = "Background Opaque",
|
|
||||||
.blurb = "True if the background should be opaque.",
|
|
||||||
.default = true,
|
|
||||||
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
|
||||||
.getter = Self.getBackgroundOpaque,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const @"quick-terminal" = struct {
|
pub const @"quick-terminal" = struct {
|
||||||
pub const name = "quick-terminal";
|
pub const name = "quick-terminal";
|
||||||
const impl = gobject.ext.defineProperty(
|
const impl = gobject.ext.defineProperty(
|
||||||
|
|
@ -553,7 +536,6 @@ pub const Window = extern struct {
|
||||||
|
|
||||||
// Trigger all our dynamic properties that depend on the config.
|
// Trigger all our dynamic properties that depend on the config.
|
||||||
inline for (&.{
|
inline for (&.{
|
||||||
"background-opaque",
|
|
||||||
"headerbar-visible",
|
"headerbar-visible",
|
||||||
"tabs-autohide",
|
"tabs-autohide",
|
||||||
"tabs-visible",
|
"tabs-visible",
|
||||||
|
|
@ -568,6 +550,12 @@ pub const Window = extern struct {
|
||||||
// Remainder uses the config
|
// Remainder uses the config
|
||||||
const config = if (priv.config) |v| v.get() else return;
|
const config = if (priv.config) |v| v.get() else return;
|
||||||
|
|
||||||
|
// Only add a solid background if we're opaque.
|
||||||
|
self.toggleCssClass(
|
||||||
|
"background",
|
||||||
|
config.@"background-opacity" >= 1,
|
||||||
|
);
|
||||||
|
|
||||||
// Apply class to color headerbar if window-theme is set to `ghostty` and
|
// Apply class to color headerbar if window-theme is set to `ghostty` and
|
||||||
// GTK version is before 4.16. The conditional is because above 4.16
|
// GTK version is before 4.16. The conditional is because above 4.16
|
||||||
// we use GTK CSS color variables.
|
// we use GTK CSS color variables.
|
||||||
|
|
@ -751,12 +739,6 @@ pub const Window = extern struct {
|
||||||
return config.@"gtk-titlebar";
|
return config.@"gtk-titlebar";
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getBackgroundOpaque(self: *Self) bool {
|
|
||||||
const priv = self.private();
|
|
||||||
const config = (priv.config orelse return true).get();
|
|
||||||
return config.@"background-opacity" >= 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn getTabsAutohide(self: *Self) bool {
|
fn getTabsAutohide(self: *Self) bool {
|
||||||
const priv = self.private();
|
const priv = self.private();
|
||||||
const config = if (priv.config) |v| v.get() else return true;
|
const config = if (priv.config) |v| v.get() else return true;
|
||||||
|
|
@ -889,16 +871,6 @@ pub const Window = extern struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add or remove "background" CSS class depending on if the background
|
|
||||||
/// should be opaque.
|
|
||||||
fn propBackgroundOpaque(
|
|
||||||
_: *adw.ApplicationWindow,
|
|
||||||
_: *gobject.ParamSpec,
|
|
||||||
self: *Self,
|
|
||||||
) callconv(.c) void {
|
|
||||||
self.toggleCssClass("background", self.getBackgroundOpaque());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn propScaleFactor(
|
fn propScaleFactor(
|
||||||
_: *adw.ApplicationWindow,
|
_: *adw.ApplicationWindow,
|
||||||
_: *gobject.ParamSpec,
|
_: *gobject.ParamSpec,
|
||||||
|
|
@ -1604,7 +1576,6 @@ pub const Window = extern struct {
|
||||||
// Properties
|
// Properties
|
||||||
gobject.ext.registerProperties(class, &.{
|
gobject.ext.registerProperties(class, &.{
|
||||||
properties.@"active-surface".impl,
|
properties.@"active-surface".impl,
|
||||||
properties.@"background-opaque".impl,
|
|
||||||
properties.config.impl,
|
properties.config.impl,
|
||||||
properties.debug.impl,
|
properties.debug.impl,
|
||||||
properties.@"headerbar-visible".impl,
|
properties.@"headerbar-visible".impl,
|
||||||
|
|
@ -1634,7 +1605,6 @@ pub const Window = extern struct {
|
||||||
class.bindTemplateCallback("tab_create_window", &tabViewCreateWindow);
|
class.bindTemplateCallback("tab_create_window", &tabViewCreateWindow);
|
||||||
class.bindTemplateCallback("notify_n_pages", &tabViewNPages);
|
class.bindTemplateCallback("notify_n_pages", &tabViewNPages);
|
||||||
class.bindTemplateCallback("notify_selected_page", &tabViewSelectedPage);
|
class.bindTemplateCallback("notify_selected_page", &tabViewSelectedPage);
|
||||||
class.bindTemplateCallback("notify_background_opaque", &propBackgroundOpaque);
|
|
||||||
class.bindTemplateCallback("notify_config", &propConfig);
|
class.bindTemplateCallback("notify_config", &propConfig);
|
||||||
class.bindTemplateCallback("notify_fullscreened", &propFullscreened);
|
class.bindTemplateCallback("notify_fullscreened", &propFullscreened);
|
||||||
class.bindTemplateCallback("notify_maximized", &propMaximized);
|
class.bindTemplateCallback("notify_maximized", &propMaximized);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
||||||
|
|
||||||
close-request => $close_request();
|
close-request => $close_request();
|
||||||
realize => $realize();
|
realize => $realize();
|
||||||
notify::background-opaque => $notify_background_opaque();
|
|
||||||
notify::config => $notify_config();
|
notify::config => $notify_config();
|
||||||
notify::fullscreened => $notify_fullscreened();
|
notify::fullscreened => $notify_fullscreened();
|
||||||
notify::maximized => $notify_maximized();
|
notify::maximized => $notify_maximized();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue