diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-18 22:35:51 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-18 22:35:51 +0100 |
| commit | a1a8f3b6d579d5df3a46dff92a221b7ad48f3e84 (patch) | |
| tree | 6aa449e3e7fbd706ec0903e629dd64b211890cdb /src/helpers | |
| parent | 00098aef4f55eb53763e663bf470c7359da302a1 (diff) | |
change to lists, titles etc
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/Monitor.hpp | 11 | ||||
| -rw-r--r-- | src/helpers/Vector2D.hpp | 12 | ||||
| -rw-r--r-- | src/helpers/WLClasses.hpp | 8 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index b9679933..b6bcdec7 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -3,6 +3,7 @@ #include "../defines.hpp" #include <deque> #include "WLClasses.hpp" +#include <list> struct SMonitor { Vector2D vecPosition = Vector2D(0,0); @@ -20,8 +21,16 @@ struct SMonitor { // WLR stuff wlr_output* output = nullptr; - std::deque<SLayerSurface> m_dLayerSurfaces; + // Double-linked list because we need to have constant mem addresses for signals + std::list<SLayerSurface> m_lLayerSurfaces; DYNLISTENER(monitorFrame); DYNLISTENER(monitorDestroy); + + + // For the list lookup + + bool operator==(const SMonitor& rhs) { + return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName; + } };
\ No newline at end of file diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp index 20bc032e..166e0b92 100644 --- a/src/helpers/Vector2D.hpp +++ b/src/helpers/Vector2D.hpp @@ -14,24 +14,24 @@ class Vector2D { // returns the scale double normalize(); - Vector2D operator+(Vector2D a) { + Vector2D operator+(const Vector2D a) { return Vector2D(this->x + a.x, this->y + a.y); } - Vector2D operator-(Vector2D a) { + Vector2D operator-(const Vector2D a) { return Vector2D(this->x - a.x, this->y - a.y); } - Vector2D operator*(float a) { + Vector2D operator*(const float a) { return Vector2D(this->x * a, this->y * a); } - Vector2D operator/(float a) { + Vector2D operator/(const float a) { return Vector2D(this->x / a, this->y / a); } - bool operator==(Vector2D& a) { + bool operator==(const Vector2D& a) { return a.x == x && a.y == y; } - bool operator!=(Vector2D& a) { + bool operator!=(const Vector2D& a) { return a.x != x || a.y != y; } diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 3c83b427..6d9d66cd 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -15,6 +15,14 @@ struct SLayerSurface { wlr_box geometry; zwlr_layer_shell_v1_layer layer; + + int monitorID = -1; + + + // For the list lookup + bool operator==(const SLayerSurface& rhs) { + return layerSurface == rhs.layerSurface && monitorID == rhs.monitorID; + } }; struct SRenderData { |
