59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "AbstractUiInterface.h"
|
|
|
|
#include <memory>
|
|
|
|
class XcbGlInterface;
|
|
using XcbGlInterfacePtr = std::unique_ptr<XcbGlInterface>;
|
|
|
|
class XcbEventInterface;
|
|
using XcbEventInterfacePtr = std::unique_ptr<XcbEventInterface>;
|
|
|
|
class XcbWindowInterface;
|
|
using XcbWindowInterfacePtr = std::unique_ptr<XcbWindowInterface>;
|
|
|
|
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;
|
|
};
|