mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
set refresh callback for redraw
This commit is contained in:
@ -197,6 +197,7 @@ pub fn create(alloc: Allocator, loop: libuv.Loop) !*Window {
|
|||||||
window.setCharCallback(charCallback);
|
window.setCharCallback(charCallback);
|
||||||
window.setKeyCallback(keyCallback);
|
window.setKeyCallback(keyCallback);
|
||||||
window.setFocusCallback(focusCallback);
|
window.setFocusCallback(focusCallback);
|
||||||
|
window.setRefreshCallback(refreshCallback);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -377,6 +378,16 @@ fn focusCallback(window: glfw.Window, focused: bool) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn refreshCallback(window: glfw.Window) void {
|
||||||
|
const tracy = trace(@src());
|
||||||
|
defer tracy.end();
|
||||||
|
|
||||||
|
const win = window.getUserPointer(Window) orelse return;
|
||||||
|
|
||||||
|
// The point of this callback is to schedule a render, so do that.
|
||||||
|
win.render_timer.schedule() catch unreachable;
|
||||||
|
}
|
||||||
|
|
||||||
fn cursorTimerCallback(t: *libuv.Timer) void {
|
fn cursorTimerCallback(t: *libuv.Timer) void {
|
||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
Reference in New Issue
Block a user