unfocused-split-fill working again though it can't detect when its actually a split yet

pull/8813/head
rhodes-b 2025-09-20 03:55:05 -05:00
parent 0646cf8c1e
commit b34e22053d
1 changed files with 16 additions and 0 deletions

View File

@ -435,6 +435,7 @@ pub const Surface = extern struct {
/// The current focus state of the terminal based on the
/// focus events.
focused: bool = true,
unfocused_widget: ?*gtk.Widget = null,
/// Whether this surface is "zoomed" or not. A zoomed surface
/// shows up taking the full bounds of a split view.
@ -1989,6 +1990,11 @@ pub const Surface = extern struct {
_ = glib.idleAddOnce(idleFocus, self.ref());
self.as(gobject.Object).notifyByPspec(properties.focused.impl.param_spec);
if (priv.unfocused_widget) |widget| {
priv.terminal_page.removeOverlay(widget);
priv.unfocused_widget = null;
}
// Bell stops ringing as soon as we gain focus
self.setBellRinging(false);
}
@ -1999,6 +2005,16 @@ pub const Surface = extern struct {
priv.im_context.as(gtk.IMContext).focusOut();
_ = glib.idleAddOnce(idleFocus, self.ref());
self.as(gobject.Object).notifyByPspec(properties.focused.impl.param_spec);
if (priv.unfocused_widget) |_| return;
// add unfocused-split-fill
priv.unfocused_widget = unfocused_widget: {
const drawing_area = gtk.DrawingArea.new();
const unfocused_widget = drawing_area.as(gtk.Widget);
unfocused_widget.addCssClass("unfocused-split");
priv.terminal_page.addOverlay(unfocused_widget);
break :unfocused_widget unfocused_widget;
};
}
/// The focus callback must be triggered on an idle loop source because