#pragma once #include "AbstractUiInterface.h" #include class XcbGlInterface; using XcbGlInterfacePtr = std::unique_ptr; class XcbEventInterface; using XcbEventInterfacePtr = std::unique_ptr; class XcbWindowInterface; using XcbWindowInterfacePtr = std::unique_ptr; struct xcb_connection_t; struct xcb_expose_event_t; struct _XDisplay; namespace mt { class Window; } class XcbInterface : public AbstractUIInterface { public: XcbInterface(DesktopManager* desktopManager, bool useHardware = true); ~XcbInterface(); void loop() override; void addWindow(mt::Window* window) override; void showWindow(mt::Window* window) override; private: void initialize() override; void onPaint(); void onEventsDispatched(); void onExposeEvent(xcb_expose_event_t* event); void initializeHardwareRendering() override; void createGraphicsContext(); void connect(); void updateScreen(); void mapWindow(mt::Window* window); void shutDown() override; uint32_t getEventMask(); private: xcb_connection_t* mConnection{nullptr}; _XDisplay* mX11Display{nullptr}; XcbGlInterfacePtr mGlInterface; XcbEventInterfacePtr mEventInterface; };