1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 13:55:07 +00:00
serenity/WindowServer/WSMessageLoop.h
Andreas Kling a1b63bb6d4 Bootloader: Locate the kernel's data segment and clear it.
This was a constant source of stupid bugs and I kept postponing it because
I wasn't in the mood to write assembly code. Until now! :^)
2019-02-06 16:02:10 +01:00

43 lines
880 B
C++

#pragma once
#include "WSMessage.h"
#include <AK/Lock.h>
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
class WSMessageReceiver;
class Process;
class WSMessageLoop {
public:
WSMessageLoop();
~WSMessageLoop();
int exec();
void post_message(WSMessageReceiver* receiver, OwnPtr<WSMessage>&&, bool unsafe = false);
static WSMessageLoop& the();
bool running() const { return m_running; }
Process& server_process() { return *m_server_process; }
private:
void wait_for_message();
void drain_mouse();
void drain_keyboard();
Lock m_lock;
struct QueuedMessage {
WSMessageReceiver* receiver { nullptr };
OwnPtr<WSMessage> message;
};
Vector<QueuedMessage> m_queued_messages;
Process* m_server_process { nullptr };
bool m_running { false };
int m_keyboard_fd { -1 };
int m_mouse_fd { -1 };
};