mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
opengl: handle screen resize outside of critical area
This commit is contained in:
@ -478,10 +478,6 @@ pub fn render(
|
|||||||
state.mutex.lock();
|
state.mutex.lock();
|
||||||
defer state.mutex.unlock();
|
defer state.mutex.unlock();
|
||||||
|
|
||||||
// If we're resizing, then handle that now.
|
|
||||||
if (state.resize_screen) |size| try self.setScreenSize(size);
|
|
||||||
defer state.resize_screen = null;
|
|
||||||
|
|
||||||
// Setup our cursor state
|
// Setup our cursor state
|
||||||
if (self.focused) {
|
if (self.focused) {
|
||||||
self.cursor_visible = self.cursor_visible and state.cursor.visible;
|
self.cursor_visible = self.cursor_visible and state.cursor.visible;
|
||||||
@ -527,6 +523,9 @@ pub fn render(
|
|||||||
);
|
);
|
||||||
errdefer screen_copy.deinit();
|
errdefer screen_copy.deinit();
|
||||||
|
|
||||||
|
// We set this in the state below
|
||||||
|
defer state.resize_screen = null;
|
||||||
|
|
||||||
break :critical .{
|
break :critical .{
|
||||||
.gl_bg = self.background,
|
.gl_bg = self.background,
|
||||||
.devmode_data = devmode_data,
|
.devmode_data = devmode_data,
|
||||||
@ -539,6 +538,16 @@ pub fn render(
|
|||||||
};
|
};
|
||||||
defer critical.screen.deinit();
|
defer critical.screen.deinit();
|
||||||
|
|
||||||
|
// If we are resizing we need to update the viewport
|
||||||
|
if (critical.screen_size) |size| {
|
||||||
|
// Update our grid size
|
||||||
|
try self.setScreenSize(size);
|
||||||
|
|
||||||
|
// Update our viewport for this context to be the entire window.
|
||||||
|
// OpenGL works in pixels, so we have to use the pixel size.
|
||||||
|
try gl.viewport(0, 0, @intCast(i32, size.width), @intCast(i32, size.height));
|
||||||
|
}
|
||||||
|
|
||||||
// Build our GPU cells
|
// Build our GPU cells
|
||||||
try self.rebuildCells(
|
try self.rebuildCells(
|
||||||
critical.active_screen,
|
critical.active_screen,
|
||||||
@ -551,13 +560,6 @@ pub fn render(
|
|||||||
// are changes to the atlas.
|
// are changes to the atlas.
|
||||||
try self.flushAtlas();
|
try self.flushAtlas();
|
||||||
|
|
||||||
// If we are resizing we need to update the viewport
|
|
||||||
if (critical.screen_size) |size| {
|
|
||||||
// Update our viewport for this context to be the entire window.
|
|
||||||
// OpenGL works in pixels, so we have to use the pixel size.
|
|
||||||
try gl.viewport(0, 0, @intCast(i32, size.width), @intCast(i32, size.height));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the surface
|
// Clear the surface
|
||||||
gl.clearColor(
|
gl.clearColor(
|
||||||
@intToFloat(f32, critical.gl_bg.r) / 255,
|
@intToFloat(f32, critical.gl_bg.r) / 255,
|
||||||
|
Reference in New Issue
Block a user