1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

Tear out or duplicate what's unique for WindowServer from Widgets.

This turned into a huge refactoring that somehow also includes
making locks recursive/reentrant.
This commit is contained in:
Andreas Kling 2019-01-16 16:03:50 +01:00
parent e655aebd70
commit f7ca6d254d
30 changed files with 757 additions and 308 deletions

41
WindowServer/WSScreen.h Normal file
View file

@ -0,0 +1,41 @@
#pragma once
#include <Widgets/Rect.h>
#include <Widgets/Size.h>
#include <Kernel/Keyboard.h>
class WSScreen : public KeyboardClient {
public:
virtual ~WSScreen();
int width() const { return m_width; }
int height() const { return m_height; }
static WSScreen& the();
Size size() const { return { width(), height() }; }
Rect rect() const { return { 0, 0, width(), height() }; }
static void initialize();
Point cursor_location() const { return m_cursor_location; }
bool left_mouse_button_pressed() const { return m_left_mouse_button_pressed; }
bool right_mouse_button_pressed() const { return m_right_mouse_button_pressed; }
void on_receive_mouse_data(int dx, int dy, bool left_button, bool right_button);
protected:
WSScreen(unsigned width, unsigned height);
private:
// ^KeyboardClient
virtual void on_key_pressed(Keyboard::Key) final;
int m_width { 0 };
int m_height { 0 };
Point m_cursor_location;
bool m_left_mouse_button_pressed { false };
bool m_right_mouse_button_pressed { false };
};