Merge branch 'ghostty-org:main' into feat/add-keybind-action-for-copy_url_to_clipboard

This commit is contained in:
Alexandre Antonio Juca
2025-01-06 17:03:49 +01:00
committed by GitHub
5 changed files with 49 additions and 24 deletions

View File

@ -145,7 +145,6 @@ pub fn build(b: *std.Build) !void {
if (std.mem.indexOf(u8, stdout.items, "wayland")) |_| wayland = true; if (std.mem.indexOf(u8, stdout.items, "wayland")) |_| wayland = true;
} else { } else {
std.log.warn("pkg-config: {s} with code {d}", .{ @tagName(term), code }); std.log.warn("pkg-config: {s} with code {d}", .{ @tagName(term), code });
return error.Unexpected;
} }
}, },
inline else => |code| { inline else => |code| {

View File

@ -430,9 +430,16 @@ class AppDelegate: NSObject,
ghostty_app_key_is_binding( ghostty_app_key_is_binding(
app, app,
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) { event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) {
ghostty_app_key(app, event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) // If the key was handled by Ghostty we stop the event chain. If
// the key wasn't handled then we let it fall through and continue
// processing. This is important because some bindings may have no
// affect at this scope.
if (ghostty_app_key(
app,
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS))) {
return nil return nil
} }
}
// If this event would be handled by our menu then we do nothing. // If this event would be handled by our menu then we do nothing.
if let mainMenu = NSApp.mainMenu, if let mainMenu = NSApp.mainMenu,

View File

@ -667,12 +667,16 @@ fileprivate class WindowDragView: NSView {
// A view that matches the color of selected and unselected tabs in the adjacent tab bar. // A view that matches the color of selected and unselected tabs in the adjacent tab bar.
fileprivate class WindowButtonsBackdropView: NSView { fileprivate class WindowButtonsBackdropView: NSView {
private let terminalWindow: TerminalWindow // This must be weak because the window has this view. Otherwise
// a retain cycle occurs.
private weak var terminalWindow: TerminalWindow?
private let isLightTheme: Bool private let isLightTheme: Bool
private let overlayLayer = VibrantLayer() private let overlayLayer = VibrantLayer()
var isHighlighted: Bool = true { var isHighlighted: Bool = true {
didSet { didSet {
guard let terminalWindow else { return }
if isLightTheme { if isLightTheme {
overlayLayer.isHidden = isHighlighted overlayLayer.isHidden = isHighlighted
layer?.backgroundColor = .clear layer?.backgroundColor = .clear

View File

@ -209,9 +209,13 @@ pub const GPUState = struct {
} }
fn chooseDevice() error{NoMetalDevice}!objc.Object { fn chooseDevice() error{NoMetalDevice}!objc.Object {
var chosen_device: ?objc.Object = null;
switch (comptime builtin.os.tag) {
.macos => {
const devices = objc.Object.fromId(mtl.MTLCopyAllDevices()); const devices = objc.Object.fromId(mtl.MTLCopyAllDevices());
defer devices.release(); defer devices.release();
var chosen_device: ?objc.Object = null;
var iter = devices.iterate(); var iter = devices.iterate();
while (iter.next()) |device| { while (iter.next()) |device| {
// We want a GPU thats connected to a display. // We want a GPU thats connected to a display.
@ -223,6 +227,13 @@ pub const GPUState = struct {
if (device.getProperty(bool, "isRemovable") or if (device.getProperty(bool, "isRemovable") or
device.getProperty(bool, "isLowPower")) break; device.getProperty(bool, "isLowPower")) break;
} }
},
.ios => {
chosen_device = objc.Object.fromId(mtl.MTLCreateSystemDefaultDevice());
},
else => @compileError("unsupported target for Metal"),
}
const device = chosen_device orelse return error.NoMetalDevice; const device = chosen_device orelse return error.NoMetalDevice;
return device.retain(); return device.retain();
} }

View File

@ -175,4 +175,8 @@ pub const MTLSize = extern struct {
depth: c_ulong, depth: c_ulong,
}; };
/// https://developer.apple.com/documentation/metal/1433367-mtlcopyalldevices
pub extern "c" fn MTLCopyAllDevices() ?*anyopaque; pub extern "c" fn MTLCopyAllDevices() ?*anyopaque;
/// https://developer.apple.com/documentation/metal/1433401-mtlcreatesystemdefaultdevice
pub extern "c" fn MTLCreateSystemDefaultDevice() ?*anyopaque;