diff --git a/Ladybird/AppKit/Application/EventLoopImplementation.mm b/Ladybird/AppKit/Application/EventLoopImplementation.mm index db3f4b73e3..1eae190ded 100644 --- a/Ladybird/AppKit/Application/EventLoopImplementation.mm +++ b/Ladybird/AppKit/Application/EventLoopImplementation.mm @@ -72,7 +72,7 @@ int CFEventLoopManager::register_timer(Core::EventReceiver& receiver, int interv } } - Core::TimerEvent event(timer_id); + Core::TimerEvent event; receiver->dispatch_event(event); }); diff --git a/Ladybird/Qt/EventLoopImplementationQt.cpp b/Ladybird/Qt/EventLoopImplementationQt.cpp index fce7d6e6c3..c20792716d 100644 --- a/Ladybird/Qt/EventLoopImplementationQt.cpp +++ b/Ladybird/Qt/EventLoopImplementationQt.cpp @@ -80,13 +80,13 @@ void EventLoopImplementationQt::post_event(Core::EventReceiver& receiver, Nonnul wake(); } -static void qt_timer_fired(int timer_id, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible, Core::EventReceiver& object) +static void qt_timer_fired(Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible, Core::EventReceiver& object) { if (should_fire_when_not_visible == Core::TimerShouldFireWhenNotVisible::No) { if (!object.is_visible_for_timer_purposes()) return; } - Core::TimerEvent event(timer_id); + Core::TimerEvent event; object.dispatch_event(event); } @@ -98,11 +98,11 @@ int EventLoopManagerQt::register_timer(Core::EventReceiver& object, int millisec timer->setSingleShot(!should_reload); auto timer_id = thread_data.timer_id_allocator.allocate(); auto weak_object = object.make_weak_ptr(); - QObject::connect(timer, &QTimer::timeout, [timer_id, should_fire_when_not_visible, weak_object = move(weak_object)] { + QObject::connect(timer, &QTimer::timeout, [should_fire_when_not_visible, weak_object = move(weak_object)] { auto object = weak_object.strong_ref(); if (!object) return; - qt_timer_fired(timer_id, should_fire_when_not_visible, *object); + qt_timer_fired(should_fire_when_not_visible, *object); }); timer->start(); thread_data.timers.set(timer_id, move(timer)); diff --git a/Userland/Libraries/LibCore/Event.h b/Userland/Libraries/LibCore/Event.h index 11755f58ba..9f51721c9f 100644 --- a/Userland/Libraries/LibCore/Event.h +++ b/Userland/Libraries/LibCore/Event.h @@ -66,17 +66,12 @@ private: class TimerEvent final : public Event { public: - explicit TimerEvent(int timer_id) + explicit TimerEvent() : Event(Event::Timer) - , m_timer_id(timer_id) { } + ~TimerEvent() = default; - - int timer_id() const { return m_timer_id; } - -private: - int m_timer_id; }; enum class NotificationType { diff --git a/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp b/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp index 506501cf06..ae65e35043 100644 --- a/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp +++ b/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp @@ -244,7 +244,7 @@ try_select_again: } if (owner) - ThreadEventQueue::current().post_event(*owner, make(timer.timer_id)); + ThreadEventQueue::current().post_event(*owner, make()); if (timer.should_reload) { timer.reload(now); } else {