use focus signal in split_tree to determine if we apply unfocused-split-fill
parent
6ee9a3767b
commit
52c2f02fa4
|
|
@ -399,12 +399,7 @@ pub const SplitTree = extern struct {
|
|||
const tree = self.getTree() orelse return null;
|
||||
var it = tree.iterator();
|
||||
while (it.next()) |entry| {
|
||||
if (!entry.view.getFocused() and it.nodes.len > 1) {
|
||||
entry.view.setUnfocused();
|
||||
}
|
||||
if (entry.view.getFocused()) {
|
||||
return entry.handle;
|
||||
}
|
||||
if (entry.view.getFocused()) return entry.handle;
|
||||
}
|
||||
|
||||
// If none are currently focused, the most previously focused
|
||||
|
|
@ -715,7 +710,13 @@ pub const SplitTree = extern struct {
|
|||
// We never CLEAR our last_focused because the property is specifically
|
||||
// the last focused surface. We let the weakref clear itself when
|
||||
// the surface is destroyed.
|
||||
if (!surface.getFocused()) return;
|
||||
if (!surface.getFocused()) {
|
||||
// If we have more than 1 active surface and we aren't focused we want to apply unfocused-split-fill
|
||||
if (self.getTree()) |tree| {
|
||||
if (tree.nodes.len > 1) surface.setUnfocused();
|
||||
}
|
||||
return;
|
||||
}
|
||||
self.private().last_focused.set(surface);
|
||||
|
||||
// Our active surface probably changed
|
||||
|
|
|
|||
|
|
@ -1492,6 +1492,7 @@ pub const Surface = extern struct {
|
|||
return self.private().focused;
|
||||
}
|
||||
|
||||
/// If unfocused add the unfocused-split widget for this surface
|
||||
pub fn setUnfocused(self: *Self) void {
|
||||
const priv = self.private();
|
||||
if (!priv.focused and (priv.unfocused_widget == null)) {
|
||||
|
|
@ -2018,16 +2019,6 @@ 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue