1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 13:27:36 +00:00

LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr

The FIXMEs must flow!
This commit is contained in:
Sam Atkins 2023-01-11 16:20:17 +00:00 committed by Andreas Kling
parent 1d4f287582
commit a15d44f019
12 changed files with 19 additions and 17 deletions

View file

@ -37,10 +37,10 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
m_cursor_params = Gfx::CursorParams::parse_from_filename(cursor_path, m_cursor_bitmap->rect().center()).constrained(*m_cursor_bitmap);
// Setup cursor animation:
if (m_cursor_params.frames() > 1 && m_cursor_params.frame_ms() > 0) {
m_frame_timer = Core::Timer::create_repeating(m_cursor_params.frame_ms(), [&] {
m_frame_timer = TRY(Core::Timer::create_repeating(m_cursor_params.frame_ms(), [&] {
m_cursor_frame = (m_cursor_frame + 1) % m_cursor_params.frames();
update();
});
}));
m_frame_timer->start();
} else {
m_frame_timer = nullptr;