diff --git a/include/ghostty.h b/include/ghostty.h index 7258c8838..c390e2102 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -1042,10 +1042,7 @@ ghostty_surface_t ghostty_surface_new(ghostty_app_t, void ghostty_surface_free(ghostty_surface_t); void* ghostty_surface_userdata(ghostty_surface_t); ghostty_app_t ghostty_surface_app(ghostty_surface_t); -ghostty_surface_config_s ghostty_surface_inherited_config(ghostty_surface_t); /* deprecated: use context-specific functions */ -ghostty_surface_config_s ghostty_surface_inherited_config_window(ghostty_surface_t); -ghostty_surface_config_s ghostty_surface_inherited_config_tab(ghostty_surface_t); -ghostty_surface_config_s ghostty_surface_inherited_config_split(ghostty_surface_t); +ghostty_surface_config_s ghostty_surface_inherited_config(ghostty_surface_t, ghostty_surface_context_e); void ghostty_surface_update_config(ghostty_surface_t, ghostty_config_t); bool ghostty_surface_needs_confirm_quit(ghostty_surface_t); bool ghostty_surface_process_exited(ghostty_surface_t); diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index e23bf0457..191da9aca 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -773,7 +773,7 @@ extension Ghostty { name: Notification.ghosttyNewWindow, object: surfaceView, userInfo: [ - Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config_window(surface)), + Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config(surface, GHOSTTY_SURFACE_CONTEXT_WINDOW)), ] ) @@ -810,7 +810,7 @@ extension Ghostty { name: Notification.ghosttyNewTab, object: surfaceView, userInfo: [ - Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config_tab(surface)), + Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config(surface, GHOSTTY_SURFACE_CONTEXT_TAB)), ] ) @@ -839,7 +839,7 @@ extension Ghostty { object: surfaceView, userInfo: [ "direction": direction, - Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config_split(surface)), + Notification.NewSurfaceConfigKey: SurfaceConfiguration(from: ghostty_surface_inherited_config(surface, GHOSTTY_SURFACE_CONTEXT_SPLIT)), ] ) diff --git a/src/apprt/embedded.zig b/src/apprt/embedded.zig index 8836db403..186b0c2e4 100644 --- a/src/apprt/embedded.zig +++ b/src/apprt/embedded.zig @@ -1551,24 +1551,16 @@ pub const CAPI = struct { } /// Returns the config to use for surfaces that inherit from this one. - /// Deprecated: Use ghostty_surface_inherited_config_window/tab/split instead. - export fn ghostty_surface_inherited_config(surface: *Surface) Surface.Options { - return surface.newSurfaceOptions(.window); - } - - /// Returns the config to use for new windows that inherit from this surface. - export fn ghostty_surface_inherited_config_window(surface: *Surface) Surface.Options { - return surface.newSurfaceOptions(.window); - } - - /// Returns the config to use for new tabs that inherit from this surface. - export fn ghostty_surface_inherited_config_tab(surface: *Surface) Surface.Options { - return surface.newSurfaceOptions(.tab); - } - - /// Returns the config to use for new splits that inherit from this surface. - export fn ghostty_surface_inherited_config_split(surface: *Surface) Surface.Options { - return surface.newSurfaceOptions(.split); + export fn ghostty_surface_inherited_config( + surface: *Surface, + source: Surface.Options.Context, + ) Surface.Options { + const context: apprt.surface.NewSurfaceContext = switch (source) { + .c_window => .window, + .c_tab => .tab, + .c_split => .split, + }; + return surface.newSurfaceOptions(context); } /// Update the configuration to the provided config for only this surface.