summaryrefslogtreecommitdiff
path: root/src/helpers/Subsurface.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-02-29 00:03:28 +0000
committerGitHub <noreply@github.com>2024-02-29 00:03:28 +0000
commitb1c0f1cc018d13ac1e5ebccaade5528ec757bd74 (patch)
tree11f62bf58b902b0c0b1732ed3f66aa601dae49fd /src/helpers/Subsurface.hpp
parent1e7eb3a5a5419f97b61a3403880b161c85dd7b17 (diff)
subsurface: Rewrite the subsurface tree (#4877)
Diffstat (limited to 'src/helpers/Subsurface.hpp')
-rw-r--r--src/helpers/Subsurface.hpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/helpers/Subsurface.hpp b/src/helpers/Subsurface.hpp
new file mode 100644
index 00000000..a8f028af
--- /dev/null
+++ b/src/helpers/Subsurface.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "../defines.hpp"
+#include <vector>
+#include "WLSurface.hpp"
+
+class CWindow;
+
+class CSubsurface {
+ public:
+ // root dummy nodes
+ CSubsurface(CWindow* pOwner);
+
+ // real nodes
+ CSubsurface(wlr_subsurface* pSubsurface, CWindow* pOwner);
+
+ ~CSubsurface();
+
+ Vector2D coordsRelativeToParent();
+ Vector2D coordsGlobal();
+
+ void onCommit();
+ void onDestroy();
+ void onNewSubsurface(wlr_subsurface* pSubsurface);
+ void onMap();
+ void onUnmap();
+
+ void recheckDamageForSubsurfaces();
+
+ private:
+ DYNLISTENER(destroySubsurface);
+ DYNLISTENER(commitSubsurface);
+ DYNLISTENER(newSubsurface);
+ DYNLISTENER(mapSubsurface);
+ DYNLISTENER(unmapSubsurface);
+
+ wlr_subsurface* m_pSubsurface = nullptr;
+ CWLSurface m_sWLSurface;
+ Vector2D m_vLastSize = {};
+
+ // if nullptr, means it's a dummy node
+ CSubsurface* m_pParent = nullptr;
+
+ CWindow* m_pWindowParent = nullptr;
+
+ std::vector<std::unique_ptr<CSubsurface>> m_vChildren;
+
+ void initSignals();
+ void initExistingSubsurfaces();
+ void checkSiblingDamage();
+}; \ No newline at end of file