Initial commit.

This commit is contained in:
jmsgrogan 2020-05-02 08:31:03 +01:00
commit 59c6161fdb
134 changed files with 4751 additions and 0 deletions

View file

@ -0,0 +1,84 @@
#pragma once
#include <memory>
#include <map>
#include "Window.h"
#include "VisualLayer.h"
class DesktopManager;
using DesktopManagerPtr = std::shared_ptr<DesktopManager>;
class GlxInterface;
using GlxInterfacePtr = std::shared_ptr<GlxInterface>;
struct xcb_screen_t;
struct xcb_connection_t;
struct xcb_key_press_event_t;
struct xcb_button_press_event_t;
struct _XDisplay;
class XcbInterface
{
private:
bool mUseOpenGl;
std::map<unsigned, WindowPtr> mWindows;
std::map<WindowPtr, unsigned> mHandles;
unsigned mDefaultWindow;
xcb_connection_t* mConnection;
xcb_screen_t* mScreen;
unsigned mGraphicsContext;
_XDisplay* mX11Display;
GlxInterfacePtr mGlxInterface;
public:
XcbInterface();
~XcbInterface();
void SetUseOpenGl(bool use);
void onPaint(std::shared_ptr<DesktopManager> desktopManager);
void Initialize();
void InitializeOpenGl();
void CreateOpenGlDrawable(WindowPtr window);
void Loop(std::shared_ptr<DesktopManager> desktopManager);
void LoopOpenGl(std::shared_ptr<DesktopManager> desktopManager);
void ShutDown();
void AddWindow(WindowPtr window);
void ShowWindow(WindowPtr window);
void PaintWindow(WindowPtr window);
void ClearWindow(WindowPtr window);
private:
void Connect();
void UpdateScreen();
uint32_t GetEventMask();
void OnKeyPress(xcb_key_press_event_t* event, DesktopManagerPtr);
void OnKeyRelease(xcb_key_press_event_t* event, DesktopManagerPtr);
void OnButtonPress(xcb_button_press_event_t* event, DesktopManagerPtr);
void MapWindow(WindowPtr window);
void CreateGraphicsContext();
};