mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:47:44 +00:00
LibCore: Convert CNotifier to ObjectPtr
This commit is contained in:
parent
50a6560413
commit
d1bacb9885
17 changed files with 42 additions and 32 deletions
|
@ -14,10 +14,10 @@ Client::Client(int id, CTCPSocket* socket, int ptm_fd)
|
|||
: m_id(id)
|
||||
, m_socket(socket)
|
||||
, m_ptm_fd(ptm_fd)
|
||||
, m_ptm_notifier(ptm_fd, CNotifier::Read)
|
||||
, m_ptm_notifier(CNotifier::create(ptm_fd, CNotifier::Read))
|
||||
{
|
||||
m_socket->on_ready_to_read = [this] { drain_socket(); };
|
||||
m_ptm_notifier.on_ready_to_read = [this] { drain_pty(); };
|
||||
m_ptm_notifier->on_ready_to_read = [this] { drain_pty(); };
|
||||
m_parser.on_command = [this](const Command& command) { handle_command(command); };
|
||||
m_parser.on_data = [this](const StringView& data) { handle_data(data); };
|
||||
m_parser.on_error = [this]() { handle_error(); };
|
||||
|
@ -154,7 +154,7 @@ void Client::send_commands(Vector<Command> commands)
|
|||
|
||||
void Client::quit()
|
||||
{
|
||||
m_ptm_notifier.set_enabled(false);
|
||||
m_ptm_notifier->set_enabled(false);
|
||||
close(m_ptm_fd);
|
||||
m_socket->close();
|
||||
if (on_exit)
|
||||
|
|
|
@ -39,5 +39,5 @@ private:
|
|||
Parser m_parser;
|
||||
// pty resources
|
||||
int m_ptm_fd { -1 };
|
||||
CNotifier m_ptm_notifier;
|
||||
ObjectPtr<CNotifier> m_ptm_notifier;
|
||||
};
|
||||
|
|
|
@ -43,10 +43,10 @@ WSEventLoop::WSEventLoop()
|
|||
ASSERT(m_keyboard_fd >= 0);
|
||||
ASSERT(m_mouse_fd >= 0);
|
||||
|
||||
m_keyboard_notifier = make<CNotifier>(m_keyboard_fd, CNotifier::Read);
|
||||
m_keyboard_notifier = CNotifier::create(m_keyboard_fd, CNotifier::Read);
|
||||
m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); };
|
||||
|
||||
m_mouse_notifier = make<CNotifier>(m_mouse_fd, CNotifier::Read);
|
||||
m_mouse_notifier = CNotifier::create(m_mouse_fd, CNotifier::Read);
|
||||
m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); };
|
||||
|
||||
WSClipboard::the().on_content_change = [&] {
|
||||
|
|
|
@ -21,9 +21,8 @@ private:
|
|||
|
||||
CEventLoop m_event_loop;
|
||||
int m_keyboard_fd { -1 };
|
||||
OwnPtr<CNotifier> m_keyboard_notifier;
|
||||
ObjectPtr<CNotifier> m_keyboard_notifier;
|
||||
int m_mouse_fd { -1 };
|
||||
OwnPtr<CNotifier> m_mouse_notifier;
|
||||
ObjectPtr<CNotifier> m_mouse_notifier;
|
||||
CLocalServer m_server_sock;
|
||||
OwnPtr<CNotifier> m_server_notifier;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue