From ddbe6bd7b4a200c899fd416407d0f7839cab2f0c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 6 Aug 2023 18:09:39 +0200 Subject: [PATCH] Userland: Rename Core::Object to Core::EventReceiver This is a more precise description of what this class actually does. --- Documentation/EventLoop.md | 2 +- Ladybird/EventLoopImplementationQt.cpp | 8 +- Ladybird/EventLoopImplementationQt.h | 4 +- Tests/Kernel/crash.cpp | 4 +- .../Applications/Escalator/EscalatorWindow.h | 2 +- Userland/Applications/Piano/AudioPlayerLoop.h | 4 +- .../ParameterWidget.h | 2 +- .../Piano/ProcessorParameterWidget/Toggle.h | 2 +- .../Applications/PixelPaint/ScopeWidget.h | 2 +- .../SoundPlayer/SoundPlayerWidget.h | 2 +- .../Applications/Spreadsheet/Spreadsheet.h | 4 +- .../SystemMonitor/GraphWidget.cpp | 2 +- .../SystemMonitor/MemoryStatsWidget.cpp | 2 +- .../SystemMonitor/ThreadStackWidget.cpp | 2 +- Userland/Applications/SystemMonitor/main.cpp | 2 +- .../DevTools/GMLPlayground/MainWidget.cpp | 2 +- .../DevTools/HackStudio/GMLPreviewWidget.cpp | 2 +- Userland/DevTools/HackStudio/Locator.cpp | 2 +- Userland/DevTools/HackStudio/Locator.h | 2 +- Userland/DevTools/HackStudio/ProjectConfig.h | 2 +- .../Libraries/LibAudio/ConnectionToServer.h | 2 +- Userland/Libraries/LibCards/Card.h | 4 +- Userland/Libraries/LibChess/UCIEndpoint.cpp | 2 +- Userland/Libraries/LibChess/UCIEndpoint.h | 4 +- Userland/Libraries/LibCore/CMakeLists.txt | 2 +- .../LibCore/DeferredInvocationContext.h | 4 +- Userland/Libraries/LibCore/Event.cpp | 12 +-- Userland/Libraries/LibCore/Event.h | 14 +-- Userland/Libraries/LibCore/EventLoop.cpp | 8 +- Userland/Libraries/LibCore/EventLoop.h | 6 +- .../LibCore/EventLoopImplementation.h | 4 +- .../LibCore/EventLoopImplementationUnix.cpp | 8 +- .../LibCore/EventLoopImplementationUnix.h | 4 +- .../LibCore/{Object.cpp => EventReceiver.cpp} | 40 +++---- .../LibCore/{Object.h => EventReceiver.h} | 66 ++++++------ Userland/Libraries/LibCore/Forward.h | 5 +- Userland/Libraries/LibCore/LocalServer.cpp | 4 +- Userland/Libraries/LibCore/LocalServer.h | 6 +- Userland/Libraries/LibCore/MimeData.h | 4 +- Userland/Libraries/LibCore/NetworkJob.h | 6 +- Userland/Libraries/LibCore/Notifier.cpp | 6 +- Userland/Libraries/LibCore/Notifier.h | 6 +- Userland/Libraries/LibCore/Promise.h | 8 +- Userland/Libraries/LibCore/TCPServer.cpp | 6 +- Userland/Libraries/LibCore/TCPServer.h | 8 +- .../Libraries/LibCore/ThreadEventQueue.cpp | 14 +-- Userland/Libraries/LibCore/ThreadEventQueue.h | 4 +- Userland/Libraries/LibCore/ThreadedPromise.h | 6 +- Userland/Libraries/LibCore/Timer.cpp | 8 +- Userland/Libraries/LibCore/Timer.h | 12 +-- Userland/Libraries/LibCore/UDPServer.cpp | 4 +- Userland/Libraries/LibCore/UDPServer.h | 6 +- .../Libraries/LibGUI/AbstractTableView.cpp | 2 +- Userland/Libraries/LibGUI/AbstractView.cpp | 2 +- Userland/Libraries/LibGUI/Action.cpp | 38 +++---- Userland/Libraries/LibGUI/Action.h | 100 +++++++++--------- Userland/Libraries/LibGUI/Application.cpp | 2 +- Userland/Libraries/LibGUI/Application.h | 4 +- Userland/Libraries/LibGUI/CommandPalette.cpp | 2 +- Userland/Libraries/LibGUI/CommonActions.cpp | 54 +++++----- Userland/Libraries/LibGUI/Dialog.h | 2 +- Userland/Libraries/LibGUI/DragOperation.cpp | 4 +- Userland/Libraries/LibGUI/DragOperation.h | 6 +- Userland/Libraries/LibGUI/Menu.h | 4 +- Userland/Libraries/LibGUI/Menubar.h | 4 +- Userland/Libraries/LibGUI/Notification.h | 4 +- Userland/Libraries/LibGUI/Object.cpp | 4 +- Userland/Libraries/LibGUI/Object.h | 6 +- .../LibGUI/ScrollableContainerWidget.cpp | 2 +- Userland/Libraries/LibGUI/TreeView.cpp | 2 +- Userland/Libraries/LibGUI/VimEditingEngine.h | 2 +- Userland/Libraries/LibGUI/Widget.cpp | 8 +- Userland/Libraries/LibGUI/Widget.h | 6 +- Userland/Libraries/LibGUI/Window.cpp | 4 +- Userland/Libraries/LibGUI/Window.h | 4 +- Userland/Libraries/LibIMAP/Objects.h | 2 +- Userland/Libraries/LibIPC/Connection.h | 4 +- .../Libraries/LibIPC/ConnectionFromClient.h | 2 +- Userland/Libraries/LibLine/Editor.h | 4 +- Userland/Libraries/LibSQL/BTree.h | 2 +- Userland/Libraries/LibSQL/Database.h | 4 +- Userland/Libraries/LibSQL/HashIndex.h | 2 +- Userland/Libraries/LibSQL/Heap.h | 4 +- Userland/Libraries/LibSQL/Index.h | 4 +- Userland/Libraries/LibSQL/Meta.h | 8 +- .../Libraries/LibThreading/BackgroundAction.h | 10 +- Userland/Libraries/LibThreading/Thread.cpp | 2 +- Userland/Libraries/LibThreading/Thread.h | 4 +- .../Libraries/LibVideo/Containers/Demuxer.h | 2 +- .../Libraries/LibWeb/Loader/ResourceLoader.h | 4 +- .../Libraries/LibWeb/WebDriver/Client.cpp | 4 +- Userland/Libraries/LibWeb/WebDriver/Client.h | 6 +- .../Libraries/LibWeb/WebSockets/WebSocket.h | 4 +- .../Libraries/LibWebSocket/ConnectionInfo.h | 2 +- Userland/Libraries/LibWebSocket/WebSocket.h | 4 +- Userland/Services/AudioServer/Mixer.h | 2 +- Userland/Services/DHCPClient/DHCPv4Client.cpp | 2 +- Userland/Services/DHCPClient/DHCPv4Client.h | 2 +- Userland/Services/LookupServer/DNSServer.cpp | 2 +- Userland/Services/LookupServer/DNSServer.h | 2 +- Userland/Services/LookupServer/LookupServer.h | 4 +- .../Services/LookupServer/MulticastDNS.cpp | 2 +- Userland/Services/LookupServer/MulticastDNS.h | 2 +- .../Services/SQLServer/DatabaseConnection.cpp | 3 +- .../Services/SQLServer/DatabaseConnection.h | 4 +- Userland/Services/SQLServer/SQLStatement.cpp | 4 +- Userland/Services/SQLServer/SQLStatement.h | 4 +- Userland/Services/SystemServer/Service.cpp | 2 +- Userland/Services/SystemServer/Service.h | 4 +- Userland/Services/WebDriver/Client.cpp | 4 +- Userland/Services/WebDriver/Client.h | 6 +- Userland/Services/WebServer/Client.cpp | 4 +- Userland/Services/WebServer/Client.h | 6 +- .../Services/WindowServer/AppletManager.h | 2 +- Userland/Services/WindowServer/Compositor.h | 4 +- .../WindowServer/ConnectionFromClient.h | 2 +- .../Services/WindowServer/KeymapSwitcher.h | 4 +- Userland/Services/WindowServer/Menu.cpp | 4 +- Userland/Services/WindowServer/Menu.h | 4 +- .../Services/WindowServer/MenuManager.cpp | 2 +- Userland/Services/WindowServer/MenuManager.h | 2 +- Userland/Services/WindowServer/Window.cpp | 6 +- Userland/Services/WindowServer/Window.h | 6 +- .../Services/WindowServer/WindowManager.cpp | 2 +- .../Services/WindowServer/WindowManager.h | 2 +- .../Services/WindowServer/WindowSwitcher.h | 4 +- Userland/Shell/Job.h | 2 +- Userland/Shell/Shell.h | 4 +- 128 files changed, 399 insertions(+), 401 deletions(-) rename Userland/Libraries/LibCore/{Object.cpp => EventReceiver.cpp} (77%) rename Userland/Libraries/LibCore/{Object.h => EventReceiver.h} (77%) diff --git a/Documentation/EventLoop.md b/Documentation/EventLoop.md index dc5169b4c67..c5392dcf005 100644 --- a/Documentation/EventLoop.md +++ b/Documentation/EventLoop.md @@ -29,7 +29,7 @@ The **event loop stack** is mainly used for nesting GUI windows. Each window add An event loop handles several kinds of events: - POSIX signals can be registered with `EventLoop::register_signal()`. This means that the event loop of the calling thread registers the specified POSIX signal and callback with the kernel, and you can be sure that the signal handler will run as a normal event without the weirdness that comes with POSIX signal handlers (such as unspecified thread). -- EventLoop::post_event() allows calling code to fire an event targeting a specific Core::Object the next time the event loop is pumped. +- EventLoop::post_event() allows calling code to fire an event targeting a specific Core::EventReceiver the next time the event loop is pumped. - Similarly, an arbitrary callback can be called on the next event loop iteration with `EventLoop::deferred_invoke()`. - Timer events, i.e. events that fire after a certain timeout, possibly repeatedly, can be created with `EventLoop::register_timer` and `Object::start_timer()`. A more user-friendly version is the `Core::Timer` utility class which does the same thing and allows you to attach any callback to the timer. - For when a "file" becomes readable or writeable, the utility class `Core::Notifier` interfaces with the event loop system to handle exactly that. diff --git a/Ladybird/EventLoopImplementationQt.cpp b/Ladybird/EventLoopImplementationQt.cpp index 6b9bb3409e1..ee9f326c833 100644 --- a/Ladybird/EventLoopImplementationQt.cpp +++ b/Ladybird/EventLoopImplementationQt.cpp @@ -8,8 +8,8 @@ #include "EventLoopImplementationQtEventTarget.h" #include #include +#include #include -#include #include #include #include @@ -73,14 +73,14 @@ void EventLoopImplementationQt::wake() m_event_loop.wakeUp(); } -void EventLoopImplementationQt::post_event(Core::Object& receiver, NonnullOwnPtr&& event) +void EventLoopImplementationQt::post_event(Core::EventReceiver& receiver, NonnullOwnPtr&& event) { m_thread_event_queue.post_event(receiver, move(event)); if (&m_thread_event_queue != &Core::ThreadEventQueue::current()) wake(); } -static void qt_timer_fired(int timer_id, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible, Core::Object& object) +static void qt_timer_fired(int timer_id, 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()) @@ -90,7 +90,7 @@ static void qt_timer_fired(int timer_id, Core::TimerShouldFireWhenNotVisible sho object.dispatch_event(event); } -int EventLoopManagerQt::register_timer(Core::Object& object, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible) +int EventLoopManagerQt::register_timer(Core::EventReceiver& object, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible) { auto& thread_data = ThreadData::the(); auto timer = make(); diff --git a/Ladybird/EventLoopImplementationQt.h b/Ladybird/EventLoopImplementationQt.h index 5308c752048..7a5f7ee8a0d 100644 --- a/Ladybird/EventLoopImplementationQt.h +++ b/Ladybird/EventLoopImplementationQt.h @@ -26,7 +26,7 @@ public: virtual ~EventLoopManagerQt() override; virtual NonnullOwnPtr make_implementation() override; - virtual int register_timer(Core::Object&, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible) override; + virtual int register_timer(Core::EventReceiver&, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible) override; virtual bool unregister_timer(int timer_id) override; virtual void register_notifier(Core::Notifier&) override; @@ -67,7 +67,7 @@ public: virtual size_t pump(PumpMode) override; virtual void quit(int) override; virtual void wake() override; - virtual void post_event(Core::Object& receiver, NonnullOwnPtr&&) override; + virtual void post_event(Core::EventReceiver& receiver, NonnullOwnPtr&&) override; // FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them. virtual void unquit() override { } diff --git a/Tests/Kernel/crash.cpp b/Tests/Kernel/crash.cpp index 2d99ee419c7..6fec2bbad24 100644 --- a/Tests/Kernel/crash.cpp +++ b/Tests/Kernel/crash.cpp @@ -12,7 +12,7 @@ # include #endif #include -#include +#include #include #include #include @@ -327,7 +327,7 @@ int main(int argc, char** argv) if (do_deref_null_refptr || do_all_crash_types) { any_failures |= !Crash("Dereference a null RefPtr", [] { - RefPtr p; + RefPtr p; *p; return Crash::Failure::DidNotCrash; }).run(run_type); diff --git a/Userland/Applications/Escalator/EscalatorWindow.h b/Userland/Applications/Escalator/EscalatorWindow.h index 53b877c6e22..394656aa226 100644 --- a/Userland/Applications/Escalator/EscalatorWindow.h +++ b/Userland/Applications/Escalator/EscalatorWindow.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Applications/Piano/AudioPlayerLoop.h b/Userland/Applications/Piano/AudioPlayerLoop.h index 82d74ed0f01..c7fa402629e 100644 --- a/Userland/Applications/Piano/AudioPlayerLoop.h +++ b/Userland/Applications/Piano/AudioPlayerLoop.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,7 +22,7 @@ class TrackManager; // Wrapper class accepting custom events to advance the track playing and forward audio data to the system. // This does not run on a separate thread, preventing IPC multithreading madness. -class AudioPlayerLoop final : public Core::Object { +class AudioPlayerLoop final : public Core::EventReceiver { C_OBJECT(AudioPlayerLoop) public: virtual ~AudioPlayerLoop() override; diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.h b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.h index 7c9a06baeb8..8000a8d59f1 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.h +++ b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/Toggle.h b/Userland/Applications/Piano/ProcessorParameterWidget/Toggle.h index 041a565f43e..9a110aa4674 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/Toggle.h +++ b/Userland/Applications/Piano/ProcessorParameterWidget/Toggle.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include diff --git a/Userland/Applications/PixelPaint/ScopeWidget.h b/Userland/Applications/PixelPaint/ScopeWidget.h index 527320d2ff3..be258d72530 100644 --- a/Userland/Applications/PixelPaint/ScopeWidget.h +++ b/Userland/Applications/PixelPaint/ScopeWidget.h @@ -7,7 +7,7 @@ #pragma once #include "Image.h" -#include +#include #include namespace PixelPaint { diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidget.h b/Userland/Applications/SoundPlayer/SoundPlayerWidget.h index 5977842661c..6eb34c66dc3 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidget.h +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidget.h @@ -33,7 +33,7 @@ public: m_visualization->remove_from_parent(); update(); auto new_visualization = T::construct(move(args)...); - m_player_view->insert_child_before(new_visualization, *static_cast(m_playback_progress_slider.ptr())); + m_player_view->insert_child_before(new_visualization, *static_cast(m_playback_progress_slider.ptr())); m_visualization = new_visualization; if (!loaded_filename().is_empty()) m_visualization->start_new_file(loaded_filename()); diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.h b/Userland/Applications/Spreadsheet/Spreadsheet.h index c0ad0beb6a8..4762f011a8c 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.h +++ b/Userland/Applications/Spreadsheet/Spreadsheet.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include namespace Spreadsheet { @@ -41,7 +41,7 @@ private: CellTypeMetadata m_new_type_metadata; }; -class Sheet : public Core::Object { +class Sheet : public Core::EventReceiver { C_OBJECT(Sheet); public: diff --git a/Userland/Applications/SystemMonitor/GraphWidget.cpp b/Userland/Applications/SystemMonitor/GraphWidget.cpp index 8647e9116f1..d0007f98716 100644 --- a/Userland/Applications/SystemMonitor/GraphWidget.cpp +++ b/Userland/Applications/SystemMonitor/GraphWidget.cpp @@ -6,7 +6,7 @@ */ #include "GraphWidget.h" -#include +#include #include #include #include diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 6b38516c4de..a4bfabc5153 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -9,7 +9,7 @@ #include "GraphWidget.h" #include #include -#include +#include #include #include #include diff --git a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp index 00e5a8c838e..303f5a92753 100644 --- a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp +++ b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp @@ -126,7 +126,7 @@ void ThreadStackWidget::refresh() [weak_this = make_weak_ptr()](auto result) -> ErrorOr { if (!weak_this) return {}; - Core::EventLoop::current().post_event(const_cast(*weak_this), make(move(result))); + Core::EventLoop::current().post_event(const_cast(*weak_this), make(move(result))); return {}; }); } diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 6f3d4d748a1..4a9bcc477ec 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/DevTools/GMLPlayground/MainWidget.cpp b/Userland/DevTools/GMLPlayground/MainWidget.cpp index 95cf4740443..bf89548fef6 100644 --- a/Userland/DevTools/GMLPlayground/MainWidget.cpp +++ b/Userland/DevTools/GMLPlayground/MainWidget.cpp @@ -90,7 +90,7 @@ ErrorOr> MainWidget::try_create(GUI::Icon const& icon) main_widget->m_editor->on_change = [main_widget = main_widget.ptr()] { main_widget->m_preview->remove_all_children(); // FIXME: Parsing errors happen while the user is typing. What should we do about them? - (void)main_widget->m_preview->load_from_gml(main_widget->m_editor->text(), [](DeprecatedString const& class_name) -> ErrorOr> { + (void)main_widget->m_preview->load_from_gml(main_widget->m_editor->text(), [](DeprecatedString const& class_name) -> ErrorOr> { return UnregisteredWidget::try_create(class_name); }); }; diff --git a/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp b/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp index b71f2191acc..6c0c08fcc30 100644 --- a/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp +++ b/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp @@ -28,7 +28,7 @@ void GMLPreviewWidget::load_gml(DeprecatedString const& gml) } // FIXME: Parsing errors happen while the user is typing. What should we do about them? - (void)load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr> { + (void)load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr> { return GUI::Label::try_create(TRY(String::formatted("{} is not registered as a GML element!", name))); }); diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index 124d12abb01..f270dff6330 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -95,7 +95,7 @@ LocatorSuggestionModel::Suggestion LocatorSuggestionModel::Suggestion::create_sy return s; } -Locator::Locator(Core::Object* parent) +Locator::Locator(Core::EventReceiver* parent) { set_layout(); set_fixed_height(22); diff --git a/Userland/DevTools/HackStudio/Locator.h b/Userland/DevTools/HackStudio/Locator.h index 8f38db45e89..b5525449e11 100644 --- a/Userland/DevTools/HackStudio/Locator.h +++ b/Userland/DevTools/HackStudio/Locator.h @@ -24,7 +24,7 @@ private: void update_suggestions(); void open_suggestion(const GUI::ModelIndex&); - Locator(Core::Object* parent = nullptr); + Locator(Core::EventReceiver* parent = nullptr); RefPtr m_textbox; RefPtr m_popup_window; diff --git a/Userland/DevTools/HackStudio/ProjectConfig.h b/Userland/DevTools/HackStudio/ProjectConfig.h index 10181639ac3..20019aa6a98 100644 --- a/Userland/DevTools/HackStudio/ProjectConfig.h +++ b/Userland/DevTools/HackStudio/ProjectConfig.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace HackStudio { diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index eef31acad5f..d35a6078d7a 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibCards/Card.h b/Userland/Libraries/LibCards/Card.h index 0083e8291f4..9072d26f2b8 100644 --- a/Userland/Libraries/LibCards/Card.h +++ b/Userland/Libraries/LibCards/Card.h @@ -9,7 +9,7 @@ #pragma once #include -#include +#include #include #include #include @@ -77,7 +77,7 @@ enum class Suit : u8 { __Count }; -class Card final : public Core::Object { +class Card final : public Core::EventReceiver { C_OBJECT(Card) public: static constexpr int width = 80; diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index a137124adbc..25101ecaddc 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -51,7 +51,7 @@ void Endpoint::event(Core::Event& event) case Command::Type::UCINewGame: return handle_ucinewgame(); default: - Object::event(event); + EventReceiver::event(event); break; } } diff --git a/Userland/Libraries/LibChess/UCIEndpoint.h b/Userland/Libraries/LibChess/UCIEndpoint.h index b7b617547fa..1aa31cdda18 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.h +++ b/Userland/Libraries/LibChess/UCIEndpoint.h @@ -8,13 +8,13 @@ #pragma once #include +#include #include #include -#include namespace Chess::UCI { -class Endpoint : public Core::Object { +class Endpoint : public Core::EventReceiver { C_OBJECT(Endpoint) public: virtual ~Endpoint() override = default; diff --git a/Userland/Libraries/LibCore/CMakeLists.txt b/Userland/Libraries/LibCore/CMakeLists.txt index 9de449528a0..d21d6f51f69 100644 --- a/Userland/Libraries/LibCore/CMakeLists.txt +++ b/Userland/Libraries/LibCore/CMakeLists.txt @@ -12,13 +12,13 @@ set(SOURCES EventLoop.cpp EventLoopImplementation.cpp EventLoopImplementationUnix.cpp + EventReceiver.cpp File.cpp LockFile.cpp MappedFile.cpp MimeData.cpp NetworkJob.cpp Notifier.cpp - Object.cpp Process.cpp ProcessStatisticsReader.cpp SecretString.cpp diff --git a/Userland/Libraries/LibCore/DeferredInvocationContext.h b/Userland/Libraries/LibCore/DeferredInvocationContext.h index 80626379bb3..5af46ff3dba 100644 --- a/Userland/Libraries/LibCore/DeferredInvocationContext.h +++ b/Userland/Libraries/LibCore/DeferredInvocationContext.h @@ -7,11 +7,11 @@ #pragma once -#include +#include namespace Core { -class DeferredInvocationContext final : public Core::Object { +class DeferredInvocationContext final : public Core::EventReceiver { C_OBJECT(DeferredInvocationContext) private: DeferredInvocationContext() = default; diff --git a/Userland/Libraries/LibCore/Event.cpp b/Userland/Libraries/LibCore/Event.cpp index 6faee840f1c..1f2fe16794a 100644 --- a/Userland/Libraries/LibCore/Event.cpp +++ b/Userland/Libraries/LibCore/Event.cpp @@ -7,39 +7,39 @@ #include #include -#include +#include namespace Core { -ChildEvent::ChildEvent(Type type, Object& child, Object* insertion_before_child) +ChildEvent::ChildEvent(Type type, EventReceiver& child, EventReceiver* insertion_before_child) : Core::Event(type) , m_child(child.make_weak_ptr()) , m_insertion_before_child(AK::make_weak_ptr_if_nonnull(insertion_before_child)) { } -Object* ChildEvent::child() +EventReceiver* ChildEvent::child() { if (auto ref = m_child.strong_ref()) return ref.ptr(); return nullptr; } -Object const* ChildEvent::child() const +EventReceiver const* ChildEvent::child() const { if (auto ref = m_child.strong_ref()) return ref.ptr(); return nullptr; } -Object* ChildEvent::insertion_before_child() +EventReceiver* ChildEvent::insertion_before_child() { if (auto ref = m_insertion_before_child.strong_ref()) return ref.ptr(); return nullptr; } -Object const* ChildEvent::insertion_before_child() const +EventReceiver const* ChildEvent::insertion_before_child() const { if (auto ref = m_insertion_before_child.strong_ref()) return ref.ptr(); diff --git a/Userland/Libraries/LibCore/Event.h b/Userland/Libraries/LibCore/Event.h index a539ee5943d..a3bdf01e309 100644 --- a/Userland/Libraries/LibCore/Event.h +++ b/Userland/Libraries/LibCore/Event.h @@ -95,18 +95,18 @@ private: class ChildEvent final : public Event { public: - ChildEvent(Type, Object& child, Object* insertion_before_child = nullptr); + ChildEvent(Type, EventReceiver& child, EventReceiver* insertion_before_child = nullptr); ~ChildEvent() = default; - Object* child(); - Object const* child() const; + EventReceiver* child(); + EventReceiver const* child() const; - Object* insertion_before_child(); - Object const* insertion_before_child() const; + EventReceiver* insertion_before_child(); + EventReceiver const* insertion_before_child() const; private: - WeakPtr m_child; - WeakPtr m_insertion_before_child; + WeakPtr m_child; + WeakPtr m_insertion_before_child; }; class CustomEvent : public Event { diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index ee889a98cf9..98ffbe518fe 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -98,12 +98,12 @@ size_t EventLoop::pump(WaitMode mode) return m_impl->pump(mode == WaitMode::WaitForEvents ? EventLoopImplementation::PumpMode::WaitForEvents : EventLoopImplementation::PumpMode::DontWaitForEvents); } -void EventLoop::post_event(Object& receiver, NonnullOwnPtr&& event) +void EventLoop::post_event(EventReceiver& receiver, NonnullOwnPtr&& event) { m_impl->post_event(receiver, move(event)); } -void EventLoop::add_job(NonnullRefPtr>> job_promise) +void EventLoop::add_job(NonnullRefPtr>> job_promise) { ThreadEventQueue::current().add_job(move(job_promise)); } @@ -123,7 +123,7 @@ void EventLoop::notify_forked(ForkEvent) current().m_impl->notify_forked_and_in_child(); } -int EventLoop::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) +int EventLoop::register_timer(EventReceiver& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) { return EventLoopManager::the().register_timer(object, milliseconds, should_reload, fire_when_not_visible); } diff --git a/Userland/Libraries/LibCore/EventLoop.h b/Userland/Libraries/LibCore/EventLoop.h index e43a22838bb..e4cb648b454 100644 --- a/Userland/Libraries/LibCore/EventLoop.h +++ b/Userland/Libraries/LibCore/EventLoop.h @@ -63,9 +63,9 @@ public: void spin_until(Function); // Post an event to this event loop. - void post_event(Object& receiver, NonnullOwnPtr&&); + void post_event(EventReceiver& receiver, NonnullOwnPtr&&); - void add_job(NonnullRefPtr>> job_promise); + void add_job(NonnullRefPtr>> job_promise); void deferred_invoke(Function); @@ -76,7 +76,7 @@ public: bool was_exit_requested() const; // The registration functions act upon the current loop of the current thread. - static int register_timer(Object&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible); + static int register_timer(EventReceiver&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible); static bool unregister_timer(int timer_id); static void register_notifier(Badge, Notifier&); diff --git a/Userland/Libraries/LibCore/EventLoopImplementation.h b/Userland/Libraries/LibCore/EventLoopImplementation.h index b195820d696..56b4d933b8c 100644 --- a/Userland/Libraries/LibCore/EventLoopImplementation.h +++ b/Userland/Libraries/LibCore/EventLoopImplementation.h @@ -23,7 +23,7 @@ public: virtual NonnullOwnPtr make_implementation() = 0; - virtual int register_timer(Object&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible) = 0; + virtual int register_timer(EventReceiver&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible) = 0; virtual bool unregister_timer(int timer_id) = 0; virtual void register_notifier(Notifier&) = 0; @@ -53,7 +53,7 @@ public: virtual void quit(int) = 0; virtual void wake() = 0; - virtual void post_event(Object& receiver, NonnullOwnPtr&&) = 0; + virtual void post_event(EventReceiver& receiver, NonnullOwnPtr&&) = 0; // FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them. virtual void unquit() = 0; diff --git a/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp b/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp index c5888306da0..78853c876e3 100644 --- a/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp +++ b/Userland/Libraries/LibCore/EventLoopImplementationUnix.cpp @@ -11,8 +11,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -33,7 +33,7 @@ struct EventLoopTimer { MonotonicTime fire_time { MonotonicTime::now_coarse() }; bool should_reload { false }; TimerShouldFireWhenNotVisible fire_when_not_visible { TimerShouldFireWhenNotVisible::No }; - WeakPtr owner; + WeakPtr owner; void reload(MonotonicTime const& now) { fire_time = now + interval; } bool has_expired(MonotonicTime const& now) const { return now > fire_time; } @@ -126,7 +126,7 @@ bool EventLoopImplementationUnix::was_exit_requested() const return m_exit_requested; } -void EventLoopImplementationUnix::post_event(Object& receiver, NonnullOwnPtr&& event) +void EventLoopImplementationUnix::post_event(EventReceiver& receiver, NonnullOwnPtr&& event) { m_thread_event_queue.post_event(receiver, move(event)); if (&m_thread_event_queue != &ThreadEventQueue::current()) @@ -481,7 +481,7 @@ void EventLoopManagerUnix::unregister_signal(int handler_id) info.signal_handlers.remove(remove_signal_number); } -int EventLoopManagerUnix::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) +int EventLoopManagerUnix::register_timer(EventReceiver& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible) { VERIFY(milliseconds >= 0); auto& thread_data = ThreadData::the(); diff --git a/Userland/Libraries/LibCore/EventLoopImplementationUnix.h b/Userland/Libraries/LibCore/EventLoopImplementationUnix.h index ee93cefa4e8..a59d4e6be6a 100644 --- a/Userland/Libraries/LibCore/EventLoopImplementationUnix.h +++ b/Userland/Libraries/LibCore/EventLoopImplementationUnix.h @@ -17,7 +17,7 @@ public: virtual NonnullOwnPtr make_implementation() override; - virtual int register_timer(Object&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible) override; + virtual int register_timer(EventReceiver&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible) override; virtual bool unregister_timer(int timer_id) override; virtual void register_notifier(Notifier&) override; @@ -52,7 +52,7 @@ public: virtual void unquit() override; virtual bool was_exit_requested() const override; virtual void notify_forked_and_in_child() override; - virtual void post_event(Object& receiver, NonnullOwnPtr&&) override; + virtual void post_event(EventReceiver& receiver, NonnullOwnPtr&&) override; private: bool m_exit_requested { false }; diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/EventReceiver.cpp similarity index 77% rename from Userland/Libraries/LibCore/Object.cpp rename to Userland/Libraries/LibCore/EventReceiver.cpp index 69e6e07dec0..c06f27d5d06 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/EventReceiver.cpp @@ -10,19 +10,19 @@ #include #include #include -#include +#include #include namespace Core { -Object::Object(Object* parent) +EventReceiver::EventReceiver(EventReceiver* parent) : m_parent(parent) { if (m_parent) m_parent->add_child(*this); } -Object::~Object() +EventReceiver::~EventReceiver() { // NOTE: We move our children out to a stack vector to prevent other // code from trying to iterate over them. @@ -37,7 +37,7 @@ Object::~Object() m_parent->remove_child(*this); } -void Object::event(Core::Event& event) +void EventReceiver::event(Core::Event& event) { switch (event.type()) { case Core::Event::Timer: @@ -55,7 +55,7 @@ void Object::event(Core::Event& event) } } -ErrorOr Object::try_add_child(Object& object) +ErrorOr EventReceiver::try_add_child(EventReceiver& object) { // FIXME: Should we support reparenting objects? VERIFY(!object.parent() || object.parent() == this); @@ -66,12 +66,12 @@ ErrorOr Object::try_add_child(Object& object) return {}; } -void Object::add_child(Object& object) +void EventReceiver::add_child(EventReceiver& object) { MUST(try_add_child(object)); } -void Object::insert_child_before(Object& new_child, Object& before_child) +void EventReceiver::insert_child_before(EventReceiver& new_child, EventReceiver& before_child) { // FIXME: Should we support reparenting objects? VERIFY(!new_child.parent() || new_child.parent() == this); @@ -81,12 +81,12 @@ void Object::insert_child_before(Object& new_child, Object& before_child) event(child_event); } -void Object::remove_child(Object& object) +void EventReceiver::remove_child(EventReceiver& object) { for (size_t i = 0; i < m_children.size(); ++i) { if (m_children[i] == &object) { // NOTE: We protect the child so it survives the handling of ChildRemoved. - NonnullRefPtr protector = object; + NonnullRefPtr protector = object; object.m_parent = nullptr; m_children.remove(i); Core::ChildEvent child_event(Core::Event::ChildRemoved, object); @@ -97,25 +97,25 @@ void Object::remove_child(Object& object) VERIFY_NOT_REACHED(); } -void Object::remove_all_children() +void EventReceiver::remove_all_children() { while (!m_children.is_empty()) m_children.first()->remove_from_parent(); } -void Object::timer_event(Core::TimerEvent&) +void EventReceiver::timer_event(Core::TimerEvent&) { } -void Object::child_event(Core::ChildEvent&) +void EventReceiver::child_event(Core::ChildEvent&) { } -void Object::custom_event(CustomEvent&) +void EventReceiver::custom_event(CustomEvent&) { } -void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_visible) +void EventReceiver::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_visible) { if (m_timer_id) { dbgln("{} {:p} already has a timer!", class_name(), this); @@ -125,7 +125,7 @@ void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_vis m_timer_id = Core::EventLoop::register_timer(*this, ms, true, fire_when_not_visible); } -void Object::stop_timer() +void EventReceiver::stop_timer() { if (!m_timer_id) return; @@ -136,12 +136,12 @@ void Object::stop_timer() m_timer_id = 0; } -void Object::deferred_invoke(Function invokee) +void EventReceiver::deferred_invoke(Function invokee) { Core::deferred_invoke([invokee = move(invokee), strong_this = NonnullRefPtr(*this)] { invokee(); }); } -bool Object::is_ancestor_of(Object const& other) const +bool EventReceiver::is_ancestor_of(EventReceiver const& other) const { if (&other == this) return false; @@ -152,7 +152,7 @@ bool Object::is_ancestor_of(Object const& other) const return false; } -void Object::dispatch_event(Core::Event& e, Object* stay_within) +void EventReceiver::dispatch_event(Core::Event& e, EventReceiver* stay_within) { VERIFY(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this)); auto* target = this; @@ -169,14 +169,14 @@ void Object::dispatch_event(Core::Event& e, Object* stay_within) } while (target && !e.is_accepted()); } -bool Object::is_visible_for_timer_purposes() const +bool EventReceiver::is_visible_for_timer_purposes() const { if (parent()) return parent()->is_visible_for_timer_purposes(); return true; } -void Object::set_event_filter(Function filter) +void EventReceiver::set_event_filter(Function filter) { m_event_filter = move(filter); } diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/EventReceiver.h similarity index 77% rename from Userland/Libraries/LibCore/Object.h rename to Userland/Libraries/LibCore/EventReceiver.h index 3d35eecdfba..73d1240bc38 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/EventReceiver.h @@ -49,16 +49,16 @@ public: \ return #klass##sv; \ } -class Object - : public RefCounted - , public Weakable { - // NOTE: No C_OBJECT macro for Core::Object itself. +class EventReceiver + : public RefCounted + , public Weakable { + // NOTE: No C_OBJECT macro for Core::EventReceiver itself. - AK_MAKE_NONCOPYABLE(Object); - AK_MAKE_NONMOVABLE(Object); + AK_MAKE_NONCOPYABLE(EventReceiver); + AK_MAKE_NONMOVABLE(EventReceiver); public: - virtual ~Object(); + virtual ~EventReceiver(); virtual StringView class_name() const = 0; @@ -70,8 +70,8 @@ public: DeprecatedString const& name() const { return m_name; } void set_name(DeprecatedString name) { m_name = move(name); } - Vector>& children() { return m_children; } - Vector> const& children() const { return m_children; } + Vector>& children() { return m_children; } + Vector> const& children() const { return m_children; } template void for_each_child(Callback callback) @@ -84,51 +84,51 @@ public: template void for_each_child_of_type(Callback callback) - requires IsBaseOf; + requires IsBaseOf; template T* find_child_of_type_named(StringView) - requires IsBaseOf; + requires IsBaseOf; template ALWAYS_INLINE T* find_child_of_type_named(char const (&string_literal)[N]) - requires IsBaseOf + requires IsBaseOf { return find_child_of_type_named(StringView { string_literal, N - 1 }); } template T* find_descendant_of_type_named(StringView) - requires IsBaseOf; + requires IsBaseOf; template ALWAYS_INLINE T* find_descendant_of_type_named(char const (&string_literal)[N]) - requires IsBaseOf + requires IsBaseOf { return find_descendant_of_type_named(StringView { string_literal, N - 1 }); } - bool is_ancestor_of(Object const&) const; + bool is_ancestor_of(EventReceiver const&) const; - Object* parent() { return m_parent; } - Object const* parent() const { return m_parent; } + EventReceiver* parent() { return m_parent; } + EventReceiver const* parent() const { return m_parent; } void start_timer(int ms, TimerShouldFireWhenNotVisible = TimerShouldFireWhenNotVisible::No); void stop_timer(); bool has_timer() const { return m_timer_id; } - ErrorOr try_add_child(Object&); + ErrorOr try_add_child(EventReceiver&); - void add_child(Object&); - void insert_child_before(Object& new_child, Object& before_child); - void remove_child(Object&); + void add_child(EventReceiver&); + void insert_child_before(EventReceiver& new_child, EventReceiver& before_child); + void remove_child(EventReceiver&); void remove_all_children(); void set_event_filter(Function); void deferred_invoke(Function); - void dispatch_event(Core::Event&, Object* stay_within = nullptr); + void dispatch_event(Core::Event&, EventReceiver* stay_within = nullptr); void remove_from_parent() { @@ -155,7 +155,7 @@ public: virtual bool is_visible_for_timer_purposes() const; protected: - explicit Object(Object* parent = nullptr); + explicit EventReceiver(EventReceiver* parent = nullptr); virtual void event(Core::Event&); @@ -166,18 +166,18 @@ protected: virtual void child_event(ChildEvent&); private: - Object* m_parent { nullptr }; + EventReceiver* m_parent { nullptr }; DeprecatedString m_name; int m_timer_id { 0 }; - Vector> m_children; + Vector> m_children; Function m_event_filter; }; } template<> -struct AK::Formatter : AK::Formatter { - ErrorOr format(FormatBuilder& builder, Core::Object const& value) +struct AK::Formatter : AK::Formatter { + ErrorOr format(FormatBuilder& builder, Core::EventReceiver const& value) { return AK::Formatter::format(builder, "{}({})"sv, value.class_name(), &value); } @@ -185,8 +185,8 @@ struct AK::Formatter : AK::Formatter { namespace Core { template -inline void Object::for_each_child_of_type(Callback callback) -requires IsBaseOf +inline void EventReceiver::for_each_child_of_type(Callback callback) +requires IsBaseOf { for_each_child([&](auto& child) { if (is(child)) @@ -196,8 +196,8 @@ requires IsBaseOf } template -T* Object::find_child_of_type_named(StringView name) -requires IsBaseOf +T* EventReceiver::find_child_of_type_named(StringView name) +requires IsBaseOf { T* found_child = nullptr; for_each_child_of_type([&](auto& child) { @@ -212,8 +212,8 @@ requires IsBaseOf } template -T* Object::find_descendant_of_type_named(StringView name) -requires IsBaseOf +T* EventReceiver::find_descendant_of_type_named(StringView name) +requires IsBaseOf { if (is(*this) && this->name() == name) { return static_cast(this); diff --git a/Userland/Libraries/LibCore/Forward.h b/Userland/Libraries/LibCore/Forward.h index f7c36ebd04e..acaa93f9509 100644 --- a/Userland/Libraries/LibCore/Forward.h +++ b/Userland/Libraries/LibCore/Forward.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2023, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -22,6 +22,7 @@ class DeferredInvocationContext; class ElapsedTimer; class Event; class EventLoop; +class EventReceiver; class File; class LocalServer; class LocalSocket; @@ -30,8 +31,6 @@ class MimeData; class NetworkJob; class NetworkResponse; class Notifier; -class Object; -class ObjectClassRegistration; class ProcessStatisticsReader; class Socket; template diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 49f78c37fa6..9e8caee223a 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -22,8 +22,8 @@ namespace Core { -LocalServer::LocalServer(Object* parent) - : Object(parent) +LocalServer::LocalServer(EventReceiver* parent) + : EventReceiver(parent) { } diff --git a/Userland/Libraries/LibCore/LocalServer.h b/Userland/Libraries/LibCore/LocalServer.h index 71b66fc44c4..d2a9e8b4862 100644 --- a/Userland/Libraries/LibCore/LocalServer.h +++ b/Userland/Libraries/LibCore/LocalServer.h @@ -6,12 +6,12 @@ #pragma once +#include #include -#include namespace Core { -class LocalServer : public Object { +class LocalServer : public EventReceiver { C_OBJECT(LocalServer) public: virtual ~LocalServer() override; @@ -26,7 +26,7 @@ public: Function on_accept_error; private: - explicit LocalServer(Object* parent = nullptr); + explicit LocalServer(EventReceiver* parent = nullptr); void setup_notifier(); diff --git a/Userland/Libraries/LibCore/MimeData.h b/Userland/Libraries/LibCore/MimeData.h index ca09778600e..9be89de64f3 100644 --- a/Userland/Libraries/LibCore/MimeData.h +++ b/Userland/Libraries/LibCore/MimeData.h @@ -10,11 +10,11 @@ #include #include #include -#include +#include namespace Core { -class MimeData : public Object { +class MimeData : public EventReceiver { C_OBJECT(MimeData); public: diff --git a/Userland/Libraries/LibCore/NetworkJob.h b/Userland/Libraries/LibCore/NetworkJob.h index cdf66cc04d1..3e790a098e4 100644 --- a/Userland/Libraries/LibCore/NetworkJob.h +++ b/Userland/Libraries/LibCore/NetworkJob.h @@ -9,12 +9,12 @@ #include #include +#include #include -#include namespace Core { -class NetworkJob : public Object { +class NetworkJob : public EventReceiver { C_OBJECT_ABSTRACT(NetworkJob) public: enum class Error { @@ -70,5 +70,5 @@ char const* to_string(NetworkJob::Error); } template<> -struct AK::Formatter : Formatter { +struct AK::Formatter : Formatter { }; diff --git a/Userland/Libraries/LibCore/Notifier.cpp b/Userland/Libraries/LibCore/Notifier.cpp index 04e620f1bed..064799bcb5f 100644 --- a/Userland/Libraries/LibCore/Notifier.cpp +++ b/Userland/Libraries/LibCore/Notifier.cpp @@ -10,8 +10,8 @@ namespace Core { -Notifier::Notifier(int fd, Type type, Object* parent) - : Object(parent) +Notifier::Notifier(int fd, Type type, EventReceiver* parent) + : EventReceiver(parent) , m_fd(fd) , m_type(type) { @@ -48,7 +48,7 @@ void Notifier::event(Core::Event& event) on_activation(); return; } - Object::event(event); + EventReceiver::event(event); } } diff --git a/Userland/Libraries/LibCore/Notifier.h b/Userland/Libraries/LibCore/Notifier.h index 1815ad0b2ca..a3fa27ebdb6 100644 --- a/Userland/Libraries/LibCore/Notifier.h +++ b/Userland/Libraries/LibCore/Notifier.h @@ -7,11 +7,11 @@ #pragma once #include -#include +#include namespace Core { -class Notifier final : public Object { +class Notifier final : public EventReceiver { C_OBJECT(Notifier); public: @@ -37,7 +37,7 @@ public: void event(Core::Event&) override; private: - Notifier(int fd, Type type, Object* parent = nullptr); + Notifier(int fd, Type type, EventReceiver* parent = nullptr); int m_fd { -1 }; Type m_type { Type::None }; diff --git a/Userland/Libraries/LibCore/Promise.h b/Userland/Libraries/LibCore/Promise.h index 6ab563cd6cf..a8595e00050 100644 --- a/Userland/Libraries/LibCore/Promise.h +++ b/Userland/Libraries/LibCore/Promise.h @@ -10,12 +10,12 @@ #include #include -#include +#include namespace Core { template -class Promise : public Object { +class Promise : public EventReceiver { C_OBJECT(Promise); public: @@ -116,8 +116,8 @@ private: } Promise() = default; - Promise(Object* parent) - : Object(parent) + Promise(EventReceiver* parent) + : EventReceiver(parent) { } diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp index 0a5a42963e6..421dcb68972 100644 --- a/Userland/Libraries/LibCore/TCPServer.cpp +++ b/Userland/Libraries/LibCore/TCPServer.cpp @@ -14,7 +14,7 @@ namespace Core { -ErrorOr> TCPServer::try_create(Object* parent) +ErrorOr> TCPServer::try_create(EventReceiver* parent) { #ifdef SOCK_NONBLOCK int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)); @@ -28,8 +28,8 @@ ErrorOr> TCPServer::try_create(Object* parent) return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd, parent)); } -TCPServer::TCPServer(int fd, Object* parent) - : Object(parent) +TCPServer::TCPServer(int fd, EventReceiver* parent) + : EventReceiver(parent) , m_fd(fd) { VERIFY(m_fd >= 0); diff --git a/Userland/Libraries/LibCore/TCPServer.h b/Userland/Libraries/LibCore/TCPServer.h index 18de744c5ff..7a7c2d4550d 100644 --- a/Userland/Libraries/LibCore/TCPServer.h +++ b/Userland/Libraries/LibCore/TCPServer.h @@ -8,15 +8,15 @@ #pragma once #include +#include #include -#include namespace Core { -class TCPServer : public Object { +class TCPServer : public EventReceiver { C_OBJECT_ABSTRACT(TCPServer) public: - static ErrorOr> try_create(Object* parent = nullptr); + static ErrorOr> try_create(EventReceiver* parent = nullptr); virtual ~TCPServer() override; enum class AllowAddressReuse { @@ -36,7 +36,7 @@ public: Function on_ready_to_accept; private: - explicit TCPServer(int fd, Object* parent = nullptr); + explicit TCPServer(int fd, EventReceiver* parent = nullptr); int m_fd { -1 }; bool m_listening { false }; diff --git a/Userland/Libraries/LibCore/ThreadEventQueue.cpp b/Userland/Libraries/LibCore/ThreadEventQueue.cpp index 0aec61c1518..a6fbe30dccc 100644 --- a/Userland/Libraries/LibCore/ThreadEventQueue.cpp +++ b/Userland/Libraries/LibCore/ThreadEventQueue.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -21,7 +21,7 @@ struct ThreadEventQueue::Private { AK_MAKE_DEFAULT_MOVABLE(QueuedEvent); public: - QueuedEvent(Object& receiver, NonnullOwnPtr event) + QueuedEvent(EventReceiver& receiver, NonnullOwnPtr event) : receiver(receiver) , event(move(event)) { @@ -29,13 +29,13 @@ struct ThreadEventQueue::Private { ~QueuedEvent() = default; - WeakPtr receiver; + WeakPtr receiver; NonnullOwnPtr event; }; Threading::Mutex mutex; Vector queued_events; - Vector>>, 16> pending_promises; + Vector>>, 16> pending_promises; bool warned_promise_count { false }; }; @@ -57,7 +57,7 @@ ThreadEventQueue::ThreadEventQueue() ThreadEventQueue::~ThreadEventQueue() = default; -void ThreadEventQueue::post_event(Core::Object& receiver, NonnullOwnPtr event) +void ThreadEventQueue::post_event(Core::EventReceiver& receiver, NonnullOwnPtr event) { { Threading::MutexLocker lock(m_private->mutex); @@ -66,7 +66,7 @@ void ThreadEventQueue::post_event(Core::Object& receiver, NonnullOwnPtr>> promise) +void ThreadEventQueue::add_job(NonnullRefPtr>> promise) { Threading::MutexLocker lock(m_private->mutex); m_private->pending_promises.append(move(promise)); @@ -107,7 +107,7 @@ size_t ThreadEventQueue::process() } else if (event.type() == Event::Type::DeferredInvoke) { static_cast(event).m_invokee(); } else { - NonnullRefPtr protector(*receiver); + NonnullRefPtr protector(*receiver); receiver->dispatch_event(event); } ++processed_events; diff --git a/Userland/Libraries/LibCore/ThreadEventQueue.h b/Userland/Libraries/LibCore/ThreadEventQueue.h index 76af48da226..12534ed5dcf 100644 --- a/Userland/Libraries/LibCore/ThreadEventQueue.h +++ b/Userland/Libraries/LibCore/ThreadEventQueue.h @@ -25,10 +25,10 @@ public: size_t process(); // Posts an event to the event queue. - void post_event(Object& receiver, NonnullOwnPtr); + void post_event(EventReceiver& receiver, NonnullOwnPtr); // Used by Threading::BackgroundAction. - void add_job(NonnullRefPtr>>); + void add_job(NonnullRefPtr>>); void cancel_all_pending_jobs(); // Returns true if there are events waiting to be flushed. diff --git a/Userland/Libraries/LibCore/ThreadedPromise.h b/Userland/Libraries/LibCore/ThreadedPromise.h index fe2dc2a26f4..50a539b92bc 100644 --- a/Userland/Libraries/LibCore/ThreadedPromise.h +++ b/Userland/Libraries/LibCore/ThreadedPromise.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include namespace Core { @@ -179,8 +179,8 @@ private: } ThreadedPromise() = default; - ThreadedPromise(Object* parent) - : Object(parent) + ThreadedPromise(EventReceiver* parent) + : EventReceiver(parent) { } diff --git a/Userland/Libraries/LibCore/Timer.cpp b/Userland/Libraries/LibCore/Timer.cpp index 2099eee9af7..15ed7dba538 100644 --- a/Userland/Libraries/LibCore/Timer.cpp +++ b/Userland/Libraries/LibCore/Timer.cpp @@ -9,13 +9,13 @@ namespace Core { -Timer::Timer(Object* parent) - : Object(parent) +Timer::Timer(EventReceiver* parent) + : EventReceiver(parent) { } -Timer::Timer(int interval_ms, Function&& timeout_handler, Object* parent) - : Object(parent) +Timer::Timer(int interval_ms, Function&& timeout_handler, EventReceiver* parent) + : EventReceiver(parent) , on_timeout(move(timeout_handler)) , m_interval_ms(interval_ms) { diff --git a/Userland/Libraries/LibCore/Timer.h b/Userland/Libraries/LibCore/Timer.h index 63c3c06d7c1..af3263d31e8 100644 --- a/Userland/Libraries/LibCore/Timer.h +++ b/Userland/Libraries/LibCore/Timer.h @@ -8,19 +8,19 @@ #pragma once #include -#include +#include namespace Core { -class Timer final : public Object { +class Timer final : public EventReceiver { C_OBJECT(Timer); public: - static ErrorOr> create_repeating(int interval_ms, Function&& timeout_handler, Object* parent = nullptr) + static ErrorOr> create_repeating(int interval_ms, Function&& timeout_handler, EventReceiver* parent = nullptr) { return adopt_nonnull_ref_or_enomem(new Timer(interval_ms, move(timeout_handler), parent)); } - static ErrorOr> create_single_shot(int interval_ms, Function&& timeout_handler, Object* parent = nullptr) + static ErrorOr> create_single_shot(int interval_ms, Function&& timeout_handler, EventReceiver* parent = nullptr) { auto timer = TRY(adopt_nonnull_ref_or_enomem(new Timer(interval_ms, move(timeout_handler), parent))); timer->set_single_shot(true); @@ -53,8 +53,8 @@ public: Function on_timeout; private: - explicit Timer(Object* parent = nullptr); - Timer(int interval_ms, Function&& timeout_handler, Object* parent = nullptr); + explicit Timer(EventReceiver* parent = nullptr); + Timer(int interval_ms, Function&& timeout_handler, EventReceiver* parent = nullptr); virtual void timer_event(TimerEvent&) override; diff --git a/Userland/Libraries/LibCore/UDPServer.cpp b/Userland/Libraries/LibCore/UDPServer.cpp index 70249b623a4..239c17a304a 100644 --- a/Userland/Libraries/LibCore/UDPServer.cpp +++ b/Userland/Libraries/LibCore/UDPServer.cpp @@ -21,8 +21,8 @@ namespace Core { -UDPServer::UDPServer(Object* parent) - : Object(parent) +UDPServer::UDPServer(EventReceiver* parent) + : EventReceiver(parent) { #ifdef SOCK_NONBLOCK m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); diff --git a/Userland/Libraries/LibCore/UDPServer.h b/Userland/Libraries/LibCore/UDPServer.h index f94f33a0a6f..a00460ceee6 100644 --- a/Userland/Libraries/LibCore/UDPServer.h +++ b/Userland/Libraries/LibCore/UDPServer.h @@ -10,13 +10,13 @@ #include #include #include +#include #include -#include #include namespace Core { -class UDPServer : public Object { +class UDPServer : public EventReceiver { C_OBJECT(UDPServer) public: virtual ~UDPServer() override; @@ -41,7 +41,7 @@ public: Function on_ready_to_receive; protected: - explicit UDPServer(Object* parent = nullptr); + explicit UDPServer(EventReceiver* parent = nullptr); private: int m_fd { -1 }; diff --git a/Userland/Libraries/LibGUI/AbstractTableView.cpp b/Userland/Libraries/LibGUI/AbstractTableView.cpp index ffa8c6223ef..180295c1b53 100644 --- a/Userland/Libraries/LibGUI/AbstractTableView.cpp +++ b/Userland/Libraries/LibGUI/AbstractTableView.cpp @@ -6,7 +6,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index 4bc0fb21408..1d7666ef76e 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibGUI/Action.cpp b/Userland/Libraries/LibGUI/Action.cpp index ba818e4e825..0a3b17de202 100644 --- a/Userland/Libraries/LibGUI/Action.cpp +++ b/Userland/Libraries/LibGUI/Action.cpp @@ -15,62 +15,62 @@ namespace GUI { -NonnullRefPtr Action::create(DeprecatedString text, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), move(callback), parent)); } -NonnullRefPtr Action::create(DeprecatedString text, RefPtr icon, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, RefPtr icon, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), move(icon), move(callback), parent)); } -NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, move(callback), parent)); } -NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(callback), parent)); } -NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent)); } -NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function callback, Core::Object* parent) +NonnullRefPtr Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(icon), move(callback), parent)); } -NonnullRefPtr Action::create_checkable(DeprecatedString text, Function callback, Core::Object* parent) +NonnullRefPtr Action::create_checkable(DeprecatedString text, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), move(callback), parent, true)); } -NonnullRefPtr Action::create_checkable(DeprecatedString text, RefPtr icon, Function callback, Core::Object* parent) +NonnullRefPtr Action::create_checkable(DeprecatedString text, RefPtr icon, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true)); } -NonnullRefPtr Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent) +NonnullRefPtr Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true)); } -NonnullRefPtr Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::Object* parent) +NonnullRefPtr Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent) { return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent, true)); } -ErrorOr> Action::try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent) +ErrorOr> Action::try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent) { return adopt_nonnull_ref_or_enomem(new (nothrow) Action(move(text), shortcut, Shortcut {}, move(callback), parent, true)); } -RefPtr Action::find_action_for_shortcut(Core::Object& object, Shortcut const& shortcut) +RefPtr Action::find_action_for_shortcut(Core::EventReceiver& object, Shortcut const& shortcut) { RefPtr found_action = nullptr; object.for_each_child_of_type([&](auto& action) { @@ -83,28 +83,28 @@ RefPtr Action::find_action_for_shortcut(Core::Object& object, Shortcut c return found_action; } -Action::Action(DeprecatedString text, Function on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(DeprecatedString text, Function on_activation_callback, Core::EventReceiver* parent, bool checkable) : Action(move(text), Shortcut {}, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable) { } -Action::Action(DeprecatedString text, RefPtr icon, Function on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(DeprecatedString text, RefPtr icon, Function on_activation_callback, Core::EventReceiver* parent, bool checkable) : Action(move(text), Shortcut {}, Shortcut {}, move(icon), move(on_activation_callback), parent, checkable) { } -Action::Action(DeprecatedString text, Shortcut const& shortcut, Function on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(DeprecatedString text, Shortcut const& shortcut, Function on_activation_callback, Core::EventReceiver* parent, bool checkable) : Action(move(text), shortcut, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable) { } -Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function on_activation_callback, Core::Object* parent, bool checkable) +Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function on_activation_callback, Core::EventReceiver* parent, bool checkable) : Action(move(text), shortcut, alternate_shortcut, nullptr, move(on_activation_callback), parent, checkable) { } -Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function on_activation_callback, Core::Object* parent, bool checkable) - : Core::Object(parent) +Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function on_activation_callback, Core::EventReceiver* parent, bool checkable) + : Core::EventReceiver(parent) , on_activation(move(on_activation_callback)) , m_text(move(text)) , m_icon(move(icon)) @@ -148,7 +148,7 @@ void Action::process_event(Window& window, Event& event) event.ignore(); } -void Action::activate(Core::Object* activator) +void Action::activate(Core::EventReceiver* activator) { if (is_activating()) return; diff --git a/Userland/Libraries/LibGUI/Action.h b/Userland/Libraries/LibGUI/Action.h index e1a322b2d6f..f29020024d4 100644 --- a/Userland/Libraries/LibGUI/Action.h +++ b/Userland/Libraries/LibGUI/Action.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -25,39 +25,39 @@ namespace GUI { namespace CommonActions { NonnullRefPtr make_about_action(DeprecatedString const& app_name, Icon const& app_icon, Window* parent = nullptr); -NonnullRefPtr make_open_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_save_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_save_as_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_undo_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_redo_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_cut_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_copy_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_paste_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_delete_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_move_to_front_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_move_to_back_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_insert_emoji_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_fullscreen_action(Function, Core::Object* parent = nullptr); +NonnullRefPtr make_open_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_save_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_save_as_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_undo_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_redo_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_cut_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_copy_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_paste_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_delete_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_move_to_front_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_move_to_back_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_insert_emoji_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_fullscreen_action(Function, Core::EventReceiver* parent = nullptr); NonnullRefPtr make_quit_action(Function); -NonnullRefPtr make_help_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_go_back_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_go_forward_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_go_home_action(Function callback, Core::Object* parent = nullptr); -NonnullRefPtr make_close_tab_action(Function callback, Core::Object* parent = nullptr); -NonnullRefPtr make_reload_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_select_all_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_rename_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_properties_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_zoom_in_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_zoom_out_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_reset_zoom_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_rotate_clockwise_action(Function, Core::Object* parent = nullptr); -NonnullRefPtr make_rotate_counterclockwise_action(Function, Core::Object* parent = nullptr); +NonnullRefPtr make_help_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_go_back_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_go_forward_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_go_home_action(Function callback, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_close_tab_action(Function callback, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_reload_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_select_all_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_rename_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_properties_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_zoom_in_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_zoom_out_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_reset_zoom_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_rotate_clockwise_action(Function, Core::EventReceiver* parent = nullptr); +NonnullRefPtr make_rotate_counterclockwise_action(Function, Core::EventReceiver* parent = nullptr); NonnullRefPtr make_command_palette_action(Window* window = nullptr); }; -class Action final : public Core::Object { +class Action final : public Core::EventReceiver { C_OBJECT(Action) public: enum class ShortcutScope { @@ -66,20 +66,20 @@ public: WindowLocal, ApplicationGlobal, }; - static NonnullRefPtr create(DeprecatedString text, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create(DeprecatedString text, RefPtr icon, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create_checkable(DeprecatedString text, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create_checkable(DeprecatedString text, RefPtr icon, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent = nullptr); - static NonnullRefPtr create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::Object* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, RefPtr icon, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create_checkable(DeprecatedString text, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create_checkable(DeprecatedString text, RefPtr icon, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent = nullptr); + static NonnullRefPtr create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr icon, Function callback, Core::EventReceiver* parent = nullptr); - static ErrorOr> try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::Object* parent = nullptr); + static ErrorOr> try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function callback, Core::EventReceiver* parent = nullptr); - static RefPtr find_action_for_shortcut(Core::Object& object, Shortcut const& shortcut); + static RefPtr find_action_for_shortcut(Core::EventReceiver& object, Shortcut const& shortcut); virtual ~Action() override; @@ -97,12 +97,12 @@ public: Gfx::Bitmap const* icon() const { return m_icon.ptr(); } void set_icon(Gfx::Bitmap const*); - Core::Object const* activator() const { return m_activator.ptr(); } - Core::Object* activator() { return m_activator.ptr(); } + Core::EventReceiver const* activator() const { return m_activator.ptr(); } + Core::EventReceiver* activator() { return m_activator.ptr(); } Function on_activation; - void activate(Core::Object* activator = nullptr); + void activate(Core::EventReceiver* activator = nullptr); void process_event(Window& window, Event& event); void flash_menubar_menu(GUI::Window& window); @@ -138,11 +138,11 @@ public: HashTable const& menu_items() const { return m_menu_items; } private: - Action(DeprecatedString, Function = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(DeprecatedString, Shortcut const&, Function = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(DeprecatedString, Shortcut const&, Shortcut const&, Function = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(DeprecatedString, Shortcut const&, Shortcut const&, RefPtr icon, Function = nullptr, Core::Object* = nullptr, bool checkable = false); - Action(DeprecatedString, RefPtr icon, Function = nullptr, Core::Object* = nullptr, bool checkable = false); + Action(DeprecatedString, Function = nullptr, Core::EventReceiver* = nullptr, bool checkable = false); + Action(DeprecatedString, Shortcut const&, Function = nullptr, Core::EventReceiver* = nullptr, bool checkable = false); + Action(DeprecatedString, Shortcut const&, Shortcut const&, Function = nullptr, Core::EventReceiver* = nullptr, bool checkable = false); + Action(DeprecatedString, Shortcut const&, Shortcut const&, RefPtr icon, Function = nullptr, Core::EventReceiver* = nullptr, bool checkable = false); + Action(DeprecatedString, RefPtr icon, Function = nullptr, Core::EventReceiver* = nullptr, bool checkable = false); template void for_each_toolbar_button(Callback); @@ -166,7 +166,7 @@ private: HashTable m_buttons; HashTable m_menu_items; WeakPtr m_action_group; - WeakPtr m_activator; + WeakPtr m_activator; }; } diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index de4833096ed..8a19a13e214 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -328,7 +328,7 @@ void Application::event(Core::Event& event) if (on_theme_change) on_theme_change(); } - Object::event(event); + EventReceiver::event(event); } void Application::set_config_domain(String config_domain) diff --git a/Userland/Libraries/LibGUI/Application.h b/Userland/Libraries/LibGUI/Application.h index e67ab40b86e..2bf5b40ae64 100644 --- a/Userland/Libraries/LibGUI/Application.h +++ b/Userland/Libraries/LibGUI/Application.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -21,7 +21,7 @@ namespace GUI { -class Application : public Core::Object { +class Application : public Core::EventReceiver { C_OBJECT_ABSTRACT(Application); public: diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index f1902f1552c..137d341c56f 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -231,7 +231,7 @@ void CommandPalette::collect_actions(GUI::Window& parent_window) { OrderedHashTable> actions; - auto collect_action_children = [&](Core::Object& action_parent) { + auto collect_action_children = [&](Core::EventReceiver& action_parent) { action_parent.for_each_child_of_type([&](GUI::Action& action) { if (action.is_enabled() && action.is_visible()) actions.set(action); diff --git a/Userland/Libraries/LibGUI/CommonActions.cpp b/Userland/Libraries/LibGUI/CommonActions.cpp index b2f52883c1b..48030b2eaf9 100644 --- a/Userland/Libraries/LibGUI/CommonActions.cpp +++ b/Userland/Libraries/LibGUI/CommonActions.cpp @@ -32,85 +32,85 @@ NonnullRefPtr make_about_action(DeprecatedString const& app_name, Icon c return action; } -NonnullRefPtr make_open_action(Function callback, Core::Object* parent) +NonnullRefPtr make_open_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Open an existing file"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_save_action(Function callback, Core::Object* parent) +NonnullRefPtr make_save_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Save the current file"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_save_as_action(Function callback, Core::Object* parent) +NonnullRefPtr make_save_as_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Save the current file with a new name"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_move_to_front_action(Function callback, Core::Object* parent) +NonnullRefPtr make_move_to_front_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Move to the top of the stack"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_move_to_back_action(Function callback, Core::Object* parent) +NonnullRefPtr make_move_to_back_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Move to the bottom of the stack"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_undo_action(Function callback, Core::Object* parent) +NonnullRefPtr make_undo_action(Function callback, Core::EventReceiver* parent) { return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_redo_action(Function callback, Core::Object* parent) +NonnullRefPtr make_redo_action(Function callback, Core::EventReceiver* parent) { return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_delete_action(Function callback, Core::Object* parent) +NonnullRefPtr make_delete_action(Function callback, Core::EventReceiver* parent) { return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_cut_action(Function callback, Core::Object* parent) +NonnullRefPtr make_cut_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Cut to clipboard"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_copy_action(Function callback, Core::Object* parent) +NonnullRefPtr make_copy_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Copy to clipboard"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_paste_action(Function callback, Core::Object* parent) +NonnullRefPtr make_paste_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Paste from clipboard"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_insert_emoji_action(Function callback, Core::Object* parent) +NonnullRefPtr make_insert_emoji_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Open the Emoji Picker"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_fullscreen_action(Function callback, Core::Object* parent) +NonnullRefPtr make_fullscreen_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent); action->set_status_tip("Enter fullscreen mode"_string.release_value_but_fixme_should_propagate_errors()); @@ -125,80 +125,80 @@ NonnullRefPtr make_quit_action(Function callback) return action; } -NonnullRefPtr make_help_action(Function callback, Core::Object* parent) +NonnullRefPtr make_help_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Show help contents"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_go_back_action(Function callback, Core::Object* parent) +NonnullRefPtr make_go_back_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Move one step backward in history"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_go_forward_action(Function callback, Core::Object* parent) +NonnullRefPtr make_go_forward_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Move one step forward in history"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_go_home_action(Function callback, Core::Object* parent) +NonnullRefPtr make_go_home_action(Function callback, Core::EventReceiver* parent) { return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_close_tab_action(Function callback, Core::Object* parent) +NonnullRefPtr make_close_tab_action(Function callback, Core::EventReceiver* parent) { auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); action->set_status_tip("Close current tab"_string.release_value_but_fixme_should_propagate_errors()); return action; } -NonnullRefPtr make_reload_action(Function callback, Core::Object* parent) +NonnullRefPtr make_reload_action(Function callback, Core::EventReceiver* parent) { return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_select_all_action(Function callback, Core::Object* parent) +NonnullRefPtr make_select_all_action(Function callback, Core::EventReceiver* parent) { return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_rename_action(Function callback, Core::Object* parent) +NonnullRefPtr make_rename_action(Function callback, Core::EventReceiver* parent) { return Action::create("Re&name...", Key_F2, Gfx::Bitmap::load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_properties_action(Function callback, Core::Object* parent) +NonnullRefPtr make_properties_action(Function callback, Core::EventReceiver* parent) { return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_zoom_in_action(Function callback, Core::Object* parent) +NonnullRefPtr make_zoom_in_action(Function callback, Core::EventReceiver* parent) { return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_reset_zoom_action(Function callback, Core::Object* parent) +NonnullRefPtr make_reset_zoom_action(Function callback, Core::EventReceiver* parent) { return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_zoom_out_action(Function callback, Core::Object* parent) +NonnullRefPtr make_zoom_out_action(Function callback, Core::EventReceiver* parent) { return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_rotate_clockwise_action(Function callback, Core::Object* parent) +NonnullRefPtr make_rotate_clockwise_action(Function callback, Core::EventReceiver* parent) { return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } -NonnullRefPtr make_rotate_counterclockwise_action(Function callback, Core::Object* parent) +NonnullRefPtr make_rotate_counterclockwise_action(Function callback, Core::EventReceiver* parent) { return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent); } diff --git a/Userland/Libraries/LibGUI/Dialog.h b/Userland/Libraries/LibGUI/Dialog.h index 396498ceea8..b4a1cd01e3e 100644 --- a/Userland/Libraries/LibGUI/Dialog.h +++ b/Userland/Libraries/LibGUI/Dialog.h @@ -57,5 +57,5 @@ private: } template<> -struct AK::Formatter : Formatter { +struct AK::Formatter : Formatter { }; diff --git a/Userland/Libraries/LibGUI/DragOperation.cpp b/Userland/Libraries/LibGUI/DragOperation.cpp index 5f1c28b8adb..04322dc6f7d 100644 --- a/Userland/Libraries/LibGUI/DragOperation.cpp +++ b/Userland/Libraries/LibGUI/DragOperation.cpp @@ -16,8 +16,8 @@ namespace GUI { static DragOperation* s_current_drag_operation; -DragOperation::DragOperation(Core::Object* parent) - : Core::Object(parent) +DragOperation::DragOperation(Core::EventReceiver* parent) + : Core::EventReceiver(parent) { } diff --git a/Userland/Libraries/LibGUI/DragOperation.h b/Userland/Libraries/LibGUI/DragOperation.h index 78059eb8c15..d3eac406f0a 100644 --- a/Userland/Libraries/LibGUI/DragOperation.h +++ b/Userland/Libraries/LibGUI/DragOperation.h @@ -8,14 +8,14 @@ #pragma once #include +#include #include -#include #include #include namespace GUI { -class DragOperation : public Core::Object { +class DragOperation : public Core::EventReceiver { C_OBJECT(DragOperation) public: enum class Outcome { @@ -38,7 +38,7 @@ public: static void notify_cancelled(Badge); protected: - explicit DragOperation(Core::Object* parent = nullptr); + explicit DragOperation(Core::EventReceiver* parent = nullptr); private: void done(Outcome); diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h index 9ac12e3dd8c..43fd94fe0ed 100644 --- a/Userland/Libraries/LibGUI/Menu.h +++ b/Userland/Libraries/LibGUI/Menu.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -23,7 +23,7 @@ ErrorOr> make_accessibility_menu(GUI::ColorFilterer&); }; -class Menu final : public Core::Object { +class Menu final : public Core::EventReceiver { C_OBJECT(Menu) public: virtual ~Menu() override; diff --git a/Userland/Libraries/LibGUI/Menubar.h b/Userland/Libraries/LibGUI/Menubar.h index cd1baddf43a..14c3abe376b 100644 --- a/Userland/Libraries/LibGUI/Menubar.h +++ b/Userland/Libraries/LibGUI/Menubar.h @@ -10,13 +10,13 @@ #include #include -#include +#include #include #include namespace GUI { -class Menubar : public Core::Object { +class Menubar : public Core::EventReceiver { C_OBJECT(Menubar); public: diff --git a/Userland/Libraries/LibGUI/Notification.h b/Userland/Libraries/LibGUI/Notification.h index b5f200c9cb7..7a4821a86c0 100644 --- a/Userland/Libraries/LibGUI/Notification.h +++ b/Userland/Libraries/LibGUI/Notification.h @@ -6,14 +6,14 @@ #pragma once -#include +#include #include namespace GUI { class ConnectionToNotificationServer; -class Notification : public Core::Object { +class Notification : public Core::EventReceiver { C_OBJECT(Notification); friend class ConnectionToNotificationServer; diff --git a/Userland/Libraries/LibGUI/Object.cpp b/Userland/Libraries/LibGUI/Object.cpp index 29af94ad359..acd51ccc8da 100644 --- a/Userland/Libraries/LibGUI/Object.cpp +++ b/Userland/Libraries/LibGUI/Object.cpp @@ -8,8 +8,8 @@ namespace GUI { -Object::Object(Core::Object* parent) - : Core::Object(parent) +Object::Object(Core::EventReceiver* parent) + : Core::EventReceiver(parent) { } diff --git a/Userland/Libraries/LibGUI/Object.h b/Userland/Libraries/LibGUI/Object.h index 3c8c81a2d56..6bdaff9de5e 100644 --- a/Userland/Libraries/LibGUI/Object.h +++ b/Userland/Libraries/LibGUI/Object.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -44,7 +44,7 @@ private: ObjectClassRegistration* m_parent_class { nullptr }; }; -class Object : public Core::Object { +class Object : public Core::EventReceiver { C_OBJECT_ABSTRACT(Object); public: @@ -55,7 +55,7 @@ public: HashMap> const& properties() const { return m_properties; } protected: - explicit Object(Core::Object* parent = nullptr); + explicit Object(Core::EventReceiver* parent = nullptr); void register_property(DeprecatedString const& name, Function getter, Function setter = nullptr); diff --git a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp index 27f8770dcca..4cc35681f64 100644 --- a/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp +++ b/Userland/Libraries/LibGUI/ScrollableContainerWidget.cpp @@ -129,7 +129,7 @@ ErrorOr ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr(*content_widget_value); auto class_name = content_widget.name(); - RefPtr child; + RefPtr child; if (auto* registration = GUI::ObjectClassRegistration::find(class_name)) { child = TRY(registration->construct()); } else { diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index 3e2b2746d64..b9898f5c596 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.h b/Userland/Libraries/LibGUI/VimEditingEngine.h index de8ec01903c..84bfa848456 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.h +++ b/Userland/Libraries/LibGUI/VimEditingEngine.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 4cf92795b53..45d363beb41 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -249,7 +249,7 @@ void Widget::child_event(Core::ChildEvent& event) } update(); } - return Core::Object::child_event(event); + return Core::EventReceiver::child_event(event); } void Widget::set_relative_rect(Gfx::IntRect const& a_rect) @@ -347,7 +347,7 @@ void Widget::event(Core::Event& event) case Event::AppletAreaRectChange: return applet_area_rect_change_event(static_cast(event)); default: - return Core::Object::event(event); + return Core::EventReceiver::event(event); } } @@ -1134,7 +1134,7 @@ void Widget::set_override_cursor(AK::Variant Widget::load_from_gml(StringView gml_string) { - return load_from_gml(gml_string, [](DeprecatedString const& class_name) -> ErrorOr> { + return load_from_gml(gml_string, [](DeprecatedString const& class_name) -> ErrorOr> { dbgln("Class '{}' not registered", class_name); return Error::from_string_literal("Class not registered"); }); @@ -1195,7 +1195,7 @@ ErrorOr Widget::load_from_gml_ast(NonnullRefPtr ast, } this->layout()->add_spacer(); } else { - RefPtr child; + RefPtr child; if (auto* registration = GUI::ObjectClassRegistration::find(class_name)) { child = TRY(registration->construct()); if (!registration->is_derived_from(widget_class)) { diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index b51cc80a814..aeb842994dd 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -350,7 +350,7 @@ public: AK::Variant> const& override_cursor() const { return m_override_cursor; } void set_override_cursor(AK::Variant>); - using UnregisteredChildHandler = ErrorOr>(DeprecatedString const&); + using UnregisteredChildHandler = ErrorOr>(DeprecatedString const&); ErrorOr load_from_gml(StringView); ErrorOr load_from_gml(StringView, UnregisteredChildHandler); @@ -477,8 +477,8 @@ inline Widget const* Widget::parent_widget() const } template<> -inline bool Core::Object::fast_is() const { return is_widget(); } +inline bool Core::EventReceiver::fast_is() const { return is_widget(); } template<> -struct AK::Formatter : AK::Formatter { +struct AK::Formatter : AK::Formatter { }; diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 8f796a783aa..33995b93564 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -71,7 +71,7 @@ Window* Window::from_window_id(int window_id) return nullptr; } -Window::Window(Core::Object* parent) +Window::Window(Core::EventReceiver* parent) : GUI::Object(parent) , m_menubar(Menubar::construct()) { @@ -760,7 +760,7 @@ void Window::event(Core::Event& event) if (event.type() == Event::AppletAreaRectChange) return handle_applet_area_rect_change_event(static_cast(event)); - Core::Object::event(event); + Core::EventReceiver::event(event); } bool Window::is_visible() const diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index bad741fa89e..3bf423baee3 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -242,7 +242,7 @@ public: void propagate_shortcuts(KeyEvent& event, Widget* widget, ShortcutPropagationBoundary = ShortcutPropagationBoundary::Application); protected: - Window(Core::Object* parent = nullptr); + Window(Core::EventReceiver* parent = nullptr); virtual void wm_event(WMEvent&); virtual void screen_rects_change_event(ScreenRectsChangeEvent&); virtual void applet_area_rect_change_event(AppletAreaRectChangeEvent&); @@ -329,5 +329,5 @@ private: } template<> -struct AK::Formatter : Formatter { +struct AK::Formatter : Formatter { }; diff --git a/Userland/Libraries/LibIMAP/Objects.h b/Userland/Libraries/LibIMAP/Objects.h index 9e4555753e3..00549afd93c 100644 --- a/Userland/Libraries/LibIMAP/Objects.h +++ b/Userland/Libraries/LibIMAP/Objects.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace IMAP { enum class CommandType { diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index 42dc247d309..717414ed1da 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -32,7 +32,7 @@ struct DeferredInvoker { virtual void schedule(Function) = 0; }; -class ConnectionBase : public Core::Object { +class ConnectionBase : public Core::EventReceiver { C_OBJECT_ABSTRACT(ConnectionBase); public: @@ -161,5 +161,5 @@ protected: } template -struct AK::Formatter> : Formatter { +struct AK::Formatter> : Formatter { }; diff --git a/Userland/Libraries/LibIPC/ConnectionFromClient.h b/Userland/Libraries/LibIPC/ConnectionFromClient.h index 6e28bbeb1f9..c21a1ef99bd 100644 --- a/Userland/Libraries/LibIPC/ConnectionFromClient.h +++ b/Userland/Libraries/LibIPC/ConnectionFromClient.h @@ -69,5 +69,5 @@ private: } template -struct AK::Formatter> : Formatter { +struct AK::Formatter> : Formatter { }; diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h index 015f6d83a5d..17678c92047 100644 --- a/Userland/Libraries/LibLine/Editor.h +++ b/Userland/Libraries/LibLine/Editor.h @@ -21,8 +21,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -132,7 +132,7 @@ struct Configuration { #define EDITOR_INTERNAL_FUNCTION(name) \ [](auto& editor) { editor.name(); return false; } -class Editor : public Core::Object { +class Editor : public Core::EventReceiver { C_OBJECT(Editor); public: diff --git a/Userland/Libraries/LibSQL/BTree.h b/Userland/Libraries/LibSQL/BTree.h index 549443a2ee6..3e01a5235ef 100644 --- a/Userland/Libraries/LibSQL/BTree.h +++ b/Userland/Libraries/LibSQL/BTree.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibSQL/Database.h b/Userland/Libraries/LibSQL/Database.h index 14b048dc1c9..0e0bbd956b3 100644 --- a/Userland/Libraries/LibSQL/Database.h +++ b/Userland/Libraries/LibSQL/Database.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -24,7 +24,7 @@ namespace SQL { * to store in it. It has BTree pointers for B-Trees holding the definitions * of tables, columns, indexes, and other SQL objects. */ -class Database : public Core::Object { +class Database : public Core::EventReceiver { C_OBJECT(Database); public: diff --git a/Userland/Libraries/LibSQL/HashIndex.h b/Userland/Libraries/LibSQL/HashIndex.h index 549bd06586e..86eb2afd03c 100644 --- a/Userland/Libraries/LibSQL/HashIndex.h +++ b/Userland/Libraries/LibSQL/HashIndex.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibSQL/Heap.h b/Userland/Libraries/LibSQL/Heap.h index 398e25918eb..249ee36afd6 100644 --- a/Userland/Libraries/LibSQL/Heap.h +++ b/Userland/Libraries/LibSQL/Heap.h @@ -12,8 +12,8 @@ #include #include #include +#include #include -#include namespace SQL { @@ -64,7 +64,7 @@ private: * A Heap can be thought of the backing storage of a single database. It's * assumed that a single SQL database is backed by a single Heap. */ -class Heap : public Core::Object { +class Heap : public Core::EventReceiver { C_OBJECT(Heap); public: diff --git a/Userland/Libraries/LibSQL/Index.h b/Userland/Libraries/LibSQL/Index.h index 751091b74b8..e10c1459e14 100644 --- a/Userland/Libraries/LibSQL/Index.h +++ b/Userland/Libraries/LibSQL/Index.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include @@ -31,7 +31,7 @@ private: Block::Index m_block_index; }; -class Index : public Core::Object { +class Index : public Core::EventReceiver { C_OBJECT_ABSTRACT(Index); public: diff --git a/Userland/Libraries/LibSQL/Meta.h b/Userland/Libraries/LibSQL/Meta.h index ecebf8f2b90..59960391824 100644 --- a/Userland/Libraries/LibSQL/Meta.h +++ b/Userland/Libraries/LibSQL/Meta.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -23,7 +23,7 @@ namespace SQL { * It remains to be seen if this will survive in it's current form. */ -class Relation : public Core::Object { +class Relation : public Core::EventReceiver { C_OBJECT_ABSTRACT(Relation); public: @@ -36,14 +36,14 @@ public: protected: Relation(DeprecatedString name, Block::Index block_index, Relation* parent = nullptr) - : Core::Object(parent) + : Core::EventReceiver(parent) , m_block_index(block_index) { set_name(move(name)); } explicit Relation(DeprecatedString name, Relation* parent = nullptr) - : Core::Object(parent) + : Core::EventReceiver(parent) , m_block_index(0) { set_name(move(name)); diff --git a/Userland/Libraries/LibThreading/BackgroundAction.h b/Userland/Libraries/LibThreading/BackgroundAction.h index 0b513a3075c..87925a4e1bb 100644 --- a/Userland/Libraries/LibThreading/BackgroundAction.h +++ b/Userland/Libraries/LibThreading/BackgroundAction.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include @@ -35,14 +35,14 @@ private: }; template -class BackgroundAction final : public Core::Object +class BackgroundAction final : public Core::EventReceiver , private BackgroundActionBase { C_OBJECT(BackgroundAction); public: // Promise is an implementation detail of BackgroundAction in order to communicate with EventLoop. // All of the promise's callbacks and state are either managed by us or by EventLoop. - using Promise = Core::Promise>; + using Promise = Core::Promise>; virtual ~BackgroundAction() = default; @@ -55,13 +55,13 @@ public: private: BackgroundAction(Function(BackgroundAction&)> action, Function(Result)> on_complete, Optional> on_error = {}) - : Core::Object(&background_thread()) + : Core::EventReceiver(&background_thread()) , m_promise(Promise::try_create().release_value_but_fixme_should_propagate_errors()) , m_action(move(action)) , m_on_complete(move(on_complete)) { if (m_on_complete) { - m_promise->on_resolution = [](NonnullRefPtr& object) -> ErrorOr { + m_promise->on_resolution = [](NonnullRefPtr& object) -> ErrorOr { auto self = static_ptr_cast>(object); VERIFY(self->m_result.has_value()); if (auto maybe_error = self->m_on_complete(self->m_result.value()); maybe_error.is_error()) diff --git a/Userland/Libraries/LibThreading/Thread.cpp b/Userland/Libraries/LibThreading/Thread.cpp index 427970419c1..95dc0b55ea4 100644 --- a/Userland/Libraries/LibThreading/Thread.cpp +++ b/Userland/Libraries/LibThreading/Thread.cpp @@ -12,7 +12,7 @@ namespace Threading { Thread::Thread(Function action, StringView thread_name) - : Core::Object(nullptr) + : Core::EventReceiver(nullptr) , m_action(move(action)) , m_thread_name(thread_name.is_null() ? ""sv : thread_name) { diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index 7dba0ded820..8bb5398e7f3 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include namespace Threading { @@ -41,7 +41,7 @@ enum class ThreadState : u8 { Joined, }; -class Thread final : public Core::Object { +class Thread final : public Core::EventReceiver { C_OBJECT(Thread); public: diff --git a/Userland/Libraries/LibVideo/Containers/Demuxer.h b/Userland/Libraries/LibVideo/Containers/Demuxer.h index 967326f9ece..08acde77073 100644 --- a/Userland/Libraries/LibVideo/Containers/Demuxer.h +++ b/Userland/Libraries/LibVideo/Containers/Demuxer.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h index 751001321de..1c79de08d51 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ protected: explicit ResourceLoaderConnector(); }; -class ResourceLoader : public Core::Object { +class ResourceLoader : public Core::EventReceiver { C_OBJECT_ABSTRACT(ResourceLoader) public: static void initialize(RefPtr); diff --git a/Userland/Libraries/LibWeb/WebDriver/Client.cpp b/Userland/Libraries/LibWeb/WebDriver/Client.cpp index 27f7928e41f..7755a672803 100644 --- a/Userland/Libraries/LibWeb/WebDriver/Client.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/Client.cpp @@ -170,8 +170,8 @@ static JsonValue make_success_response(JsonValue value) return result; } -Client::Client(NonnullOwnPtr socket, Core::Object* parent) - : Core::Object(parent) +Client::Client(NonnullOwnPtr socket, Core::EventReceiver* parent) + : Core::EventReceiver(parent) , m_socket(move(socket)) { m_socket->on_ready_to_read = [this] { diff --git a/Userland/Libraries/LibWeb/WebDriver/Client.h b/Userland/Libraries/LibWeb/WebDriver/Client.h index 8c5889ef4f1..4cb7eb95869 100644 --- a/Userland/Libraries/LibWeb/WebDriver/Client.h +++ b/Userland/Libraries/LibWeb/WebDriver/Client.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -24,7 +24,7 @@ namespace Web::WebDriver { using Parameters = Vector; -class Client : public Core::Object { +class Client : public Core::EventReceiver { C_OBJECT_ABSTRACT(Client); public: @@ -106,7 +106,7 @@ public: virtual Response print_page(Parameters parameters, JsonValue payload) = 0; protected: - Client(NonnullOwnPtr, Core::Object* parent); + Client(NonnullOwnPtr, Core::EventReceiver* parent); private: using WrappedError = Variant; diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h index 273f6433dd4..6cd788b425a 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -116,7 +116,7 @@ protected: explicit WebSocketClientSocket(); }; -class WebSocketClientManager : public Core::Object { +class WebSocketClientManager : public Core::EventReceiver { C_OBJECT_ABSTRACT(WebSocketClientManager) public: static void initialize(RefPtr); diff --git a/Userland/Libraries/LibWebSocket/ConnectionInfo.h b/Userland/Libraries/LibWebSocket/ConnectionInfo.h index bed228fbe87..8df7cf047ba 100644 --- a/Userland/Libraries/LibWebSocket/ConnectionInfo.h +++ b/Userland/Libraries/LibWebSocket/ConnectionInfo.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/Userland/Libraries/LibWebSocket/WebSocket.h b/Userland/Libraries/LibWebSocket/WebSocket.h index 7d1ad27c268..def325d6a25 100644 --- a/Userland/Libraries/LibWebSocket/WebSocket.h +++ b/Userland/Libraries/LibWebSocket/WebSocket.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include #include #include @@ -22,7 +22,7 @@ enum class ReadyState { Closed = 3, }; -class WebSocket final : public Core::Object { +class WebSocket final : public Core::EventReceiver { C_OBJECT(WebSocket) public: static NonnullRefPtr create(ConnectionInfo, RefPtr = nullptr); diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h index 921d0d18b30..d31b3b2cf9c 100644 --- a/Userland/Services/AudioServer/Mixer.h +++ b/Userland/Services/AudioServer/Mixer.h @@ -123,7 +123,7 @@ private: FadingProperty m_volume { 1 }; }; -class Mixer : public Core::Object { +class Mixer : public Core::EventReceiver { C_OBJECT_ABSTRACT(Mixer) public: static ErrorOr> try_create(NonnullRefPtr config) diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index dc78032fd19..98f35180a0c 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -35,7 +35,7 @@ static MACAddress mac_from_string(DeprecatedString const& str) }; } -static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, Core::Object*) +static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, Core::EventReceiver*) { int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) { diff --git a/Userland/Services/DHCPClient/DHCPv4Client.h b/Userland/Services/DHCPClient/DHCPv4Client.h index ec318b18de5..9b77ce0b679 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.h +++ b/Userland/Services/DHCPClient/DHCPv4Client.h @@ -36,7 +36,7 @@ struct DHCPv4Transaction { u32 offered_lease_time { 0 }; }; -class DHCPv4Client final : public Core::Object { +class DHCPv4Client final : public Core::EventReceiver { C_OBJECT(DHCPv4Client) public: diff --git a/Userland/Services/LookupServer/DNSServer.cpp b/Userland/Services/LookupServer/DNSServer.cpp index 970d339387f..2ba45cf00e6 100644 --- a/Userland/Services/LookupServer/DNSServer.cpp +++ b/Userland/Services/LookupServer/DNSServer.cpp @@ -13,7 +13,7 @@ namespace LookupServer { using namespace DNS; -DNSServer::DNSServer(Object* parent) +DNSServer::DNSServer(Core::EventReceiver* parent) : Core::UDPServer(parent) { bind(IPv4Address(), 53); diff --git a/Userland/Services/LookupServer/DNSServer.h b/Userland/Services/LookupServer/DNSServer.h index 54e1fe9f8f9..b4e4d483a76 100644 --- a/Userland/Services/LookupServer/DNSServer.h +++ b/Userland/Services/LookupServer/DNSServer.h @@ -14,7 +14,7 @@ class DNSServer : public Core::UDPServer { C_OBJECT(DNSServer) private: - explicit DNSServer(Object* parent = nullptr); + explicit DNSServer(Core::EventReceiver* parent = nullptr); ErrorOr handle_client(); }; diff --git a/Userland/Services/LookupServer/LookupServer.h b/Userland/Services/LookupServer/LookupServer.h index 3ccc0f8128e..4f197d0f324 100644 --- a/Userland/Services/LookupServer/LookupServer.h +++ b/Userland/Services/LookupServer/LookupServer.h @@ -9,8 +9,8 @@ #include "ConnectionFromClient.h" #include "DNSServer.h" #include "MulticastDNS.h" +#include #include -#include #include #include #include @@ -19,7 +19,7 @@ namespace LookupServer { using namespace DNS; -class LookupServer final : public Core::Object { +class LookupServer final : public Core::EventReceiver { C_OBJECT(LookupServer); public: diff --git a/Userland/Services/LookupServer/MulticastDNS.cpp b/Userland/Services/LookupServer/MulticastDNS.cpp index 19e84d5e77a..88a0d0bf7e3 100644 --- a/Userland/Services/LookupServer/MulticastDNS.cpp +++ b/Userland/Services/LookupServer/MulticastDNS.cpp @@ -20,7 +20,7 @@ namespace LookupServer { -MulticastDNS::MulticastDNS(Object* parent) +MulticastDNS::MulticastDNS(Core::EventReceiver* parent) : Core::UDPServer(parent) , m_hostname("courage.local") { diff --git a/Userland/Services/LookupServer/MulticastDNS.h b/Userland/Services/LookupServer/MulticastDNS.h index dab0e0bdbb8..8b59a2415a6 100644 --- a/Userland/Services/LookupServer/MulticastDNS.h +++ b/Userland/Services/LookupServer/MulticastDNS.h @@ -24,7 +24,7 @@ public: ErrorOr> lookup(Name const&, RecordType record_type); private: - explicit MulticastDNS(Object* parent = nullptr); + explicit MulticastDNS(Core::EventReceiver* parent = nullptr); void announce(); ErrorOr emit_packet(Packet const&, sockaddr_in const* destination = nullptr); diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp index 358545f29b3..a8f354e3637 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.cpp +++ b/Userland/Services/SQLServer/DatabaseConnection.cpp @@ -49,8 +49,7 @@ ErrorOr> DatabaseConnection::create(StringView } DatabaseConnection::DatabaseConnection(NonnullRefPtr database, DeprecatedString database_name, int client_id) - : Object() - , m_database(move(database)) + : m_database(move(database)) , m_database_name(move(database_name)) , m_connection_id(s_next_connection_id++) , m_client_id(client_id) diff --git a/Userland/Services/SQLServer/DatabaseConnection.h b/Userland/Services/SQLServer/DatabaseConnection.h index d43e449b2c8..df2fc9c8d79 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.h +++ b/Userland/Services/SQLServer/DatabaseConnection.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include #include @@ -15,7 +15,7 @@ namespace SQLServer { -class DatabaseConnection final : public Core::Object { +class DatabaseConnection final : public Core::EventReceiver { C_OBJECT_ABSTRACT(DatabaseConnection) public: diff --git a/Userland/Services/SQLServer/SQLStatement.cpp b/Userland/Services/SQLServer/SQLStatement.cpp index 7a9eec6911f..6e618885361 100644 --- a/Userland/Services/SQLServer/SQLStatement.cpp +++ b/Userland/Services/SQLServer/SQLStatement.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -35,7 +35,7 @@ SQL::ResultOr> SQLStatement::create(DatabaseConnecti } SQLStatement::SQLStatement(DatabaseConnection& connection, NonnullRefPtr statement) - : Core::Object(&connection) + : Core::EventReceiver(&connection) , m_statement_id(s_next_statement_id++) , m_statement(move(statement)) { diff --git a/Userland/Services/SQLServer/SQLStatement.h b/Userland/Services/SQLServer/SQLStatement.h index 65abc8ce6c0..233a309c970 100644 --- a/Userland/Services/SQLServer/SQLStatement.h +++ b/Userland/Services/SQLServer/SQLStatement.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -18,7 +18,7 @@ namespace SQLServer { -class SQLStatement final : public Core::Object { +class SQLStatement final : public Core::EventReceiver { C_OBJECT_ABSTRACT(SQLStatement) public: diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index da4cc357ee8..effa696d5c9 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -282,7 +282,7 @@ ErrorOr Service::did_exit(int status) } Service::Service(Core::ConfigFile const& config, StringView name) - : Core::Object(nullptr) + : Core::EventReceiver(nullptr) { VERIFY(config.has_group(name)); diff --git a/Userland/Services/SystemServer/Service.h b/Userland/Services/SystemServer/Service.h index c26ac8378d3..d89d2fc6286 100644 --- a/Userland/Services/SystemServer/Service.h +++ b/Userland/Services/SystemServer/Service.h @@ -10,10 +10,10 @@ #include #include #include +#include #include -#include -class Service final : public Core::Object { +class Service final : public Core::EventReceiver { C_OBJECT_ABSTRACT(Service) public: diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index 28076d4d586..56d91eb3299 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -20,7 +20,7 @@ namespace WebDriver { Atomic Client::s_next_session_id; HashMap> Client::s_sessions; -ErrorOr> Client::try_create(NonnullOwnPtr socket, LaunchBrowserCallbacks callbacks, Core::Object* parent) +ErrorOr> Client::try_create(NonnullOwnPtr socket, LaunchBrowserCallbacks callbacks, Core::EventReceiver* parent) { if (!callbacks.launch_browser || !callbacks.launch_headless_browser) return Error::from_string_view("All callbacks to launch a browser must be provided"sv); @@ -29,7 +29,7 @@ ErrorOr> Client::try_create(NonnullOwnPtr socket, LaunchBrowserCallbacks callbacks, Core::Object* parent) +Client::Client(NonnullOwnPtr socket, LaunchBrowserCallbacks callbacks, Core::EventReceiver* parent) : Web::WebDriver::Client(move(socket), parent) , m_callbacks(move(callbacks)) { diff --git a/Userland/Services/WebDriver/Client.h b/Userland/Services/WebDriver/Client.h index 27c204e6928..14061ccf553 100644 --- a/Userland/Services/WebDriver/Client.h +++ b/Userland/Services/WebDriver/Client.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -27,13 +27,13 @@ class Client final : public Web::WebDriver::Client { C_OBJECT_ABSTRACT(Client); public: - static ErrorOr> try_create(NonnullOwnPtr, LaunchBrowserCallbacks, Core::Object* parent); + static ErrorOr> try_create(NonnullOwnPtr, LaunchBrowserCallbacks, Core::EventReceiver* parent); virtual ~Client() override; void close_session(unsigned session_id); private: - Client(NonnullOwnPtr, LaunchBrowserCallbacks, Core::Object* parent); + Client(NonnullOwnPtr, LaunchBrowserCallbacks, Core::EventReceiver* parent); ErrorOr, Web::WebDriver::Error> find_session_with_id(StringView session_id); diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index 345c9ad345a..8f6cfb12fe2 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -29,8 +29,8 @@ namespace WebServer { -Client::Client(NonnullOwnPtr socket, Core::Object* parent) - : Core::Object(parent) +Client::Client(NonnullOwnPtr socket, Core::EventReceiver* parent) + : Core::EventReceiver(parent) , m_socket(move(socket)) { } diff --git a/Userland/Services/WebServer/Client.h b/Userland/Services/WebServer/Client.h index b9005290e20..19e5a0f6e77 100644 --- a/Userland/Services/WebServer/Client.h +++ b/Userland/Services/WebServer/Client.h @@ -8,21 +8,21 @@ #pragma once #include -#include +#include #include #include #include namespace WebServer { -class Client final : public Core::Object { +class Client final : public Core::EventReceiver { C_OBJECT(Client); public: void start(); private: - Client(NonnullOwnPtr, Core::Object* parent); + Client(NonnullOwnPtr, Core::EventReceiver* parent); using WrappedError = Variant; diff --git a/Userland/Services/WindowServer/AppletManager.h b/Userland/Services/WindowServer/AppletManager.h index 0b1eaae4106..73d9c350b31 100644 --- a/Userland/Services/WindowServer/AppletManager.h +++ b/Userland/Services/WindowServer/AppletManager.h @@ -11,7 +11,7 @@ namespace WindowServer { -class AppletManager : public Core::Object { +class AppletManager : public Core::EventReceiver { C_OBJECT(AppletManager) public: ~AppletManager() = default; diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index cb3ba983b05..0db0a4297ea 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ struct CompositorScreenData { } }; -class Compositor final : public Core::Object { +class Compositor final : public Core::EventReceiver { C_OBJECT(Compositor) friend struct CompositorScreenData; friend class Overlay; diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h index 5dd33a8a243..274b246a424 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.h +++ b/Userland/Services/WindowServer/ConnectionFromClient.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Services/WindowServer/KeymapSwitcher.h b/Userland/Services/WindowServer/KeymapSwitcher.h index 555206d0ede..92c2e4ca1e3 100644 --- a/Userland/Services/WindowServer/KeymapSwitcher.h +++ b/Userland/Services/WindowServer/KeymapSwitcher.h @@ -9,14 +9,14 @@ #include #include #include +#include #include -#include #include #include namespace WindowServer { -class KeymapSwitcher final : public Core::Object { +class KeymapSwitcher final : public Core::EventReceiver { C_OBJECT(KeymapSwitcher) public: virtual ~KeymapSwitcher() override = default; diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 629bc0ba64f..7ae15377f95 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -39,7 +39,7 @@ u32 find_ampersand_shortcut_character(StringView string) } Menu::Menu(ConnectionFromClient* client, int menu_id, String name) - : Core::Object(client) + : Core::EventReceiver(client) , m_client(client) , m_menu_id(menu_id) , m_name(move(name)) @@ -491,7 +491,7 @@ void Menu::event(Core::Event& event) return; } } - Core::Object::event(event); + Core::EventReceiver::event(event); } void Menu::clear_hovered_item() diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index 1e96529d481..54c79db4bf4 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -23,7 +23,7 @@ class ConnectionFromClient; class Menubar; class Window; -class Menu final : public Core::Object { +class Menu final : public Core::EventReceiver { C_OBJECT(Menu); public: diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index d2062479854..84436441825 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -149,7 +149,7 @@ void MenuManager::event(Core::Event& event) } } - return Core::Object::event(event); + return Core::EventReceiver::event(event); } void MenuManager::handle_mouse_event(MouseEvent& mouse_event) diff --git a/Userland/Services/WindowServer/MenuManager.h b/Userland/Services/WindowServer/MenuManager.h index a770597f14c..eefee24080b 100644 --- a/Userland/Services/WindowServer/MenuManager.h +++ b/Userland/Services/WindowServer/MenuManager.h @@ -14,7 +14,7 @@ namespace WindowServer { -class MenuManager final : public Core::Object { +class MenuManager final : public Core::EventReceiver { C_OBJECT(MenuManager); public: diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index ba3c4180a9b..8b86e07abcc 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -84,8 +84,8 @@ static Gfx::Bitmap& move_icon() return *s_icon; } -Window::Window(Core::Object& parent, WindowType type) - : Core::Object(&parent) +Window::Window(Core::EventReceiver& parent, WindowType type) + : Core::EventReceiver(&parent) , m_type(type) , m_icon(default_window_icon()) , m_frame(*this) @@ -95,7 +95,7 @@ Window::Window(Core::Object& parent, WindowType type) } Window::Window(ConnectionFromClient& client, WindowType window_type, WindowMode window_mode, int window_id, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, Window* parent_window) - : Core::Object(&client) + : Core::EventReceiver(&client) , m_client(&client) , m_type(window_type) , m_mode(window_mode) diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index 66a766aaa9c..aaf928d0b42 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -81,7 +81,7 @@ enum class WindowMinimizedState : u32 { Hidden, }; -class Window final : public Core::Object { +class Window final : public Core::EventReceiver { C_OBJECT(Window); public: @@ -375,7 +375,7 @@ public: private: Window(ConnectionFromClient&, WindowType, WindowMode, int window_id, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, Window* parent_window = nullptr); - Window(Core::Object&, WindowType); + Window(Core::EventReceiver&, WindowType); virtual void event(Core::Event&) override; void handle_mouse_event(MouseEvent const&); diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index d30f810d5e9..f7a0eb3f344 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -1559,7 +1559,7 @@ void WindowManager::event(Core::Event& event) return; } - Core::Object::event(event); + Core::EventReceiver::event(event); } bool WindowManager::is_window_in_modal_chain(Window& chain_window, Window& other_window) diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index 8e0c6997f4b..4aef58bd058 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -45,7 +45,7 @@ class DndOverlay; class WindowGeometryOverlay; class TileWindowOverlay; -class WindowManager : public Core::Object { +class WindowManager : public Core::EventReceiver { C_OBJECT(WindowManager) friend class Compositor; diff --git a/Userland/Services/WindowServer/WindowSwitcher.h b/Userland/Services/WindowServer/WindowSwitcher.h index 52ae22f8250..3b7fce67433 100644 --- a/Userland/Services/WindowServer/WindowSwitcher.h +++ b/Userland/Services/WindowServer/WindowSwitcher.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -17,7 +17,7 @@ namespace WindowServer { class KeyEvent; class Window; -class WindowSwitcher final : public Core::Object { +class WindowSwitcher final : public Core::EventReceiver { C_OBJECT(WindowSwitcher) public: enum class Mode { diff --git a/Userland/Shell/Job.h b/Userland/Shell/Job.h index f6cef51bbad..3f40973d3dd 100644 --- a/Userland/Shell/Job.h +++ b/Userland/Shell/Job.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace Shell { diff --git a/Userland/Shell/Shell.h b/Userland/Shell/Shell.h index f7fb0485498..d728358b4d5 100644 --- a/Userland/Shell/Shell.h +++ b/Userland/Shell/Shell.h @@ -18,8 +18,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -97,7 +97,7 @@ enum class POSIXModeRequirement { InAllModes, }; -class Shell : public Core::Object { +class Shell : public Core::EventReceiver { C_OBJECT(Shell); public: