LibGUI/WindowServer: Implement per-window custom cursors

This commit is contained in:
2025-06-27 14:12:02 +03:00
parent 273e9bbc92
commit cf07b747fe
7 changed files with 110 additions and 19 deletions

View File

@@ -11,6 +11,14 @@
class Window : public BAN::RefCounted<Window>
{
public:
struct Cursor
{
uint32_t width;
uint32_t height;
BAN::Vector<uint32_t> pixels;
};
public:
Window(int fd, const LibFont::Font& font)
: m_font(font)
@@ -49,6 +57,11 @@ public:
Rectangle full_size() const { return { 0, 0, full_width(), full_height() }; }
Rectangle full_area() const { return { full_x(), full_y(), full_width(), full_height() }; }
bool has_cursor() const { return m_cursor.has_value(); }
const Cursor& cursor() const { return m_cursor.value(); }
void set_cursor(Cursor&& cursor) { m_cursor = BAN::move(cursor); }
void remove_cursor() { m_cursor.clear(); }
LibGUI::Window::Attributes get_attributes() const { return m_attributes; };
void set_attributes(LibGUI::Window::Attributes attributes) { m_attributes = attributes; };
@@ -96,6 +109,8 @@ private:
uint32_t* m_fb_addr { nullptr };
BAN::String m_title;
BAN::Optional<Cursor> m_cursor;
BAN::Vector<uint32_t> m_title_bar_data;
LibGUI::Window::Attributes m_attributes { LibGUI::Window::default_attributes };