mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
apprt/embedded: do not depend on macOS APIs on non-macOS
This commit is contained in:
@ -1664,6 +1664,9 @@ pub const CAPI = struct {
|
|||||||
ptr: *Surface,
|
ptr: *Surface,
|
||||||
window: *anyopaque,
|
window: *anyopaque,
|
||||||
) void {
|
) void {
|
||||||
|
// This is only supported on macOS
|
||||||
|
if (comptime builtin.target.os.tag != .macos) return;
|
||||||
|
|
||||||
const config = ptr.app.config;
|
const config = ptr.app.config;
|
||||||
|
|
||||||
// Do nothing if we don't have background transparency enabled
|
// Do nothing if we don't have background transparency enabled
|
||||||
|
@ -17,8 +17,8 @@ pub const SplitResizeDirection = Binding.Action.SplitResizeDirection;
|
|||||||
// Keymap is only available on macOS right now. We could implement it
|
// Keymap is only available on macOS right now. We could implement it
|
||||||
// in theory for XKB too on Linux but we don't need it right now.
|
// in theory for XKB too on Linux but we don't need it right now.
|
||||||
pub const Keymap = switch (builtin.os.tag) {
|
pub const Keymap = switch (builtin.os.tag) {
|
||||||
.ios, .macos => @import("input/KeymapDarwin.zig"),
|
.macos => @import("input/KeymapDarwin.zig"),
|
||||||
else => struct {},
|
else => @import("input/KeymapNoop.zig"),
|
||||||
};
|
};
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
38
src/input/KeymapNoop.zig
Normal file
38
src/input/KeymapNoop.zig
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//! A noop implementation of the keymap interface so that the embedded
|
||||||
|
//! library can compile on non-macOS platforms.
|
||||||
|
const KeymapNoop = @This();
|
||||||
|
|
||||||
|
const Mods = @import("key.zig").Mods;
|
||||||
|
|
||||||
|
pub const State = struct {};
|
||||||
|
pub const Translation = struct {
|
||||||
|
text: []const u8,
|
||||||
|
composing: bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn init() !KeymapNoop {
|
||||||
|
return .{};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn deinit(self: *const KeymapNoop) void {
|
||||||
|
_ = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reload(self: *KeymapNoop) !void {
|
||||||
|
_ = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn translate(
|
||||||
|
self: *const KeymapNoop,
|
||||||
|
out: []u8,
|
||||||
|
state: *State,
|
||||||
|
code: u16,
|
||||||
|
mods: Mods,
|
||||||
|
) !Translation {
|
||||||
|
_ = self;
|
||||||
|
_ = out;
|
||||||
|
_ = state;
|
||||||
|
_ = code;
|
||||||
|
_ = mods;
|
||||||
|
return .{ .text = "", .composing = false };
|
||||||
|
}
|
Reference in New Issue
Block a user