summaryrefslogtreecommitdiff
path: root/src/desktop
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-01-23 21:55:41 +0100
committerGitHub <noreply@github.com>2025-01-23 21:55:41 +0100
commit0a1ae48a9fd6eb76baad27de98c00f653a55e4ac (patch)
tree007cd36eb83d343d2aba49cf0741028c5f554895 /src/desktop
parentae403e6a05452336abd97e61be2706f6a930d827 (diff)
core: move all shared_ptrs from the STL to hyprutils (#9143)
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/LayerRule.cpp2
-rw-r--r--src/desktop/LayerSurface.cpp2
-rw-r--r--src/desktop/LayerSurface.hpp2
-rw-r--r--src/desktop/Popup.cpp2
-rw-r--r--src/desktop/Popup.hpp6
-rw-r--r--src/desktop/Rule.cpp5
-rw-r--r--src/desktop/Rule.hpp6
-rw-r--r--src/desktop/Subsurface.cpp4
-rw-r--r--src/desktop/Subsurface.hpp16
-rw-r--r--src/desktop/Window.cpp18
-rw-r--r--src/desktop/Window.hpp12
11 files changed, 38 insertions, 37 deletions
diff --git a/src/desktop/LayerRule.cpp b/src/desktop/LayerRule.cpp
index 23371947..791a557e 100644
--- a/src/desktop/LayerRule.cpp
+++ b/src/desktop/LayerRule.cpp
@@ -1,7 +1,7 @@
+#include <re2/re2.h>
#include "LayerRule.hpp"
#include <unordered_set>
#include <algorithm>
-#include <re2/re2.h>
#include "../debug/Log.hpp"
static const auto RULES = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index c572f6b2..dd30aa7c 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -32,7 +32,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
pLS->szNamespace = resource->layerNamespace;
pLS->layer = resource->current.layer;
- pLS->popupHead = std::make_unique<CPopup>(pLS);
+ pLS->popupHead = makeUnique<CPopup>(pLS);
pLS->monitor = pMonitor;
pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS);
diff --git a/src/desktop/LayerSurface.hpp b/src/desktop/LayerSurface.hpp
index 591dfd99..ab259733 100644
--- a/src/desktop/LayerSurface.hpp
+++ b/src/desktop/LayerSurface.hpp
@@ -59,7 +59,7 @@ class CLayerSurface {
CBox geometry = {0, 0, 0, 0};
Vector2D position;
std::string szNamespace = "";
- std::unique_ptr<CPopup> popupHead;
+ UP<CPopup> popupHead;
void onDestroy();
void onMap();
diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp
index ce6ab9a0..831619a5 100644
--- a/src/desktop/Popup.cpp
+++ b/src/desktop/Popup.cpp
@@ -89,7 +89,7 @@ void CPopup::onMap() {
g_pInputManager->simulateMouseMovement();
- m_pSubsurfaceHead = std::make_unique<CSubsurface>(this);
+ m_pSubsurfaceHead = makeUnique<CSubsurface>(this);
//unconstrain();
sendScale();
diff --git a/src/desktop/Popup.hpp b/src/desktop/Popup.hpp
index e9b3e0f0..2b7b4e82 100644
--- a/src/desktop/Popup.hpp
+++ b/src/desktop/Popup.hpp
@@ -1,9 +1,9 @@
#pragma once
#include <vector>
-#include <memory>
#include "Subsurface.hpp"
#include "../helpers/signal/Signal.hpp"
+#include "../helpers/memory/Memory.hpp"
class CXDGPopupResource;
@@ -61,8 +61,8 @@ class CPopup {
bool m_bInert = false;
//
- std::vector<SP<CPopup>> m_vChildren;
- std::unique_ptr<CSubsurface> m_pSubsurfaceHead;
+ std::vector<SP<CPopup>> m_vChildren;
+ UP<CSubsurface> m_pSubsurfaceHead;
struct {
CHyprSignalListener newPopup;
diff --git a/src/desktop/Rule.cpp b/src/desktop/Rule.cpp
index ae280642..aa87a483 100644
--- a/src/desktop/Rule.cpp
+++ b/src/desktop/Rule.cpp
@@ -1,12 +1,13 @@
-#include "Rule.hpp"
#include <re2/re2.h>
+#include "../helpers/memory/Memory.hpp"
+#include "Rule.hpp"
#include "../debug/Log.hpp"
CRuleRegexContainer::CRuleRegexContainer(const std::string& regex_) {
const bool NEGATIVE = regex_.starts_with("negative:");
negative = NEGATIVE;
- regex = std::make_unique<RE2>(NEGATIVE ? regex_.substr(9) : regex_);
+ regex = makeUnique<RE2>(NEGATIVE ? regex_.substr(9) : regex_);
// TODO: maybe pop an error?
if (!regex->ok())
diff --git a/src/desktop/Rule.hpp b/src/desktop/Rule.hpp
index 4b178ee8..858b4ded 100644
--- a/src/desktop/Rule.hpp
+++ b/src/desktop/Rule.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <memory>
+#include <hyprutils/memory/UniquePtr.hpp>
//NOLINTNEXTLINE
namespace re2 {
@@ -16,6 +16,6 @@ class CRuleRegexContainer {
bool passes(const std::string& str) const;
private:
- std::unique_ptr<re2::RE2> regex;
- bool negative = false;
+ Hyprutils::Memory::CUniquePointer<re2::RE2> regex;
+ bool negative = false;
}; \ No newline at end of file
diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp
index 26638f7a..9cdf3685 100644
--- a/src/desktop/Subsurface.cpp
+++ b/src/desktop/Subsurface.cpp
@@ -126,9 +126,9 @@ void CSubsurface::onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface) {
CSubsurface* PSUBSURFACE = nullptr;
if (!m_pWindowParent.expired())
- PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pWindowParent.lock())).get();
+ PSUBSURFACE = m_vChildren.emplace_back(makeUnique<CSubsurface>(pSubsurface, m_pWindowParent.lock())).get();
else if (m_pPopupParent)
- PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pPopupParent)).get();
+ PSUBSURFACE = m_vChildren.emplace_back(makeUnique<CSubsurface>(pSubsurface, m_pPopupParent)).get();
ASSERT(PSUBSURFACE);
diff --git a/src/desktop/Subsurface.hpp b/src/desktop/Subsurface.hpp
index 7829c489..aacbad91 100644
--- a/src/desktop/Subsurface.hpp
+++ b/src/desktop/Subsurface.hpp
@@ -48,16 +48,16 @@ class CSubsurface {
Vector2D m_vLastSize = {};
// if nullptr, means it's a dummy node
- CSubsurface* m_pParent = nullptr;
+ CSubsurface* m_pParent = nullptr;
- PHLWINDOWREF m_pWindowParent;
- CPopup* m_pPopupParent = nullptr;
+ PHLWINDOWREF m_pWindowParent;
+ CPopup* m_pPopupParent = nullptr;
- std::vector<std::unique_ptr<CSubsurface>> m_vChildren;
+ std::vector<UP<CSubsurface>> m_vChildren;
- bool m_bInert = false;
+ bool m_bInert = false;
- void initSignals();
- void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
- void checkSiblingDamage();
+ void initSignals();
+ void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
+ void checkSiblingDamage();
}; \ No newline at end of file
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 829f4e2e..fb5904be 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -47,8 +47,8 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
- pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
- pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
+ pWindow->addWindowDeco(makeUnique<CHyprDropShadowDecoration>(pWindow));
+ pWindow->addWindowDeco(makeUnique<CHyprBorderDecoration>(pWindow));
return pWindow;
}
@@ -70,8 +70,8 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(0.f, pWindow->m_fMovingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
- pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
- pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
+ pWindow->addWindowDeco(makeUnique<CHyprDropShadowDecoration>(pWindow));
+ pWindow->addWindowDeco(makeUnique<CHyprBorderDecoration>(pWindow));
pWindow->m_pWLSurface->assign(pWindow->m_pXDGSurface->surface.lock(), pWindow);
@@ -296,7 +296,7 @@ void CWindow::updateWindowDecos() {
}
}
-void CWindow::addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco) {
+void CWindow::addWindowDeco(UP<IHyprWindowDecoration> deco) {
m_dWindowDecorations.emplace_back(std::move(deco));
g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock());
updateWindowDecos();
@@ -567,8 +567,8 @@ void CWindow::onMap() {
if (m_bIsX11)
return;
- m_pSubsurfaceHead = std::make_unique<CSubsurface>(m_pSelf.lock());
- m_pPopupHead = std::make_unique<CPopup>(m_pSelf.lock());
+ m_pSubsurfaceHead = makeUnique<CSubsurface>(m_pSelf.lock());
+ m_pPopupHead = makeUnique<CPopup>(m_pSelf.lock());
}
void CWindow::onBorderAngleAnimEnd(WP<CBaseAnimatedVariable> pav) {
@@ -870,7 +870,7 @@ void CWindow::createGroup() {
m_sGroupData.locked = false;
m_sGroupData.deny = false;
- addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(m_pSelf.lock()));
+ addWindowDeco(makeUnique<CHyprGroupBarDecoration>(m_pSelf.lock()));
if (m_pWorkspace) {
m_pWorkspace->updateWindows();
@@ -1052,7 +1052,7 @@ void CWindow::insertWindowToGroup(PHLWINDOW pWindow) {
const auto ENDAT = m_sGroupData.pNextWindow.lock();
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
- pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
+ pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow));
if (!pWindow->m_sGroupData.pNextWindow.lock()) {
BEGINAT->m_sGroupData.pNextWindow = pWindow;
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index ebda235c..5b4ad654 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -296,8 +296,8 @@ class CWindow {
uint64_t m_eSuppressedEvents = SUPPRESS_NONE;
// desktop components
- std::unique_ptr<CSubsurface> m_pSubsurfaceHead;
- std::unique_ptr<CPopup> m_pPopupHead;
+ UP<CSubsurface> m_pSubsurfaceHead;
+ UP<CPopup> m_pPopupHead;
// Animated border
CGradientValueData m_cRealBorderColor = {0};
@@ -328,14 +328,14 @@ class CWindow {
// Window decorations
// TODO: make this a SP.
- std::vector<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
- std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
+ std::vector<UP<IHyprWindowDecoration>> m_dWindowDecorations;
+ std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
// Special render data, rules, etc
SWindowData m_sWindowData;
// Transformers
- std::vector<std::unique_ptr<IWindowTransformer>> m_vTransformers;
+ std::vector<UP<IWindowTransformer>> m_vTransformers;
// for alpha
PHLANIMVAR<float> m_fActiveInactiveAlpha;
@@ -396,7 +396,7 @@ class CWindow {
SBoxExtents getFullWindowExtents();
CBox getWindowBoxUnified(uint64_t props);
CBox getWindowIdealBoundingBoxIgnoreReserved();
- void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
+ void addWindowDeco(UP<IHyprWindowDecoration> deco);
void updateWindowDecos();
void removeWindowDeco(IHyprWindowDecoration* deco);
void uncacheWindowDecos();