core: no need for hasTabs apprt function

This commit is contained in:
Mitchell Hashimoto
2024-09-26 08:34:07 -07:00
parent 02d7e766e1
commit 26cba70b69
3 changed files with 0 additions and 31 deletions

View File

@ -3670,39 +3670,18 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
}, },
.previous_tab => { .previous_tab => {
if (@hasDecl(apprt.Surface, "hasTabs")) {
if (!self.rt_surface.hasTabs()) {
log.debug("surface has no tabs, ignoring previous_tab binding", .{});
return false;
}
}
if (@hasDecl(apprt.Surface, "gotoTab")) { if (@hasDecl(apprt.Surface, "gotoTab")) {
self.rt_surface.gotoTab(.previous); self.rt_surface.gotoTab(.previous);
} else log.warn("runtime doesn't implement gotoTab", .{}); } else log.warn("runtime doesn't implement gotoTab", .{});
}, },
.next_tab => { .next_tab => {
if (@hasDecl(apprt.Surface, "hasTabs")) {
if (!self.rt_surface.hasTabs()) {
log.debug("surface has no tabs, ignoring next_tab binding", .{});
return false;
}
}
if (@hasDecl(apprt.Surface, "gotoTab")) { if (@hasDecl(apprt.Surface, "gotoTab")) {
self.rt_surface.gotoTab(.next); self.rt_surface.gotoTab(.next);
} else log.warn("runtime doesn't implement gotoTab", .{}); } else log.warn("runtime doesn't implement gotoTab", .{});
}, },
.last_tab => { .last_tab => {
if (@hasDecl(apprt.Surface, "hasTabs")) {
if (!self.rt_surface.hasTabs()) {
log.debug("surface has no tabs, ignoring last_tab binding", .{});
return false;
}
}
if (@hasDecl(apprt.Surface, "gotoTab")) { if (@hasDecl(apprt.Surface, "gotoTab")) {
self.rt_surface.gotoTab(.last); self.rt_surface.gotoTab(.last);
} else log.warn("runtime doesn't implement gotoTab", .{}); } else log.warn("runtime doesn't implement gotoTab", .{});

View File

@ -790,11 +790,6 @@ pub fn newTab(self: *Surface) !void {
try window.newTab(&self.core_surface); try window.newTab(&self.core_surface);
} }
pub fn hasTabs(self: *const Surface) bool {
const window = self.container.window() orelse return false;
return window.hasTabs();
}
pub fn gotoTab(self: *Surface, tab: apprt.GotoTab) void { pub fn gotoTab(self: *Surface, tab: apprt.GotoTab) void {
const window = self.container.window() orelse { const window = self.container.window() orelse {
log.info( log.info(

View File

@ -421,11 +421,6 @@ pub fn closeTab(self: *Window, tab: *Tab) void {
self.notebook.closeTab(tab); self.notebook.closeTab(tab);
} }
/// Returns true if this window has any tabs.
pub fn hasTabs(self: *const Window) bool {
return self.notebook.nPages() > 0;
}
/// Go to the previous tab for a surface. /// Go to the previous tab for a surface.
pub fn gotoPreviousTab(self: *Window, surface: *Surface) void { pub fn gotoPreviousTab(self: *Window, surface: *Surface) void {
const tab = surface.container.tab() orelse { const tab = surface.container.tab() orelse {