From e4c91d232856903db0251852f639b6fedcb1d98b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 25 Feb 2023 10:32:27 -0800 Subject: [PATCH] don't require runtimes to implement all callbacks --- src/Surface.zig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 2b72691a6..aacac1fec 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -917,8 +917,17 @@ pub fn keyCallback( }, .{ .instant = {} }); }, - .previous_tab => self.rt_surface.gotoPreviousTab(), - .next_tab => self.rt_surface.gotoNextTab(), + .previous_tab => { + if (@hasDecl(apprt.Surface, "gotoPreviousTab")) { + self.rt_surface.gotoPreviousTab(); + } else log.warn("runtime doesn't implement gotoPreviousTab", .{}); + }, + + .next_tab => { + if (@hasDecl(apprt.Surface, "gotoNextTab")) { + self.rt_surface.gotoNextTab(); + } else log.warn("runtime doesn't implement gotoNextTab", .{}); + }, .close_window => { _ = self.app_mailbox.push(.{ .close = self }, .{ .instant = {} });