mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 08:16:13 +03:00
surface propagates new config to renderer
This commit is contained in:
@ -570,7 +570,13 @@ fn changeConfig(self: *Surface, config: *const configpkg.Config) !void {
|
||||
|
||||
// Update our derived configurations for the renderer and termio,
|
||||
// then send them a message to update.
|
||||
// TODO
|
||||
var renderer_config = try Renderer.DerivedConfig.init(self.alloc, config);
|
||||
errdefer renderer_config.deinit();
|
||||
// TODO: termio config
|
||||
|
||||
_ = self.renderer_thread.mailbox.push(.{
|
||||
.change_config = renderer_config,
|
||||
}, .{ .forever = {} });
|
||||
}
|
||||
|
||||
/// Returns the x/y coordinate of where the IME (Input Method Editor)
|
||||
|
@ -724,6 +724,11 @@ fn drawCells(
|
||||
}
|
||||
}
|
||||
|
||||
/// Update the configuration.
|
||||
pub fn changeConfig(self: *Metal, config: DerivedConfig) !void {
|
||||
self.config = config;
|
||||
}
|
||||
|
||||
/// Resize the screen.
|
||||
pub fn setScreenSize(self: *Metal, dim: renderer.ScreenSize) !void {
|
||||
// Store our screen size
|
||||
|
@ -1232,6 +1232,11 @@ fn gridSize(self: *const OpenGL, screen_size: renderer.ScreenSize) renderer.Grid
|
||||
);
|
||||
}
|
||||
|
||||
/// Update the configuration.
|
||||
pub fn changeConfig(self: *OpenGL, config: DerivedConfig) !void {
|
||||
self.config = config;
|
||||
}
|
||||
|
||||
/// Set the screen size for rendering. This will update the projection
|
||||
/// used for the shader so that the scaling of the grid is correct.
|
||||
pub fn setScreenSize(self: *OpenGL, dim: renderer.ScreenSize) !void {
|
||||
|
@ -255,6 +255,10 @@ fn drainMailbox(self: *Thread) !void {
|
||||
.screen_size => |size| {
|
||||
try self.renderer.setScreenSize(size);
|
||||
},
|
||||
|
||||
.change_config => |config| {
|
||||
try self.renderer.changeConfig(config);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,4 +22,7 @@ pub const Message = union(enum) {
|
||||
|
||||
/// Change the screen size.
|
||||
screen_size: renderer.ScreenSize,
|
||||
|
||||
/// The derived configuration to update the renderer with.
|
||||
change_config: renderer.Renderer.DerivedConfig,
|
||||
};
|
||||
|
Reference in New Issue
Block a user