#pragma once #include "Framebuffer.h" #include "Window.h" #include #include #include #include #include #include #include #include #include #include class WindowServer { public: WindowServer(Framebuffer& framebuffer) : m_framebuffer(framebuffer) , m_cursor({ framebuffer.width / 2, framebuffer.height / 2 }) , m_font(MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"_sv))) { invalidate(m_framebuffer.area()); } BAN::ErrorOr set_background_image(BAN::UniqPtr); void on_window_packet(int fd, LibGUI::WindowPacket); void on_key_event(LibInput::KeyEvent event); void on_mouse_button(LibInput::MouseButtonEvent event); void on_mouse_move(LibInput::MouseMoveEvent event); void on_mouse_scroll(LibInput::MouseScrollEvent event); void set_focused_window(BAN::RefPtr window); void invalidate(Rectangle area); Rectangle cursor_area() const; void add_client_fd(int fd); void remove_client_fd(int fd); int get_client_fds(fd_set& fds) const; void for_each_client_fd(const BAN::Function& callback); bool is_stopped() const { return m_is_stopped; } private: Framebuffer& m_framebuffer; BAN::Vector> m_client_windows; BAN::Vector m_client_fds; BAN::UniqPtr m_background_image; bool m_is_mod_key_held { false }; bool m_is_moving_window { false }; BAN::RefPtr m_focused_window; Position m_cursor; bool m_deleted_window { false }; bool m_is_stopped { false }; LibFont::Font m_font; };