diff options
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GEventLoop.cpp | 2 | ||||
-rw-r--r-- | LibGUI/GEventLoop.h | 2 | ||||
-rw-r--r-- | LibGUI/GNotifier.cpp | 15 | ||||
-rw-r--r-- | LibGUI/GNotifier.h | 26 | ||||
-rw-r--r-- | LibGUI/GSocket.cpp | 8 | ||||
-rw-r--r-- | LibGUI/GSocket.h | 4 | ||||
-rw-r--r-- | LibGUI/Makefile | 1 |
7 files changed, 8 insertions, 50 deletions
diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp index 8e1bc69bc0..a7502c0b7e 100644 --- a/LibGUI/GEventLoop.cpp +++ b/LibGUI/GEventLoop.cpp @@ -4,7 +4,7 @@ #include "GWindow.h" #include <LibGUI/GApplication.h> #include <LibGUI/GAction.h> -#include <LibGUI/GNotifier.h> +#include <LibCore/CNotifier.h> #include <LibGUI/GMenu.h> #include <LibGUI/GDesktop.h> #include <LibC/unistd.h> diff --git a/LibGUI/GEventLoop.h b/LibGUI/GEventLoop.h index bf09c4d401..3ee1dfc1fc 100644 --- a/LibGUI/GEventLoop.h +++ b/LibGUI/GEventLoop.h @@ -6,7 +6,7 @@ class GAction; class CObject; -class GNotifier; +class CNotifier; class GWindow; class GEventLoop final : public CEventLoop { diff --git a/LibGUI/GNotifier.cpp b/LibGUI/GNotifier.cpp deleted file mode 100644 index 649cc84bcc..0000000000 --- a/LibGUI/GNotifier.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include <LibGUI/GNotifier.h> -#include <LibGUI/GEventLoop.h> - -GNotifier::GNotifier(int fd, unsigned event_mask) - : m_fd(fd) - , m_event_mask(event_mask) -{ - GEventLoop::register_notifier(Badge<GNotifier>(), *this); -} - -GNotifier::~GNotifier() -{ - GEventLoop::unregister_notifier(Badge<GNotifier>(), *this); -} - diff --git a/LibGUI/GNotifier.h b/LibGUI/GNotifier.h deleted file mode 100644 index 6876c481f4..0000000000 --- a/LibGUI/GNotifier.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include <AK/Function.h> - -class GNotifier { -public: - enum Event { - None = 0, - Read = 1, - Write = 2, - Exceptional = 4, - }; - GNotifier(int fd, unsigned event_mask); - ~GNotifier(); - - Function<void(GNotifier&)> on_ready_to_read; - Function<void(GNotifier&)> on_ready_to_write; - - int fd() const { return m_fd; } - unsigned event_mask() const { return m_event_mask; } - void set_event_mask(unsigned event_mask) { m_event_mask = event_mask; } - -private: - int m_fd { -1 }; - unsigned m_event_mask { 0 }; -}; diff --git a/LibGUI/GSocket.cpp b/LibGUI/GSocket.cpp index b1a1f4797d..6b088e2dbe 100644 --- a/LibGUI/GSocket.cpp +++ b/LibGUI/GSocket.cpp @@ -1,5 +1,5 @@ #include <LibGUI/GSocket.h> -#include <LibGUI/GNotifier.h> +#include <LibCore/CNotifier.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -53,11 +53,11 @@ bool GSocket::connect(const GSocketAddress& address, int port) if (rc < 0) { if (errno == EINPROGRESS) { printf("in progress.\n"); - m_notifier = make<GNotifier>(fd(), GNotifier::Event::Write); - m_notifier->on_ready_to_write = [this] (GNotifier&) { + m_notifier = make<CNotifier>(fd(), CNotifier::Event::Write); + m_notifier->on_ready_to_write = [this] { printf("%s{%p} connected!\n", class_name(), this); m_connected = true; - m_notifier->set_event_mask(GNotifier::Event::None); + m_notifier->set_event_mask(CNotifier::Event::None); if (on_connected) on_connected(); }; diff --git a/LibGUI/GSocket.h b/LibGUI/GSocket.h index f9501eab3f..697845d2d1 100644 --- a/LibGUI/GSocket.h +++ b/LibGUI/GSocket.h @@ -3,7 +3,7 @@ #include <LibGUI/GIODevice.h> #include <LibGUI/GSocketAddress.h> -class GNotifier; +class CNotifier; class GSocket : public GIODevice { public: @@ -40,5 +40,5 @@ protected: private: virtual bool open(GIODevice::OpenMode) override { ASSERT_NOT_REACHED(); } Type m_type { Type::Invalid }; - OwnPtr<GNotifier> m_notifier; + OwnPtr<CNotifier> m_notifier; }; diff --git a/LibGUI/Makefile b/LibGUI/Makefile index 37b21c6e62..b687153aa8 100644 --- a/LibGUI/Makefile +++ b/LibGUI/Makefile @@ -17,7 +17,6 @@ LIBGUI_OBJS = \ GEventLoop.o \ GLabel.o \ GListBox.o \ - GNotifier.o \ GTextBox.o \ GScrollBar.o \ GStatusBar.o \ |