Fix linux compilation.

This commit is contained in:
James Grogan 2023-01-23 10:08:29 +00:00
parent ec57e3b534
commit 990cde402b
28 changed files with 245 additions and 161 deletions

View file

@ -23,6 +23,11 @@ ImageEditorView::ImageEditorView()
addWidget(std::move(hSpacer)); addWidget(std::move(hSpacer));
} }
ImageEditorView::~ImageEditorView()
{
}
std::unique_ptr<ImageEditorView> ImageEditorView::Create() std::unique_ptr<ImageEditorView> ImageEditorView::Create()
{ {
return std::make_unique<ImageEditorView>(); return std::make_unique<ImageEditorView>();

View file

@ -8,6 +8,8 @@ public:
ImageEditorView(); ImageEditorView();
virtual ~ImageEditorView();
static std::unique_ptr<ImageEditorView> Create(); static std::unique_ptr<ImageEditorView> Create();
}; };

View file

@ -11,6 +11,11 @@ ImageViewWidget::ImageViewWidget()
mName = "ImageViewWidget"; mName = "ImageViewWidget";
} }
ImageViewWidget::~ImageViewWidget()
{
}
void ImageViewWidget::doPaint(const PaintEvent* event) void ImageViewWidget::doPaint(const PaintEvent* event)
{ {
if (!mVisible) if (!mVisible)

View file

@ -9,6 +9,8 @@ class ImageViewWidget : public Widget
public: public:
ImageViewWidget(); ImageViewWidget();
virtual ~ImageViewWidget();
private: private:
void doPaint(const PaintEvent* event) override; void doPaint(const PaintEvent* event) override;
unsigned mNumX{5}; unsigned mNumX{5};

View file

@ -5,68 +5,73 @@
#include "LogicGateNode.h" #include "LogicGateNode.h"
ElectronicCircuitNode::ElectronicCircuitNode(const Transform& transform) ElectronicCircuitNode::ElectronicCircuitNode(const Transform& transform)
: AbstractVisualNode(transform) : AbstractVisualNode(transform)
{
}
ElectronicCircuitNode::~ElectronicCircuitNode()
{ {
} }
void ElectronicCircuitNode::setContent(ElectronicCircuit* content) void ElectronicCircuitNode::setContent(ElectronicCircuit* content)
{ {
mContent = content; mContent = content;
mContentDirty = true; mContentDirty = true;
} }
void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo* sceneInfo) void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
{ {
mInputTerminalNodes.clear(); mInputTerminalNodes.clear();
mWireNodes.clear(); mWireNodes.clear();
mLogicGateNodes.clear(); mLogicGateNodes.clear();
// Layout terminals // Layout terminals
double terminal_vertical_spacing = 100; double terminal_vertical_spacing = 100;
double terminal_left_margin = 10; double terminal_left_margin = 10;
double terminal_y = 0; double terminal_y = 0;
for (auto terminal : mContent->getInputTerminals()) for (auto terminal : mContent->getInputTerminals())
{ {
Point loc{ terminal_left_margin, terminal_y }; Point loc{ terminal_left_margin, terminal_y };
auto terminal_node = std::make_unique<TerminalNode>(Transform(loc)); auto terminal_node = std::make_unique<TerminalNode>(Transform(loc));
terminal_node->setContent(terminal); terminal_node->setContent(terminal);
addChild(terminal_node.get()); addChild(terminal_node.get());
mInputTerminalNodes.push_back(std::move(terminal_node)); mInputTerminalNodes.push_back(std::move(terminal_node));
terminal_y += terminal_vertical_spacing; terminal_y += terminal_vertical_spacing;
} }
// Layout logic gates // Layout logic gates
double logic_gate_vertical_spacing = 100; double logic_gate_vertical_spacing = 100;
double logic_gate_horizontal_spacing = 100; double logic_gate_horizontal_spacing = 100;
double gate_x = logic_gate_vertical_spacing; double gate_x = logic_gate_vertical_spacing;
double gate_y = 0; double gate_y = 0;
for (auto gate : mContent->getLogicGates()) for (auto gate : mContent->getLogicGates())
{ {
Point loc{ gate_x, gate_y }; Point loc{ gate_x, gate_y };
auto gate_node = std::make_unique<LogicGateNode>(Transform(loc)); auto gate_node = std::make_unique<LogicGateNode>(Transform(loc));
gate_node->setContent(gate); gate_node->setContent(gate);
addChild(gate_node.get()); addChild(gate_node.get());
mLogicGateNodes.push_back(std::move(gate_node)); mLogicGateNodes.push_back(std::move(gate_node));
gate_x += logic_gate_vertical_spacing; gate_x += logic_gate_vertical_spacing;
gate_y += logic_gate_horizontal_spacing; gate_y += logic_gate_horizontal_spacing;
} }
} }
void ElectronicCircuitNode::update(SceneInfo* sceneInfo) void ElectronicCircuitNode::update(SceneInfo* sceneInfo)
{ {
if (mContentDirty) if (mContentDirty)
{ {
createOrUpdateGeometry(sceneInfo); createOrUpdateGeometry(sceneInfo);
mContentDirty = false; mContentDirty = false;
} }
} }

View file

@ -11,19 +11,21 @@ class LogicGateNode;
class ElectronicCircuitNode : public AbstractVisualNode class ElectronicCircuitNode : public AbstractVisualNode
{ {
public: public:
ElectronicCircuitNode(const Transform& transform); ElectronicCircuitNode(const Transform& transform);
void setContent(ElectronicCircuit* content); virtual ~ElectronicCircuitNode();
void update(SceneInfo* sceneInfo); void setContent(ElectronicCircuit* content);
void update(SceneInfo* sceneInfo);
private: private:
void createOrUpdateGeometry(SceneInfo* sceneInfo); void createOrUpdateGeometry(SceneInfo* sceneInfo);
ElectronicCircuit* mContent{ nullptr }; ElectronicCircuit* mContent{ nullptr };
bool mContentDirty{ true }; bool mContentDirty{ true };
std::vector<std::unique_ptr<TerminalNode> > mInputTerminalNodes; std::vector<std::unique_ptr<TerminalNode> > mInputTerminalNodes;
std::vector<std::unique_ptr<WireNode> > mWireNodes; std::vector<std::unique_ptr<WireNode> > mWireNodes;
std::vector<std::unique_ptr<LogicGateNode> > mLogicGateNodes; std::vector<std::unique_ptr<LogicGateNode> > mLogicGateNodes;
}; };

View file

@ -8,42 +8,47 @@
#include "LogicGatePrimitiveShapes.h" #include "LogicGatePrimitiveShapes.h"
LogicGateNode::LogicGateNode(const Transform& transform) LogicGateNode::LogicGateNode(const Transform& transform)
: AbstractVisualNode(transform) : AbstractVisualNode(transform)
{
}
LogicGateNode::~LogicGateNode()
{ {
} }
void LogicGateNode::setContent(LogicGate* content) void LogicGateNode::setContent(LogicGate* content)
{ {
mContent = content; mContent = content;
mContentDirty = true; mContentDirty = true;
} }
void LogicGateNode::update(SceneInfo* sceneInfo) void LogicGateNode::update(SceneInfo* sceneInfo)
{ {
if (mContentDirty) if (mContentDirty)
{ {
createOrUpdateGeometry(sceneInfo); createOrUpdateGeometry(sceneInfo);
mContentDirty = false; mContentDirty = false;
} }
} }
void LogicGateNode::createOrUpdateGeometry(SceneInfo* sceneInfo) void LogicGateNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
{ {
if (!mPrimaryPath) if (!mPrimaryPath)
{ {
if (mContent->getGateType() == LogicGate::GateType::AND) if (mContent->getGateType() == LogicGate::GateType::AND)
{ {
mPrimaryPath = std::make_unique<PathNode>(Transform(), LogicGatePrimitiveShapes::getAndGateShape()); mPrimaryPath = std::make_unique<PathNode>(Transform(), LogicGatePrimitiveShapes::getAndGateShape());
} }
else if (mContent->getGateType() == LogicGate::GateType::OR) else if (mContent->getGateType() == LogicGate::GateType::OR)
{ {
mPrimaryPath = std::make_unique<PathNode>(Transform(), LogicGatePrimitiveShapes::getOrGateShape()); mPrimaryPath = std::make_unique<PathNode>(Transform(), LogicGatePrimitiveShapes::getOrGateShape());
} }
if (mPrimaryPath) if (mPrimaryPath)
{ {
addChild(mPrimaryPath.get()); addChild(mPrimaryPath.get());
} }
} }
} }

View file

@ -2,24 +2,27 @@
#include "AbstractVisualNode.h" #include "AbstractVisualNode.h"
#include "CircleNode.h"
class LogicGate; class LogicGate;
class PathNode; class PathNode;
class CircleNode;
class LogicGateNode : public AbstractVisualNode class LogicGateNode : public AbstractVisualNode
{ {
public: public:
LogicGateNode(const Transform& transform); LogicGateNode(const Transform& transform);
void setContent(LogicGate* content); virtual ~LogicGateNode();
void update(SceneInfo* sceneInfo); void setContent(LogicGate* content);
void update(SceneInfo* sceneInfo);
private: private:
void createOrUpdateGeometry(SceneInfo* sceneInfo); void createOrUpdateGeometry(SceneInfo* sceneInfo);
LogicGate* mContent{ nullptr }; LogicGate* mContent{ nullptr };
bool mContentDirty{ true }; bool mContentDirty{ true };
std::unique_ptr<PathNode> mPrimaryPath; std::unique_ptr<PathNode> mPrimaryPath;
std::unique_ptr<CircleNode> mNegationGlyph; std::unique_ptr<CircleNode> mNegationGlyph;
}; };

View file

@ -5,6 +5,11 @@ void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const
} }
AbstractMesh::~AbstractMesh()
{
}
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag) std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag)
{ {
std::vector<std::vector<double> > attribs(mNodes.size()); std::vector<std::vector<double> > attribs(mNodes.size());

View file

@ -20,7 +20,7 @@ public:
QUAD QUAD
}; };
virtual ~AbstractMesh() = default; virtual ~AbstractMesh();
void addVectorAttribute(const std::string& tag, const std::vector<double>& values); void addVectorAttribute(const std::string& tag, const std::vector<double>& values);

View file

@ -14,6 +14,11 @@ CircleNode::CircleNode(const Transform& transform, double radius)
mMinorRadius = mRadius; mMinorRadius = mRadius;
} }
CircleNode::~CircleNode()
{
}
CircleNode::Type CircleNode::getType() CircleNode::Type CircleNode::getType()
{ {
return Type::Circle; return Type::Circle;

View file

@ -10,6 +10,8 @@ class CircleNode : public GeometryNode
public: public:
CircleNode(const Transform& transform, double radius); CircleNode(const Transform& transform, double radius);
virtual ~CircleNode();
Type getType() override; Type getType() override;
double getRadius() const; double getRadius() const;

View file

@ -9,6 +9,11 @@ GridNode::GridNode(const Transform& transform)
} }
GridNode::~GridNode()
{
}
void GridNode::setNumX(std::size_t numX) void GridNode::setNumX(std::size_t numX)
{ {
if (mNumberX != numX) if (mNumberX != numX)

View file

@ -10,6 +10,8 @@ class GridNode : public MaterialNode
public: public:
GridNode(const Transform& transform); GridNode(const Transform& transform);
virtual ~GridNode();
void setNumX(std::size_t numX); void setNumX(std::size_t numX);
void setNumY(std::size_t numY); void setNumY(std::size_t numY);

View file

@ -8,6 +8,11 @@ MaterialNode::MaterialNode(const Transform& transform)
} }
MaterialNode::~MaterialNode()
{
}
const Color& MaterialNode::getFillColor() const const Color& MaterialNode::getFillColor() const
{ {
return mFillColor; return mFillColor;

View file

@ -8,6 +8,7 @@ class MaterialNode : public AbstractVisualNode
{ {
public: public:
MaterialNode(const Transform& transform); MaterialNode(const Transform& transform);
virtual ~MaterialNode();
const Color& getFillColor() const; const Color& getFillColor() const;
const Color& getStrokeColor() const; const Color& getStrokeColor() const;

View file

@ -9,6 +9,28 @@ MeshNode::MeshNode(const Transform& transform)
} }
MeshNode::~MeshNode()
{
}
SceneItem* MeshNode::getSceneItem(std::size_t idx) const
{
return mModel.get();
}
std::size_t MeshNode::getNumSceneItems() const
{
if (mWorkingMesh)
{
return 1;
}
else
{
return 0;
}
}
void MeshNode::setWidth(double width) void MeshNode::setWidth(double width)
{ {
if (mWidth != width) if (mWidth != width)
@ -33,23 +55,6 @@ void MeshNode::setMesh(AbstractMesh* mesh)
mMeshIsDirty = true; mMeshIsDirty = true;
} }
SceneItem* MeshNode::getSceneItem(std::size_t idx) const
{
return mModel.get();
}
std::size_t MeshNode::getNumSceneItems() const
{
if (mWorkingMesh)
{
return 1;
}
else
{
return 0;
}
}
void MeshNode::update(SceneInfo* sceneInfo) void MeshNode::update(SceneInfo* sceneInfo)
{ {
if (!mModel || mMeshIsDirty) if (!mModel || mMeshIsDirty)

View file

@ -9,6 +9,8 @@ class MeshNode : public MaterialNode
{ {
public: public:
MeshNode(const Transform& transform); MeshNode(const Transform& transform);
virtual ~MeshNode();
void setMesh(AbstractMesh* mesh); void setMesh(AbstractMesh* mesh);
SceneItem* getSceneItem(std::size_t idx) const override; SceneItem* getSceneItem(std::size_t idx) const override;

View file

@ -5,6 +5,11 @@ SceneItem::SceneItem()
} }
SceneItem::~SceneItem()
{
}
const Color& SceneItem::getFillColor() const const Color& SceneItem::getFillColor() const
{ {
return mFillColor; return mFillColor;
@ -20,6 +25,11 @@ const Transform& SceneItem::getTransform() const
return mTransform; return mTransform;
} }
const std::string& SceneItem::getName() const
{
return mName;
}
double SceneItem::getOutlineThickness() const double SceneItem::getOutlineThickness() const
{ {
return mOutlineThickness; return mOutlineThickness;
@ -78,3 +88,8 @@ void SceneItem::updateTransform(const Transform& transform)
mTransform = transform; mTransform = transform;
} }
} }
void SceneItem::setName(const std::string& name)
{
mName = name;
}

View file

@ -18,7 +18,7 @@ public:
SceneItem(); SceneItem();
virtual ~SceneItem() = default; virtual ~SceneItem();
const Color& getFillColor() const; const Color& getFillColor() const;
@ -30,6 +30,8 @@ public:
double getOutlineThickness() const; double getOutlineThickness() const;
const std::string& getName() const;
bool hasFillColor() const; bool hasFillColor() const;
bool hasOutlineColor() const; bool hasOutlineColor() const;
@ -44,18 +46,10 @@ public:
void setFillColor(const Color& color); void setFillColor(const Color& color);
void setName(const std::string& name);
void updateTransform(const Transform& transform); void updateTransform(const Transform& transform);
void setName(const std::string& name)
{
mName = name;
}
const std::string& getName() const
{
return mName;
}
protected: protected:
Transform mTransform; Transform mTransform;

View file

@ -10,6 +10,11 @@ SceneModel::SceneModel(std::unique_ptr<AbstractMesh> mesh)
} }
SceneModel::~SceneModel()
{
}
SceneModel::SceneModel(std::unique_ptr<AbstractGeometricItem> geometry) SceneModel::SceneModel(std::unique_ptr<AbstractGeometricItem> geometry)
: SceneItem(), : SceneItem(),
mGeometry(std::move(geometry)) mGeometry(std::move(geometry))

View file

@ -15,6 +15,8 @@ class SceneModel : public SceneItem
{ {
public: public:
SceneModel() = default; SceneModel() = default;
virtual ~SceneModel();
explicit SceneModel(std::unique_ptr<AbstractMesh> mesh); explicit SceneModel(std::unique_ptr<AbstractMesh> mesh);
explicit SceneModel(std::unique_ptr<AbstractGeometricItem> geometry); explicit SceneModel(std::unique_ptr<AbstractGeometricItem> geometry);

View file

@ -1,10 +1,15 @@
#include "BoxGeometry.h" #include "BoxGeometry.h"
BoxGeometry::BoxGeometry() BoxGeometry::BoxGeometry()
: mLocation(DiscretePoint(0, 0)), : mLocation(DiscretePoint(0, 0)),
mSize({ 100, 0, 0, 100, 0, 0 }), mSize({ 100, 0, 0, 100, 0, 0 }),
mPadding(), mPadding(),
mMargin() mMargin()
{
}
BoxGeometry::~BoxGeometry()
{ {
} }
@ -12,40 +17,40 @@ BoxGeometry::BoxGeometry()
BoundedSize BoxGeometry::getSize() const BoundedSize BoxGeometry::getSize() const
{ {
return mSize; return mSize;
} }
const DiscretePoint& BoxGeometry::getLocation() const const DiscretePoint& BoxGeometry::getLocation() const
{ {
return mLocation; return mLocation;
} }
void BoxGeometry::setSize(const BoundedSize& size) void BoxGeometry::setSize(const BoundedSize& size)
{ {
if (size != mSize) if (size != mSize)
{ {
mSize = size; mSize = size;
mTransformDirty = true; mTransformDirty = true;
} }
} }
void BoxGeometry::setMargin(unsigned margin) void BoxGeometry::setMargin(unsigned margin)
{ {
setMargin({ margin, margin, margin, margin }); setMargin({ margin, margin, margin, margin });
} }
void BoxGeometry::setMargin(const BoundaryOffset& margin) void BoxGeometry::setMargin(const BoundaryOffset& margin)
{ {
if (margin != mMargin) if (margin != mMargin)
{ {
mMargin = margin; mMargin = margin;
mTransformDirty = true; mTransformDirty = true;
} }
} }
void BoxGeometry::setPadding(unsigned padding) void BoxGeometry::setPadding(unsigned padding)
{ {
setPadding({ padding, padding, padding, padding }); setPadding({ padding, padding, padding, padding });
} }
void BoxGeometry::setPadding(const BoundaryOffset& padding) void BoxGeometry::setPadding(const BoundaryOffset& padding)

View file

@ -51,7 +51,7 @@ class BoxGeometry
public: public:
BoxGeometry(); BoxGeometry();
virtual ~BoxGeometry() = default; virtual ~BoxGeometry();
bool contains(const DiscretePoint& loc) const; bool contains(const DiscretePoint& loc) const;
@ -88,4 +88,4 @@ protected:
BoundaryOffset mMargin; BoundaryOffset mMargin;
bool mTransformDirty{ true }; bool mTransformDirty{ true };
}; };

View file

@ -13,7 +13,7 @@ std::unique_ptr<XcbEventInterface> XcbEventInterface::Create()
return std::make_unique<XcbEventInterface>(); return std::make_unique<XcbEventInterface>();
} }
std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const std::unique_ptr<KeyboardEvent> XcbEventInterface::convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const
{ {
auto ui_event = KeyboardEvent::Create(); auto ui_event = KeyboardEvent::Create();
ui_event->setAction(KeyboardEvent::Action::Pressed); ui_event->setAction(KeyboardEvent::Action::Pressed);
@ -29,7 +29,7 @@ std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyPress(xcb_key_press_
return ui_event; return ui_event;
} }
std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const std::unique_ptr<KeyboardEvent> XcbEventInterface::convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const
{ {
auto ui_event = KeyboardEvent::Create(); auto ui_event = KeyboardEvent::Create();
ui_event->setAction(KeyboardEvent::Action::Released); ui_event->setAction(KeyboardEvent::Action::Released);
@ -45,31 +45,31 @@ std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyRelease(xcb_key_pres
return ui_event; return ui_event;
} }
std::unique_ptr<MouseEvent> XcbEventInterface::ConvertButtonPress(xcb_button_press_event_t* event) const std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonPress(xcb_button_press_event_t* event) const
{ {
auto ui_event = MouseEvent::Create(); auto ui_event = MouseEvent::Create();
auto x = static_cast<unsigned>(event->event_x); auto x = static_cast<unsigned>(event->event_x);
auto y = static_cast<unsigned>(event->event_y); auto y = static_cast<unsigned>(event->event_y);
ui_event->SetClientLocation(DiscretePoint(x, y)); ui_event->setClientLocation(DiscretePoint(x, y));
auto screen_x = static_cast<unsigned>(event->root_x); auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y); auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->SetScreenLocation(DiscretePoint(x, y)); ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->SetAction(MouseEvent::Action::Pressed); ui_event->setAction(MouseEvent::Action::Pressed);
return ui_event; return ui_event;
} }
std::unique_ptr<MouseEvent> XcbEventInterface::ConvertButtonRelease(xcb_button_press_event_t* event) const std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonRelease(xcb_button_press_event_t* event) const
{ {
auto ui_event = MouseEvent::Create(); auto ui_event = MouseEvent::Create();
auto x = static_cast<unsigned>(event->event_x); auto x = static_cast<unsigned>(event->event_x);
auto y = static_cast<unsigned>(event->event_y); auto y = static_cast<unsigned>(event->event_y);
ui_event->SetClientLocation(DiscretePoint(x, y)); ui_event->setClientLocation(DiscretePoint(x, y));
auto screen_x = static_cast<unsigned>(event->root_x); auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y); auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->SetScreenLocation(DiscretePoint(x, y)); ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->SetAction(MouseEvent::Action::Released); ui_event->setAction(MouseEvent::Action::Released);
return ui_event; return ui_event;
} }

View file

@ -13,16 +13,15 @@ struct xcb_button_press_event_t;
class XcbEventInterface class XcbEventInterface
{ {
public: public:
static std::unique_ptr<XcbEventInterface> Create(); static std::unique_ptr<XcbEventInterface> Create();
std::unique_ptr<KeyboardEvent> ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const; std::unique_ptr<KeyboardEvent> convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const;
std::unique_ptr<KeyboardEvent> ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const; std::unique_ptr<KeyboardEvent> convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const;
std::unique_ptr<MouseEvent> ConvertButtonPress(xcb_button_press_event_t* event) const; std::unique_ptr<MouseEvent> convertButtonPress(xcb_button_press_event_t* event) const;
std::unique_ptr<MouseEvent> ConvertButtonRelease(xcb_button_press_event_t* event) const; std::unique_ptr<MouseEvent> convertButtonRelease(xcb_button_press_event_t* event) const;
}; };
using XcbEventInterfacePtr = std::unique_ptr<XcbEventInterface>; using XcbEventInterfacePtr = std::unique_ptr<XcbEventInterface>;

View file

@ -182,7 +182,7 @@ void XcbInterface::addWindow(mt::Window* window)
void XcbInterface::onPaint() void XcbInterface::onPaint()
{ {
mDesktopManager->onUiEvent(PaintEvent::Create()); mDesktopManager->onUiEvent(PaintEvent::Create(mDesktopManager->getThemeManager(), mDesktopManager->getFontsManager()));
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow(); auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
auto defaultScreen = mDesktopManager->getDefaultScreen(); auto defaultScreen = mDesktopManager->getDefaultScreen();
@ -215,25 +215,25 @@ void XcbInterface::loop()
} }
case XCB_KEY_PRESS: { case XCB_KEY_PRESS: {
auto kp = reinterpret_cast<xcb_key_press_event_t*>(event); auto kp = reinterpret_cast<xcb_key_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyPress(kp, mDesktopManager->getKeyboard()); auto ui_event = mEventInterface->convertKeyPress(kp, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_KEY_RELEASE: { case XCB_KEY_RELEASE: {
auto kr = reinterpret_cast<xcb_key_release_event_t*>(event); auto kr = reinterpret_cast<xcb_key_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyRelease(kr, mDesktopManager->getKeyboard()); auto ui_event = mEventInterface->convertKeyRelease(kr, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_BUTTON_PRESS: { case XCB_BUTTON_PRESS: {
auto press = reinterpret_cast<xcb_button_press_event_t*>(event); auto press = reinterpret_cast<xcb_button_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonPress(press); auto ui_event = mEventInterface->convertButtonPress(press);
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_BUTTON_RELEASE: { case XCB_BUTTON_RELEASE: {
auto release = reinterpret_cast<xcb_button_release_event_t*>(event); auto release = reinterpret_cast<xcb_button_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonRelease(release); auto ui_event = mEventInterface->convertButtonRelease(release);
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }

View file

@ -38,20 +38,23 @@ public:
void showWindow(mt::Window* window) override; void showWindow(mt::Window* window) override;
private: private:
void initialize() override;
void onPaint();
void onExposeEvent(xcb_expose_event_t* event);
void initializeHardwareRendering() override;
void createGraphicsContext(); void createGraphicsContext();
void connect(); void connect();
void updateScreen();
uint32_t getEventMask();
void initialize() override;
void initializeHardwareRendering() override;
void onPaint();
void onExposeEvent(xcb_expose_event_t* event);
void mapWindow(mt::Window* window); void mapWindow(mt::Window* window);
void shutDown() override; void shutDown() override;
uint32_t getEventMask();
void updateScreen();
private: private:
xcb_connection_t* mConnection{nullptr}; xcb_connection_t* mConnection{nullptr};
_XDisplay* mX11Display{nullptr}; _XDisplay* mX11Display{nullptr};