aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/debug
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-10-19 23:03:29 +0100
committerGitHub <[email protected]>2024-10-19 23:03:29 +0100
commitf044e4c9514ec89c4c1fc8a523ca90b8cb907fb7 (patch)
tree5fa2ba17c08d522b7bb3f6564761b4aaedc532d0 /src/debug
parentce3ba798df6bca5be1da4396644a9ef08a2acab4 (diff)
downloadHyprland-f044e4c9514ec89c4c1fc8a523ca90b8cb907fb7.tar.gz
Hyprland-f044e4c9514ec89c4c1fc8a523ca90b8cb907fb7.zip
internal: Move CMonitor to SP (#8178)
* move monitors to sp * XD
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/HyprCtl.cpp10
-rw-r--r--src/debug/HyprDebugOverlay.cpp18
-rw-r--r--src/debug/HyprDebugOverlay.hpp24
-rw-r--r--src/debug/HyprNotificationOverlay.cpp6
-rw-r--r--src/debug/HyprNotificationOverlay.hpp8
5 files changed, 33 insertions, 33 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index e0bb2b83..e09fb529 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -54,7 +54,7 @@ static std::string formatToString(uint32_t drmFormat) {
return "Invalid";
}
-static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) {
+static std::string availableModesForOutput(PHLMONITOR pMonitor, eHyprCtlOutputFormat format) {
std::string result;
for (auto const& m : pMonitor->output->modes) {
@@ -117,7 +117,7 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m == g_pCompositor->m_pLastMonitor ? "true" : "false"),
(m->dpmsStatus ? "true" : "false"), (m->output->state->state().adaptiveSync ? "true" : "false"), (uint64_t)m->solitaryClient.get(),
(m->tearingState.activelyTearing ? "true" : "false"), (m->m_bEnabled ? "false" : "true"), formatToString(m->output->state->state().drmFormat),
- availableModesForOutput(m.get(), format));
+ availableModesForOutput(m, format));
} else {
result += std::format("Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\t"
@@ -128,7 +128,7 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
m->activeSpecialWorkspaceID(), (m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""), (int)m->vecReservedTopLeft.x,
(int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform,
(m == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus, m->output->state->state().adaptiveSync, (uint64_t)m->solitaryClient.get(),
- m->tearingState.activelyTearing, !m->m_bEnabled, formatToString(m->output->state->state().drmFormat), availableModesForOutput(m.get(), format));
+ m->tearingState.activelyTearing, !m->m_bEnabled, formatToString(m->output->state->state().drmFormat), availableModesForOutput(m, format));
}
return result;
@@ -1030,7 +1030,7 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
// decorations will probably need a repaint
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source") {
for (auto const& m : g_pCompositor->m_vMonitors) {
- g_pHyprRenderer->damageMonitor(m.get());
+ g_pHyprRenderer->damageMonitor(m);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
}
@@ -1779,7 +1779,7 @@ std::string CHyprCtl::getReply(std::string request) {
}
for (auto const& m : g_pCompositor->m_vMonitors) {
- g_pHyprRenderer->damageMonitor(m.get());
+ g_pHyprRenderer->damageMonitor(m);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
}
diff --git a/src/debug/HyprDebugOverlay.cpp b/src/debug/HyprDebugOverlay.cpp
index 2da64e63..9326cfe0 100644
--- a/src/debug/HyprDebugOverlay.cpp
+++ b/src/debug/HyprDebugOverlay.cpp
@@ -7,7 +7,7 @@ CHyprDebugOverlay::CHyprDebugOverlay() {
m_pTexture = makeShared<CTexture>();
}
-void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
+void CHyprMonitorDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
m_dLastRenderTimes.push_back(durationUs / 1000.f);
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -17,7 +17,7 @@ void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float durationUs)
m_pMonitor = pMonitor;
}
-void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
+void CHyprMonitorDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
m_dLastRenderTimesNoOverlay.push_back(durationUs / 1000.f);
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
@@ -27,7 +27,7 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float dur
m_pMonitor = pMonitor;
}
-void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
+void CHyprMonitorDebugOverlay::frameData(PHLMONITOR pMonitor) {
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -39,7 +39,7 @@ void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
m_pMonitor = pMonitor;
// anim data too
- const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor : g_pCompositor->m_pLastMonitor.get();
+ const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor.lock() : g_pCompositor->m_pLastMonitor.lock();
if (PMONITORFORTICKS) {
if (m_dLastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
m_dLastAnimationTicks.pop_front();
@@ -188,21 +188,21 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
return posY - offset;
}
-void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
+void CHyprDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
m_mMonitorOverlays[pMonitor].renderData(pMonitor, durationUs);
}
-void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
+void CHyprDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
}
-void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
+void CHyprDebugOverlay::frameData(PHLMONITOR pMonitor) {
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
}
void CHyprDebugOverlay::draw() {
- const auto PMONITOR = g_pCompositor->m_vMonitors.front().get();
+ const auto PMONITOR = g_pCompositor->m_vMonitors.front();
if (!m_pCairoSurface || !m_pCairo) {
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
@@ -218,7 +218,7 @@ void CHyprDebugOverlay::draw() {
// draw the things
int offsetY = 0;
for (auto const& m : g_pCompositor->m_vMonitors) {
- offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
+ offsetY += m_mMonitorOverlays[m].draw(offsetY);
offsetY += 5; // for padding between mons
}
diff --git a/src/debug/HyprDebugOverlay.hpp b/src/debug/HyprDebugOverlay.hpp
index e7742b35..19b9120a 100644
--- a/src/debug/HyprDebugOverlay.hpp
+++ b/src/debug/HyprDebugOverlay.hpp
@@ -5,7 +5,7 @@
#include "../render/Texture.hpp"
#include <deque>
#include <cairo/cairo.h>
-#include <unordered_map>
+#include <map>
class CHyprRenderer;
@@ -13,9 +13,9 @@ class CHyprMonitorDebugOverlay {
public:
int draw(int offset);
- void renderData(CMonitor* pMonitor, float durationUs);
- void renderDataNoOverlay(CMonitor* pMonitor, float durationUs);
- void frameData(CMonitor* pMonitor);
+ void renderData(PHLMONITOR pMonitor, float durationUs);
+ void renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs);
+ void frameData(PHLMONITOR pMonitor);
private:
std::deque<float> m_dLastFrametimes;
@@ -23,7 +23,7 @@ class CHyprMonitorDebugOverlay {
std::deque<float> m_dLastRenderTimesNoOverlay;
std::deque<float> m_dLastAnimationTicks;
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
- CMonitor* m_pMonitor = nullptr;
+ PHLMONITORREF m_pMonitor;
CBox m_wbLastDrawnBox;
friend class CHyprRenderer;
@@ -33,17 +33,17 @@ class CHyprDebugOverlay {
public:
CHyprDebugOverlay();
void draw();
- void renderData(CMonitor*, float durationUs);
- void renderDataNoOverlay(CMonitor*, float durationUs);
- void frameData(CMonitor*);
+ void renderData(PHLMONITOR, float durationUs);
+ void renderDataNoOverlay(PHLMONITOR, float durationUs);
+ void frameData(PHLMONITOR);
private:
- std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
+ std::map<PHLMONITOR, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
- cairo_surface_t* m_pCairoSurface = nullptr;
- cairo_t* m_pCairo = nullptr;
+ cairo_surface_t* m_pCairoSurface = nullptr;
+ cairo_t* m_pCairo = nullptr;
- SP<CTexture> m_pTexture;
+ SP<CTexture> m_pTexture;
friend class CHyprMonitorDebugOverlay;
friend class CHyprRenderer;
diff --git a/src/debug/HyprNotificationOverlay.cpp b/src/debug/HyprNotificationOverlay.cpp
index 16f80ab6..e46999e6 100644
--- a/src/debug/HyprNotificationOverlay.cpp
+++ b/src/debug/HyprNotificationOverlay.cpp
@@ -45,7 +45,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC
PNOTIF->fontSize = fontSize;
for (auto const& m : g_pCompositor->m_vMonitors) {
- g_pCompositor->scheduleFrameForMonitor(m.get());
+ g_pCompositor->scheduleFrameForMonitor(m);
}
}
@@ -61,7 +61,7 @@ void CHyprNotificationOverlay::dismissNotifications(const int amount) {
}
}
-CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
+CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
static constexpr auto ANIM_DURATION_MS = 600.0;
static constexpr auto ANIM_LAG_MS = 100.0;
static constexpr auto NOTIF_LEFTBAR_SIZE = 5.0;
@@ -187,7 +187,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
return CBox{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10};
}
-void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
+void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
const auto MONSIZE = pMonitor->vecTransformedSize;
diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp
index 352c44c9..0bba8b04 100644
--- a/src/debug/HyprNotificationOverlay.hpp
+++ b/src/debug/HyprNotificationOverlay.hpp
@@ -41,13 +41,13 @@ class CHyprNotificationOverlay {
CHyprNotificationOverlay();
~CHyprNotificationOverlay();
- void draw(CMonitor* pMonitor);
+ void draw(PHLMONITOR pMonitor);
void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE, const float fontSize = 13.f);
void dismissNotifications(const int amount);
bool hasAny();
private:
- CBox drawNotifications(CMonitor* pMonitor);
+ CBox drawNotifications(PHLMONITOR pMonitor);
CBox m_bLastDamage;
std::deque<std::unique_ptr<SNotification>> m_dNotifications;
@@ -55,8 +55,8 @@ class CHyprNotificationOverlay {
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
- CMonitor* m_pLastMonitor = nullptr;
- Vector2D m_vecLastSize = Vector2D(-1, -1);
+ PHLMONITORREF m_pLastMonitor;
+ Vector2D m_vecLastSize = Vector2D(-1, -1);
SP<CTexture> m_pTexture;
};