mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
WSEventLoop: Remove inheritance from CEventLoop
The only reason for the inheritance was to add FDs to the select set. Since CNotifier is available (and now also quite useful), we can make use of it instead, and remove the inheritance.
This commit is contained in:
parent
6eaa6826fa
commit
3837de0573
6 changed files with 30 additions and 45 deletions
|
@ -8,25 +8,23 @@
|
|||
class WSClientConnection;
|
||||
struct WSAPI_ClientMessage;
|
||||
|
||||
class WSEventLoop : public CEventLoop {
|
||||
class WSEventLoop {
|
||||
public:
|
||||
WSEventLoop();
|
||||
virtual ~WSEventLoop() override;
|
||||
virtual ~WSEventLoop();
|
||||
|
||||
static WSEventLoop& the() { return static_cast<WSEventLoop&>(CEventLoop::current()); }
|
||||
int exec() { return m_event_loop.exec(); }
|
||||
|
||||
private:
|
||||
virtual void add_file_descriptors_for_select(fd_set&, int& max_fd_added) override;
|
||||
virtual void process_file_descriptors_after_select(const fd_set&) override;
|
||||
|
||||
void drain_server();
|
||||
void drain_mouse();
|
||||
void drain_keyboard();
|
||||
void drain_client(WSClientConnection&);
|
||||
bool on_receive_from_client(int client_id, const WSAPI_ClientMessage&, ByteBuffer&& extra_data);
|
||||
|
||||
CEventLoop m_event_loop;
|
||||
int m_keyboard_fd { -1 };
|
||||
OwnPtr<CNotifier> m_keyboard_notifier;
|
||||
int m_mouse_fd { -1 };
|
||||
OwnPtr<CNotifier> m_mouse_notifier;
|
||||
CLocalSocket m_server_sock;
|
||||
OwnPtr<CNotifier> m_server_notifier;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue