mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-26 10:41:58 +00:00
gtk-ng add border to bell features
This commit is contained in:
@@ -523,6 +523,22 @@ pub const Surface = extern struct {
|
||||
priv.gl_area.queueRender();
|
||||
}
|
||||
|
||||
/// Callback used to determine whether border should be shown around the
|
||||
/// surface.
|
||||
fn closureShouldBorderBeShown(
|
||||
_: *Self,
|
||||
config_: ?*Config,
|
||||
bell_ringing_: c_int,
|
||||
) callconv(.c) c_int {
|
||||
const config = if (config_) |v| v.get() else {
|
||||
log.warn("config unavailable for computing whether border should be shown , likely bug", .{});
|
||||
return @intFromBool(false);
|
||||
};
|
||||
|
||||
const bell_ringing = bell_ringing_ != 0;
|
||||
return @intFromBool(config.@"bell-features".border and bell_ringing);
|
||||
}
|
||||
|
||||
pub fn toggleFullscreen(self: *Self) void {
|
||||
signals.@"toggle-fullscreen".impl.emit(
|
||||
self,
|
||||
@@ -2478,6 +2494,7 @@ pub const Surface = extern struct {
|
||||
class.bindTemplateCallback("notify_mouse_hidden", &propMouseHidden);
|
||||
class.bindTemplateCallback("notify_mouse_shape", &propMouseShape);
|
||||
class.bindTemplateCallback("notify_bell_ringing", &propBellRinging);
|
||||
class.bindTemplateCallback("should_border_be_shown", &closureShouldBorderBeShown);
|
||||
|
||||
// Properties
|
||||
gobject.ext.registerProperties(class, &.{
|
||||
|
||||
@@ -102,6 +102,12 @@ label.resize-overlay {
|
||||
/* background-color: color-mix(in srgb, var(--error-bg-color), transparent); */
|
||||
}
|
||||
|
||||
.surface .bell-overlay {
|
||||
border-color: color-mix(in srgb, var(--accent-color), transparent 50%);
|
||||
border-width: 3px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Command Palette
|
||||
*/
|
||||
|
||||
@@ -54,6 +54,27 @@ template $GhosttySurface: Adw.Bin {
|
||||
valign: start;
|
||||
}
|
||||
|
||||
[overlay]
|
||||
// The "border" bell feature is implemented here as an overlay rather than
|
||||
// just adding a border to the GLArea or other widget for two reasons.
|
||||
// First, adding a border to an existing widget causes a resize of the
|
||||
// widget which undesirable side effects. Second, we can make it reactive
|
||||
// here in the blueprint with relatively little code.
|
||||
Revealer {
|
||||
reveal-child: bind $should_border_be_shown(template.config, template.bell-ringing) as <bool>;
|
||||
transition-type: crossfade;
|
||||
transition-duration: 500;
|
||||
|
||||
Box bell_overlay {
|
||||
styles [
|
||||
"bell-overlay",
|
||||
]
|
||||
|
||||
halign: fill;
|
||||
valign: fill;
|
||||
}
|
||||
}
|
||||
|
||||
[overlay]
|
||||
$GhosttySurfaceChildExited child_exited_overlay {
|
||||
visible: bind template.child-exited;
|
||||
|
||||
Reference in New Issue
Block a user