mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-30 04:17:56 +00:00
macos: support cursor style
This commit is contained in:
@@ -11,6 +11,7 @@ const Allocator = std.mem.Allocator;
|
||||
const objc = @import("objc");
|
||||
const apprt = @import("../apprt.zig");
|
||||
const input = @import("../input.zig");
|
||||
const terminal = @import("../terminal/main.zig");
|
||||
const CoreApp = @import("../App.zig");
|
||||
const CoreSurface = @import("../Surface.zig");
|
||||
const configpkg = @import("../config.zig");
|
||||
@@ -48,6 +49,9 @@ pub const App = struct {
|
||||
/// Called to set the title of the window.
|
||||
set_title: *const fn (SurfaceUD, [*]const u8) callconv(.C) void,
|
||||
|
||||
/// Called to set the cursor shape.
|
||||
set_cursor_shape: *const fn (SurfaceUD, terminal.CursorShape) callconv(.C) void,
|
||||
|
||||
/// Read the clipboard value. The return value must be preserved
|
||||
/// by the host until the next call. If there is no valid clipboard
|
||||
/// value then this should return null.
|
||||
@@ -310,6 +314,13 @@ pub const Surface = struct {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn setCursorShape(self: *Surface, shape: terminal.CursorShape) !void {
|
||||
self.app.opts.set_cursor_shape(
|
||||
self.opts.userdata,
|
||||
shape,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn supportsClipboard(
|
||||
self: *const Surface,
|
||||
clipboard_type: apprt.Clipboard,
|
||||
|
||||
@@ -3,6 +3,8 @@ const std = @import("std");
|
||||
/// The possible cursor shapes. Not all app runtimes support these shapes.
|
||||
/// The shapes are always based on the W3C supported cursor styles so we
|
||||
/// can have a cross platform list.
|
||||
//
|
||||
// Must be kept in sync with ghostty_cursor_shape_e
|
||||
pub const CursorShape = enum(c_int) {
|
||||
default,
|
||||
context_menu,
|
||||
|
||||
Reference in New Issue
Block a user