From 990cde402b5d83ed06b84fa032fca01328588f0f Mon Sep 17 00:00:00 2001 From: James Grogan Date: Mon, 23 Jan 2023 10:08:29 +0000 Subject: [PATCH] Fix linux compilation. --- .../notes_tk/image_editor/ImageEditorView.cpp | 5 ++ apps/notes_tk/image_editor/ImageEditorView.h | 2 + .../notes_tk/image_editor/ImageViewWidget.cpp | 5 ++ apps/notes_tk/image_editor/ImageViewWidget.h | 2 + .../src/visuals/ElectronicCircuitNode.cpp | 85 ++++++++++--------- .../src/visuals/ElectronicCircuitNode.h | 22 ++--- .../circuits/src/visuals/LogicGateNode.cpp | 55 ++++++------ plugins/circuits/src/visuals/LogicGateNode.h | 23 ++--- src/rendering/mesh/AbstractMesh.cpp | 5 ++ src/rendering/mesh/AbstractMesh.h | 2 +- .../basic_shapes/CircleNode.cpp | 5 ++ .../visual_elements/basic_shapes/CircleNode.h | 2 + .../visual_elements/nodes/GridNode.cpp | 5 ++ .../visual_elements/nodes/GridNode.h | 2 + .../visual_elements/nodes/MaterialNode.cpp | 5 ++ .../visual_elements/nodes/MaterialNode.h | 1 + .../visual_elements/nodes/MeshNode.cpp | 39 +++++---- .../visual_elements/nodes/MeshNode.h | 2 + .../visual_elements/scene/SceneItem.cpp | 15 ++++ .../visual_elements/scene/SceneItem.h | 16 ++-- .../visual_elements/scene/SceneModel.cpp | 5 ++ .../visual_elements/scene/SceneModel.h | 2 + src/ui/ui_elements/widgets/BoxGeometry.cpp | 41 +++++---- src/ui/ui_elements/widgets/BoxGeometry.h | 4 +- .../ui_interfaces/x11/XcbEventInterface.cpp | 20 ++--- .../ui_interfaces/x11/XcbEventInterface.h | 9 +- .../ui_interfaces/x11/XcbInterface.cpp | 10 +-- .../windows/ui_interfaces/x11/XcbInterface.h | 17 ++-- 28 files changed, 245 insertions(+), 161 deletions(-) diff --git a/apps/notes_tk/image_editor/ImageEditorView.cpp b/apps/notes_tk/image_editor/ImageEditorView.cpp index ca20ef0..85c04ff 100644 --- a/apps/notes_tk/image_editor/ImageEditorView.cpp +++ b/apps/notes_tk/image_editor/ImageEditorView.cpp @@ -23,6 +23,11 @@ ImageEditorView::ImageEditorView() addWidget(std::move(hSpacer)); } +ImageEditorView::~ImageEditorView() +{ + +} + std::unique_ptr ImageEditorView::Create() { return std::make_unique(); diff --git a/apps/notes_tk/image_editor/ImageEditorView.h b/apps/notes_tk/image_editor/ImageEditorView.h index 23c6fb2..070aae4 100644 --- a/apps/notes_tk/image_editor/ImageEditorView.h +++ b/apps/notes_tk/image_editor/ImageEditorView.h @@ -8,6 +8,8 @@ public: ImageEditorView(); + virtual ~ImageEditorView(); + static std::unique_ptr Create(); }; diff --git a/apps/notes_tk/image_editor/ImageViewWidget.cpp b/apps/notes_tk/image_editor/ImageViewWidget.cpp index 6e922f7..9f47275 100644 --- a/apps/notes_tk/image_editor/ImageViewWidget.cpp +++ b/apps/notes_tk/image_editor/ImageViewWidget.cpp @@ -11,6 +11,11 @@ ImageViewWidget::ImageViewWidget() mName = "ImageViewWidget"; } +ImageViewWidget::~ImageViewWidget() +{ + +} + void ImageViewWidget::doPaint(const PaintEvent* event) { if (!mVisible) diff --git a/apps/notes_tk/image_editor/ImageViewWidget.h b/apps/notes_tk/image_editor/ImageViewWidget.h index e362071..cb45b45 100644 --- a/apps/notes_tk/image_editor/ImageViewWidget.h +++ b/apps/notes_tk/image_editor/ImageViewWidget.h @@ -9,6 +9,8 @@ class ImageViewWidget : public Widget public: ImageViewWidget(); + virtual ~ImageViewWidget(); + private: void doPaint(const PaintEvent* event) override; unsigned mNumX{5}; diff --git a/plugins/circuits/src/visuals/ElectronicCircuitNode.cpp b/plugins/circuits/src/visuals/ElectronicCircuitNode.cpp index 9438c9e..1db4c1e 100644 --- a/plugins/circuits/src/visuals/ElectronicCircuitNode.cpp +++ b/plugins/circuits/src/visuals/ElectronicCircuitNode.cpp @@ -5,68 +5,73 @@ #include "LogicGateNode.h" ElectronicCircuitNode::ElectronicCircuitNode(const Transform& transform) - : AbstractVisualNode(transform) + : AbstractVisualNode(transform) +{ + +} + +ElectronicCircuitNode::~ElectronicCircuitNode() { } void ElectronicCircuitNode::setContent(ElectronicCircuit* content) { - mContent = content; - mContentDirty = true; + mContent = content; + mContentDirty = true; } void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo* sceneInfo) { - mInputTerminalNodes.clear(); - mWireNodes.clear(); - mLogicGateNodes.clear(); + mInputTerminalNodes.clear(); + mWireNodes.clear(); + mLogicGateNodes.clear(); - // Layout terminals - double terminal_vertical_spacing = 100; - double terminal_left_margin = 10; + // Layout terminals + double terminal_vertical_spacing = 100; + double terminal_left_margin = 10; - double terminal_y = 0; - for (auto terminal : mContent->getInputTerminals()) - { - Point loc{ terminal_left_margin, terminal_y }; - auto terminal_node = std::make_unique(Transform(loc)); + double terminal_y = 0; + for (auto terminal : mContent->getInputTerminals()) + { + Point loc{ terminal_left_margin, terminal_y }; + auto terminal_node = std::make_unique(Transform(loc)); - terminal_node->setContent(terminal); + terminal_node->setContent(terminal); - addChild(terminal_node.get()); - mInputTerminalNodes.push_back(std::move(terminal_node)); + addChild(terminal_node.get()); + mInputTerminalNodes.push_back(std::move(terminal_node)); - terminal_y += terminal_vertical_spacing; - } + terminal_y += terminal_vertical_spacing; + } - // Layout logic gates - double logic_gate_vertical_spacing = 100; - double logic_gate_horizontal_spacing = 100; + // Layout logic gates + double logic_gate_vertical_spacing = 100; + double logic_gate_horizontal_spacing = 100; - double gate_x = logic_gate_vertical_spacing; - double gate_y = 0; - for (auto gate : mContent->getLogicGates()) - { - Point loc{ gate_x, gate_y }; - auto gate_node = std::make_unique(Transform(loc)); + double gate_x = logic_gate_vertical_spacing; + double gate_y = 0; + for (auto gate : mContent->getLogicGates()) + { + Point loc{ gate_x, gate_y }; + auto gate_node = std::make_unique(Transform(loc)); - gate_node->setContent(gate); + gate_node->setContent(gate); - addChild(gate_node.get()); - mLogicGateNodes.push_back(std::move(gate_node)); + addChild(gate_node.get()); + mLogicGateNodes.push_back(std::move(gate_node)); - gate_x += logic_gate_vertical_spacing; - gate_y += logic_gate_horizontal_spacing; - } + gate_x += logic_gate_vertical_spacing; + gate_y += logic_gate_horizontal_spacing; + } } void ElectronicCircuitNode::update(SceneInfo* sceneInfo) { - if (mContentDirty) - { - createOrUpdateGeometry(sceneInfo); - mContentDirty = false; - } -} \ No newline at end of file + if (mContentDirty) + { + createOrUpdateGeometry(sceneInfo); + mContentDirty = false; + } +} diff --git a/plugins/circuits/src/visuals/ElectronicCircuitNode.h b/plugins/circuits/src/visuals/ElectronicCircuitNode.h index 94e4d75..050359c 100644 --- a/plugins/circuits/src/visuals/ElectronicCircuitNode.h +++ b/plugins/circuits/src/visuals/ElectronicCircuitNode.h @@ -11,19 +11,21 @@ class LogicGateNode; class ElectronicCircuitNode : public AbstractVisualNode { 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: - void createOrUpdateGeometry(SceneInfo* sceneInfo); + void createOrUpdateGeometry(SceneInfo* sceneInfo); - ElectronicCircuit* mContent{ nullptr }; - bool mContentDirty{ true }; + ElectronicCircuit* mContent{ nullptr }; + bool mContentDirty{ true }; - std::vector > mInputTerminalNodes; - std::vector > mWireNodes; - std::vector > mLogicGateNodes; -}; \ No newline at end of file + std::vector > mInputTerminalNodes; + std::vector > mWireNodes; + std::vector > mLogicGateNodes; +}; diff --git a/plugins/circuits/src/visuals/LogicGateNode.cpp b/plugins/circuits/src/visuals/LogicGateNode.cpp index db443ad..9915cad 100644 --- a/plugins/circuits/src/visuals/LogicGateNode.cpp +++ b/plugins/circuits/src/visuals/LogicGateNode.cpp @@ -8,42 +8,47 @@ #include "LogicGatePrimitiveShapes.h" LogicGateNode::LogicGateNode(const Transform& transform) - : AbstractVisualNode(transform) + : AbstractVisualNode(transform) +{ + +} + +LogicGateNode::~LogicGateNode() { } void LogicGateNode::setContent(LogicGate* content) { - mContent = content; - mContentDirty = true; + mContent = content; + mContentDirty = true; } void LogicGateNode::update(SceneInfo* sceneInfo) { - if (mContentDirty) - { - createOrUpdateGeometry(sceneInfo); - mContentDirty = false; - } + if (mContentDirty) + { + createOrUpdateGeometry(sceneInfo); + mContentDirty = false; + } } void LogicGateNode::createOrUpdateGeometry(SceneInfo* sceneInfo) { - if (!mPrimaryPath) - { - if (mContent->getGateType() == LogicGate::GateType::AND) - { - mPrimaryPath = std::make_unique(Transform(), LogicGatePrimitiveShapes::getAndGateShape()); - } - else if (mContent->getGateType() == LogicGate::GateType::OR) - { - mPrimaryPath = std::make_unique(Transform(), LogicGatePrimitiveShapes::getOrGateShape()); - } - - if (mPrimaryPath) - { - addChild(mPrimaryPath.get()); - } - } -} \ No newline at end of file + if (!mPrimaryPath) + { + if (mContent->getGateType() == LogicGate::GateType::AND) + { + mPrimaryPath = std::make_unique(Transform(), LogicGatePrimitiveShapes::getAndGateShape()); + } + else if (mContent->getGateType() == LogicGate::GateType::OR) + { + mPrimaryPath = std::make_unique(Transform(), LogicGatePrimitiveShapes::getOrGateShape()); + } + + if (mPrimaryPath) + { + addChild(mPrimaryPath.get()); + } + } +} diff --git a/plugins/circuits/src/visuals/LogicGateNode.h b/plugins/circuits/src/visuals/LogicGateNode.h index b4d2ccf..ae0e643 100644 --- a/plugins/circuits/src/visuals/LogicGateNode.h +++ b/plugins/circuits/src/visuals/LogicGateNode.h @@ -2,24 +2,27 @@ #include "AbstractVisualNode.h" +#include "CircleNode.h" + class LogicGate; class PathNode; -class CircleNode; class LogicGateNode : public AbstractVisualNode { 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: - void createOrUpdateGeometry(SceneInfo* sceneInfo); + void createOrUpdateGeometry(SceneInfo* sceneInfo); - LogicGate* mContent{ nullptr }; - bool mContentDirty{ true }; + LogicGate* mContent{ nullptr }; + bool mContentDirty{ true }; - std::unique_ptr mPrimaryPath; - std::unique_ptr mNegationGlyph; -}; \ No newline at end of file + std::unique_ptr mPrimaryPath; + std::unique_ptr mNegationGlyph; +}; diff --git a/src/rendering/mesh/AbstractMesh.cpp b/src/rendering/mesh/AbstractMesh.cpp index 0918906..8924cdc 100644 --- a/src/rendering/mesh/AbstractMesh.cpp +++ b/src/rendering/mesh/AbstractMesh.cpp @@ -5,6 +5,11 @@ void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const } +AbstractMesh::~AbstractMesh() +{ + +} + std::vector > AbstractMesh::getNodeVectorAttributes(const std::string& tag) { std::vector > attribs(mNodes.size()); diff --git a/src/rendering/mesh/AbstractMesh.h b/src/rendering/mesh/AbstractMesh.h index be8a22e..cac717f 100644 --- a/src/rendering/mesh/AbstractMesh.h +++ b/src/rendering/mesh/AbstractMesh.h @@ -20,7 +20,7 @@ public: QUAD }; - virtual ~AbstractMesh() = default; + virtual ~AbstractMesh(); void addVectorAttribute(const std::string& tag, const std::vector& values); diff --git a/src/rendering/visual_elements/basic_shapes/CircleNode.cpp b/src/rendering/visual_elements/basic_shapes/CircleNode.cpp index 7bc4c96..1433075 100644 --- a/src/rendering/visual_elements/basic_shapes/CircleNode.cpp +++ b/src/rendering/visual_elements/basic_shapes/CircleNode.cpp @@ -14,6 +14,11 @@ CircleNode::CircleNode(const Transform& transform, double radius) mMinorRadius = mRadius; } +CircleNode::~CircleNode() +{ + +} + CircleNode::Type CircleNode::getType() { return Type::Circle; diff --git a/src/rendering/visual_elements/basic_shapes/CircleNode.h b/src/rendering/visual_elements/basic_shapes/CircleNode.h index 6f8dfea..1d1362f 100644 --- a/src/rendering/visual_elements/basic_shapes/CircleNode.h +++ b/src/rendering/visual_elements/basic_shapes/CircleNode.h @@ -10,6 +10,8 @@ class CircleNode : public GeometryNode public: CircleNode(const Transform& transform, double radius); + virtual ~CircleNode(); + Type getType() override; double getRadius() const; diff --git a/src/rendering/visual_elements/nodes/GridNode.cpp b/src/rendering/visual_elements/nodes/GridNode.cpp index 417d677..cb3b69f 100644 --- a/src/rendering/visual_elements/nodes/GridNode.cpp +++ b/src/rendering/visual_elements/nodes/GridNode.cpp @@ -9,6 +9,11 @@ GridNode::GridNode(const Transform& transform) } +GridNode::~GridNode() +{ + +} + void GridNode::setNumX(std::size_t numX) { if (mNumberX != numX) diff --git a/src/rendering/visual_elements/nodes/GridNode.h b/src/rendering/visual_elements/nodes/GridNode.h index fcd9995..6261fde 100644 --- a/src/rendering/visual_elements/nodes/GridNode.h +++ b/src/rendering/visual_elements/nodes/GridNode.h @@ -10,6 +10,8 @@ class GridNode : public MaterialNode public: GridNode(const Transform& transform); + virtual ~GridNode(); + void setNumX(std::size_t numX); void setNumY(std::size_t numY); diff --git a/src/rendering/visual_elements/nodes/MaterialNode.cpp b/src/rendering/visual_elements/nodes/MaterialNode.cpp index 6aaecd1..d665821 100644 --- a/src/rendering/visual_elements/nodes/MaterialNode.cpp +++ b/src/rendering/visual_elements/nodes/MaterialNode.cpp @@ -8,6 +8,11 @@ MaterialNode::MaterialNode(const Transform& transform) } +MaterialNode::~MaterialNode() +{ + +} + const Color& MaterialNode::getFillColor() const { return mFillColor; diff --git a/src/rendering/visual_elements/nodes/MaterialNode.h b/src/rendering/visual_elements/nodes/MaterialNode.h index 953cbe4..894062e 100644 --- a/src/rendering/visual_elements/nodes/MaterialNode.h +++ b/src/rendering/visual_elements/nodes/MaterialNode.h @@ -8,6 +8,7 @@ class MaterialNode : public AbstractVisualNode { public: MaterialNode(const Transform& transform); + virtual ~MaterialNode(); const Color& getFillColor() const; const Color& getStrokeColor() const; diff --git a/src/rendering/visual_elements/nodes/MeshNode.cpp b/src/rendering/visual_elements/nodes/MeshNode.cpp index cb540b9..3b16454 100644 --- a/src/rendering/visual_elements/nodes/MeshNode.cpp +++ b/src/rendering/visual_elements/nodes/MeshNode.cpp @@ -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) { if (mWidth != width) @@ -33,23 +55,6 @@ void MeshNode::setMesh(AbstractMesh* mesh) 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) { if (!mModel || mMeshIsDirty) diff --git a/src/rendering/visual_elements/nodes/MeshNode.h b/src/rendering/visual_elements/nodes/MeshNode.h index 6f8096e..f4755c4 100644 --- a/src/rendering/visual_elements/nodes/MeshNode.h +++ b/src/rendering/visual_elements/nodes/MeshNode.h @@ -9,6 +9,8 @@ class MeshNode : public MaterialNode { public: MeshNode(const Transform& transform); + virtual ~MeshNode(); + void setMesh(AbstractMesh* mesh); SceneItem* getSceneItem(std::size_t idx) const override; diff --git a/src/rendering/visual_elements/scene/SceneItem.cpp b/src/rendering/visual_elements/scene/SceneItem.cpp index dbd70e9..af130c0 100644 --- a/src/rendering/visual_elements/scene/SceneItem.cpp +++ b/src/rendering/visual_elements/scene/SceneItem.cpp @@ -5,6 +5,11 @@ SceneItem::SceneItem() } +SceneItem::~SceneItem() +{ + +} + const Color& SceneItem::getFillColor() const { return mFillColor; @@ -20,6 +25,11 @@ const Transform& SceneItem::getTransform() const return mTransform; } +const std::string& SceneItem::getName() const +{ + return mName; +} + double SceneItem::getOutlineThickness() const { return mOutlineThickness; @@ -78,3 +88,8 @@ void SceneItem::updateTransform(const Transform& transform) mTransform = transform; } } + +void SceneItem::setName(const std::string& name) +{ + mName = name; +} diff --git a/src/rendering/visual_elements/scene/SceneItem.h b/src/rendering/visual_elements/scene/SceneItem.h index 42592be..3ac17ed 100644 --- a/src/rendering/visual_elements/scene/SceneItem.h +++ b/src/rendering/visual_elements/scene/SceneItem.h @@ -18,7 +18,7 @@ public: SceneItem(); - virtual ~SceneItem() = default; + virtual ~SceneItem(); const Color& getFillColor() const; @@ -30,6 +30,8 @@ public: double getOutlineThickness() const; + const std::string& getName() const; + bool hasFillColor() const; bool hasOutlineColor() const; @@ -44,18 +46,10 @@ public: void setFillColor(const Color& color); + void setName(const std::string& name); + void updateTransform(const Transform& transform); - void setName(const std::string& name) - { - mName = name; - } - - const std::string& getName() const - { - return mName; - } - protected: Transform mTransform; diff --git a/src/rendering/visual_elements/scene/SceneModel.cpp b/src/rendering/visual_elements/scene/SceneModel.cpp index b0e484e..5473f68 100644 --- a/src/rendering/visual_elements/scene/SceneModel.cpp +++ b/src/rendering/visual_elements/scene/SceneModel.cpp @@ -10,6 +10,11 @@ SceneModel::SceneModel(std::unique_ptr mesh) } +SceneModel::~SceneModel() +{ + +} + SceneModel::SceneModel(std::unique_ptr geometry) : SceneItem(), mGeometry(std::move(geometry)) diff --git a/src/rendering/visual_elements/scene/SceneModel.h b/src/rendering/visual_elements/scene/SceneModel.h index 3bbf6e0..85f8641 100644 --- a/src/rendering/visual_elements/scene/SceneModel.h +++ b/src/rendering/visual_elements/scene/SceneModel.h @@ -15,6 +15,8 @@ class SceneModel : public SceneItem { public: SceneModel() = default; + virtual ~SceneModel(); + explicit SceneModel(std::unique_ptr mesh); explicit SceneModel(std::unique_ptr geometry); diff --git a/src/ui/ui_elements/widgets/BoxGeometry.cpp b/src/ui/ui_elements/widgets/BoxGeometry.cpp index a8e96cc..039deda 100644 --- a/src/ui/ui_elements/widgets/BoxGeometry.cpp +++ b/src/ui/ui_elements/widgets/BoxGeometry.cpp @@ -1,10 +1,15 @@ #include "BoxGeometry.h" BoxGeometry::BoxGeometry() - : mLocation(DiscretePoint(0, 0)), - mSize({ 100, 0, 0, 100, 0, 0 }), - mPadding(), - mMargin() + : mLocation(DiscretePoint(0, 0)), + mSize({ 100, 0, 0, 100, 0, 0 }), + mPadding(), + mMargin() +{ + +} + +BoxGeometry::~BoxGeometry() { } @@ -12,40 +17,40 @@ BoxGeometry::BoxGeometry() BoundedSize BoxGeometry::getSize() const { - return mSize; + return mSize; } const DiscretePoint& BoxGeometry::getLocation() const { - return mLocation; + return mLocation; } void BoxGeometry::setSize(const BoundedSize& size) { - if (size != mSize) - { - mSize = size; - mTransformDirty = true; - } + if (size != mSize) + { + mSize = size; + mTransformDirty = true; + } } void BoxGeometry::setMargin(unsigned margin) { - setMargin({ margin, margin, margin, margin }); + setMargin({ margin, margin, margin, margin }); } void BoxGeometry::setMargin(const BoundaryOffset& margin) { - if (margin != mMargin) - { - mMargin = margin; - mTransformDirty = true; - } + if (margin != mMargin) + { + mMargin = margin; + mTransformDirty = true; + } } void BoxGeometry::setPadding(unsigned padding) { - setPadding({ padding, padding, padding, padding }); + setPadding({ padding, padding, padding, padding }); } void BoxGeometry::setPadding(const BoundaryOffset& padding) diff --git a/src/ui/ui_elements/widgets/BoxGeometry.h b/src/ui/ui_elements/widgets/BoxGeometry.h index df920eb..f939e58 100644 --- a/src/ui/ui_elements/widgets/BoxGeometry.h +++ b/src/ui/ui_elements/widgets/BoxGeometry.h @@ -51,7 +51,7 @@ class BoxGeometry public: BoxGeometry(); - virtual ~BoxGeometry() = default; + virtual ~BoxGeometry(); bool contains(const DiscretePoint& loc) const; @@ -88,4 +88,4 @@ protected: BoundaryOffset mMargin; bool mTransformDirty{ true }; -}; \ No newline at end of file +}; diff --git a/src/ui/windows/ui_interfaces/x11/XcbEventInterface.cpp b/src/ui/windows/ui_interfaces/x11/XcbEventInterface.cpp index f790f88..a4e4136 100644 --- a/src/ui/windows/ui_interfaces/x11/XcbEventInterface.cpp +++ b/src/ui/windows/ui_interfaces/x11/XcbEventInterface.cpp @@ -13,7 +13,7 @@ std::unique_ptr XcbEventInterface::Create() return std::make_unique(); } -std::unique_ptr XcbEventInterface::ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const +std::unique_ptr XcbEventInterface::convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const { auto ui_event = KeyboardEvent::Create(); ui_event->setAction(KeyboardEvent::Action::Pressed); @@ -29,7 +29,7 @@ std::unique_ptr XcbEventInterface::ConvertKeyPress(xcb_key_press_ return ui_event; } -std::unique_ptr XcbEventInterface::ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const +std::unique_ptr XcbEventInterface::convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const { auto ui_event = KeyboardEvent::Create(); ui_event->setAction(KeyboardEvent::Action::Released); @@ -45,31 +45,31 @@ std::unique_ptr XcbEventInterface::ConvertKeyRelease(xcb_key_pres return ui_event; } -std::unique_ptr XcbEventInterface::ConvertButtonPress(xcb_button_press_event_t* event) const +std::unique_ptr XcbEventInterface::convertButtonPress(xcb_button_press_event_t* event) const { auto ui_event = MouseEvent::Create(); auto x = static_cast(event->event_x); auto y = static_cast(event->event_y); - ui_event->SetClientLocation(DiscretePoint(x, y)); + ui_event->setClientLocation(DiscretePoint(x, y)); auto screen_x = static_cast(event->root_x); auto screen_y = static_cast(event->root_y); - ui_event->SetScreenLocation(DiscretePoint(x, y)); - ui_event->SetAction(MouseEvent::Action::Pressed); + ui_event->setScreenLocation(DiscretePoint(x, y)); + ui_event->setAction(MouseEvent::Action::Pressed); return ui_event; } -std::unique_ptr XcbEventInterface::ConvertButtonRelease(xcb_button_press_event_t* event) const +std::unique_ptr XcbEventInterface::convertButtonRelease(xcb_button_press_event_t* event) const { auto ui_event = MouseEvent::Create(); auto x = static_cast(event->event_x); auto y = static_cast(event->event_y); - ui_event->SetClientLocation(DiscretePoint(x, y)); + ui_event->setClientLocation(DiscretePoint(x, y)); auto screen_x = static_cast(event->root_x); auto screen_y = static_cast(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; } diff --git a/src/ui/windows/ui_interfaces/x11/XcbEventInterface.h b/src/ui/windows/ui_interfaces/x11/XcbEventInterface.h index fe412e4..cfd445a 100644 --- a/src/ui/windows/ui_interfaces/x11/XcbEventInterface.h +++ b/src/ui/windows/ui_interfaces/x11/XcbEventInterface.h @@ -13,16 +13,15 @@ struct xcb_button_press_event_t; class XcbEventInterface { public: - static std::unique_ptr Create(); - std::unique_ptr ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const; + std::unique_ptr convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const; - std::unique_ptr ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const; + std::unique_ptr convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const; - std::unique_ptr ConvertButtonPress(xcb_button_press_event_t* event) const; + std::unique_ptr convertButtonPress(xcb_button_press_event_t* event) const; - std::unique_ptr ConvertButtonRelease(xcb_button_press_event_t* event) const; + std::unique_ptr convertButtonRelease(xcb_button_press_event_t* event) const; }; using XcbEventInterfacePtr = std::unique_ptr; diff --git a/src/ui/windows/ui_interfaces/x11/XcbInterface.cpp b/src/ui/windows/ui_interfaces/x11/XcbInterface.cpp index 1d4b4a7..d103d7e 100644 --- a/src/ui/windows/ui_interfaces/x11/XcbInterface.cpp +++ b/src/ui/windows/ui_interfaces/x11/XcbInterface.cpp @@ -182,7 +182,7 @@ void XcbInterface::addWindow(mt::Window* window) void XcbInterface::onPaint() { - mDesktopManager->onUiEvent(PaintEvent::Create()); + mDesktopManager->onUiEvent(PaintEvent::Create(mDesktopManager->getThemeManager(), mDesktopManager->getFontsManager())); auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow(); auto defaultScreen = mDesktopManager->getDefaultScreen(); @@ -215,25 +215,25 @@ void XcbInterface::loop() } case XCB_KEY_PRESS: { auto kp = reinterpret_cast(event); - auto ui_event = mEventInterface->ConvertKeyPress(kp, mDesktopManager->getKeyboard()); + auto ui_event = mEventInterface->convertKeyPress(kp, mDesktopManager->getKeyboard()); mDesktopManager->onUiEvent(std::move(ui_event)); break; } case XCB_KEY_RELEASE: { auto kr = reinterpret_cast(event); - auto ui_event = mEventInterface->ConvertKeyRelease(kr, mDesktopManager->getKeyboard()); + auto ui_event = mEventInterface->convertKeyRelease(kr, mDesktopManager->getKeyboard()); mDesktopManager->onUiEvent(std::move(ui_event)); break; } case XCB_BUTTON_PRESS: { auto press = reinterpret_cast(event); - auto ui_event = mEventInterface->ConvertButtonPress(press); + auto ui_event = mEventInterface->convertButtonPress(press); mDesktopManager->onUiEvent(std::move(ui_event)); break; } case XCB_BUTTON_RELEASE: { auto release = reinterpret_cast(event); - auto ui_event = mEventInterface->ConvertButtonRelease(release); + auto ui_event = mEventInterface->convertButtonRelease(release); mDesktopManager->onUiEvent(std::move(ui_event)); break; } diff --git a/src/ui/windows/ui_interfaces/x11/XcbInterface.h b/src/ui/windows/ui_interfaces/x11/XcbInterface.h index e749fcf..f4d181e 100644 --- a/src/ui/windows/ui_interfaces/x11/XcbInterface.h +++ b/src/ui/windows/ui_interfaces/x11/XcbInterface.h @@ -38,20 +38,23 @@ public: void showWindow(mt::Window* window) override; private: - void initialize() override; - void onPaint(); - void onExposeEvent(xcb_expose_event_t* event); - - void initializeHardwareRendering() override; void createGraphicsContext(); 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 shutDown() override; - uint32_t getEventMask(); + void updateScreen(); private: xcb_connection_t* mConnection{nullptr}; _XDisplay* mX11Display{nullptr};