1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

Start refactoring the windowing system to use an event loop.

Userspace programs can now open /dev/gui_events and read a stream of GUI_Event
structs one at a time.

I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to
having one of the has_data_available_for_reading() implementations using locks.
This commit is contained in:
Andreas Kling 2019-01-14 14:21:51 +01:00
parent b4da4e8fbd
commit b0e3f73375
46 changed files with 283 additions and 292 deletions

View file

@ -12,6 +12,7 @@
#include <AK/AKString.h>
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
#include <AK/Lock.h>
class FileDescriptor;
class PageDirectory;
@ -191,13 +192,12 @@ public:
int gui$create_window(const GUI_CreateWindowParameters*);
int gui$destroy_window(int window_id);
int gui$create_widget(int window_id, const GUI_CreateWidgetParameters*);
int gui$destroy_widget(int widget_id);
DisplayInfo get_display_info();
static void initialize();
static void initialize_gui_statics();
int make_window_id();
void crash() NORETURN;
static int reap(Process&) WARN_UNUSED_RESULT;
@ -248,6 +248,9 @@ public:
bool is_root() const { return m_euid == 0; }
Vector<GUI_Event>& gui_events() { return m_gui_events; }
SpinLock& gui_events_lock() { return m_gui_events_lock; }
private:
friend class MemoryManager;
friend class Scheduler;
@ -342,8 +345,11 @@ private:
RetainPtr<Region> m_display_framebuffer_region;
Vector<WeakPtr<Window>> m_windows;
Vector<WeakPtr<Widget>> m_widgets;
HashMap<int, OwnPtr<Window>> m_windows;
Vector<GUI_Event> m_gui_events;
SpinLock m_gui_events_lock;
int m_next_window_id { 1 };
};
extern Process* current;