mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
Merge pull request #1440 from qwerasd205/macos-fix-resize-jello
fix(macOS): Prevent squash/stretch during resize
This commit is contained in:
6
pkg/macos/animation.zig
Normal file
6
pkg/macos/animation.zig
Normal file
@ -0,0 +1,6 @@
|
||||
pub const c = @import("animation/c.zig");
|
||||
pub usingnamespace @import("animation/layer.zig");
|
||||
|
||||
test {
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
}
|
3
pkg/macos/animation/c.zig
Normal file
3
pkg/macos/animation/c.zig
Normal file
@ -0,0 +1,3 @@
|
||||
pub usingnamespace @cImport({
|
||||
@cInclude("QuartzCore/CALayer.h");
|
||||
});
|
2
pkg/macos/animation/layer.zig
Normal file
2
pkg/macos/animation/layer.zig
Normal file
@ -0,0 +1,2 @@
|
||||
/// https://developer.apple.com/documentation/quartzcore/calayer/contents_gravity_values?language=objc
|
||||
pub extern "c" const kCAGravityTopLeft: *anyopaque;
|
@ -32,6 +32,7 @@ pub fn build(b: *std.Build) !void {
|
||||
lib.linkFramework("CoreGraphics");
|
||||
lib.linkFramework("CoreText");
|
||||
lib.linkFramework("CoreVideo");
|
||||
lib.linkFramework("QuartzCore");
|
||||
if (target.result.os.tag == .macos) {
|
||||
lib.linkFramework("Carbon");
|
||||
module.linkFramework("Carbon", .{});
|
||||
@ -42,6 +43,7 @@ pub fn build(b: *std.Build) !void {
|
||||
module.linkFramework("CoreGraphics", .{});
|
||||
module.linkFramework("CoreText", .{});
|
||||
module.linkFramework("CoreVideo", .{});
|
||||
module.linkFramework("QuartzCore", .{});
|
||||
|
||||
if (!target.query.isNative()) {
|
||||
try apple_sdk.addPaths(b, &lib.root_module);
|
||||
|
@ -1,4 +1,5 @@
|
||||
pub const foundation = @import("foundation.zig");
|
||||
pub const animation = @import("animation.zig");
|
||||
pub const graphics = @import("graphics.zig");
|
||||
pub const os = @import("os.zig");
|
||||
pub const text = @import("text.zig");
|
||||
|
@ -327,6 +327,10 @@ pub fn init(alloc: Allocator, options: renderer.Options) !Metal {
|
||||
if (comptime builtin.os.tag == .macos) {
|
||||
info.view.setProperty("layer", layer.value);
|
||||
info.view.setProperty("wantsLayer", true);
|
||||
|
||||
// The layer gravity is set to top-left so that when we resize
|
||||
// the view, the contents aren't stretched before a redraw.
|
||||
layer.setProperty("contentsGravity", macos.animation.kCAGravityTopLeft);
|
||||
}
|
||||
|
||||
// Ensure that our metal layer has a content scale set to match the
|
||||
|
Reference in New Issue
Block a user