Skip to content

Commit

Permalink
Merge pull request #2383 from ghostty-org/push-xosyoktxxmoq
Browse files Browse the repository at this point in the history
renderer: fg/bg/cursor change must mark the screen as dirty
  • Loading branch information
mitchellh authored Oct 4, 2024
2 parents c973ca6 + 89fadfc commit 0dbf979
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/renderer/Metal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,12 @@ fn displayLinkCallback(
};
}

/// Mark the full screen as dirty so that we redraw everything.
pub fn markDirty(self: *Metal) void {
// This is how we force a full rebuild with metal.
self.cells_viewport = null;
}

/// Called when we get an updated display ID for our display link.
pub fn setMacOSDisplayID(self: *Metal, id: u32) !void {
if (comptime DisplayLink == void) return;
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/OpenGL.zig
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@ pub fn hasVsync(self: *const OpenGL) bool {
return false;
}

/// See Metal.
pub fn markDirty(self: *OpenGL) void {
// Do nothing, we don't have dirty tracking yet.
_ = self;
}

/// Callback when the focus changes for the terminal this is rendering.
///
/// Must be called on the render thread.
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/Thread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,17 @@ fn drainMailbox(self: *Thread) !void {

.foreground_color => |color| {
self.renderer.foreground_color = color;
self.renderer.markDirty();
},

.background_color => |color| {
self.renderer.background_color = color;
self.renderer.markDirty();
},

.cursor_color => |color| {
self.renderer.cursor_color = color;
self.renderer.markDirty();
},

.resize => |v| {
Expand Down

0 comments on commit 0dbf979

Please sign in to comment.