mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:07:43 +00:00
LibCore: Move LibGUI/GNotifier to LibCore/CNotifier.
This commit is contained in:
parent
b2542414d7
commit
fc1d3074de
15 changed files with 53 additions and 53 deletions
|
@ -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>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
class GAction;
|
||||
class CObject;
|
||||
class GNotifier;
|
||||
class CNotifier;
|
||||
class GWindow;
|
||||
|
||||
class GEventLoop final : public CEventLoop {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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 };
|
||||
};
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,6 @@ LIBGUI_OBJS = \
|
|||
GEventLoop.o \
|
||||
GLabel.o \
|
||||
GListBox.o \
|
||||
GNotifier.o \
|
||||
GTextBox.o \
|
||||
GScrollBar.o \
|
||||
GStatusBar.o \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue