mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
set the window cursor to the ibeam
This commit is contained in:
@ -36,6 +36,9 @@ alloc: Allocator,
|
|||||||
/// The glfw window handle.
|
/// The glfw window handle.
|
||||||
window: glfw.Window,
|
window: glfw.Window,
|
||||||
|
|
||||||
|
/// The glfw mouse cursor handle.
|
||||||
|
cursor: glfw.Cursor,
|
||||||
|
|
||||||
/// Whether the window is currently focused
|
/// Whether the window is currently focused
|
||||||
focused: bool,
|
focused: bool,
|
||||||
|
|
||||||
@ -200,9 +203,15 @@ pub fn create(alloc: Allocator, loop: libuv.Loop, config: *const Config) !*Windo
|
|||||||
timer.setData(self);
|
timer.setData(self);
|
||||||
try timer.start(cursorTimerCallback, 600, 600);
|
try timer.start(cursorTimerCallback, 600, 600);
|
||||||
|
|
||||||
|
// Create the cursor
|
||||||
|
const cursor = try glfw.Cursor.createStandard(.ibeam);
|
||||||
|
errdefer cursor.destroy();
|
||||||
|
try window.setCursor(cursor);
|
||||||
|
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.alloc = alloc,
|
.alloc = alloc,
|
||||||
.window = window,
|
.window = window,
|
||||||
|
.cursor = cursor,
|
||||||
.focused = false,
|
.focused = false,
|
||||||
.grid = grid,
|
.grid = grid,
|
||||||
.pty = pty,
|
.pty = pty,
|
||||||
@ -265,6 +274,10 @@ pub fn destroy(self: *Window) void {
|
|||||||
win.alloc.destroy(win);
|
win.alloc.destroy(win);
|
||||||
}
|
}
|
||||||
}).callback);
|
}).callback);
|
||||||
|
|
||||||
|
// We can destroy the cursor right away. glfw will just revert any
|
||||||
|
// windows using it to the default.
|
||||||
|
self.cursor.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn shouldClose(self: Window) bool {
|
pub fn shouldClose(self: Window) bool {
|
||||||
|
Reference in New Issue
Block a user