summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorKamikadze <40305144+Kam1k4dze@users.noreply.github.com>2025-08-14 19:44:56 +0500
committerGitHub <noreply@github.com>2025-08-14 15:44:56 +0100
commitbeee22a95ed9044950e5486f22edd813e00ffa2c (patch)
tree4612fa3d9b17275d417a059c19f998c64e871997 /src/layout
parentaa6a78f0a4e17c49ed4aff8b58c3f7ec7ef0408f (diff)
refactor: Use new hyprutils casts (#11377)
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/DwindleLayout.cpp8
-rw-r--r--src/layout/DwindleLayout.hpp2
-rw-r--r--src/layout/IHyprLayout.cpp6
-rw-r--r--src/layout/MasterLayout.cpp18
-rw-r--r--src/layout/MasterLayout.hpp2
5 files changed, 18 insertions, 18 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index d844ea41..78ce1f19 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -139,8 +139,8 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
- auto* const PGAPSIN = (CCssGapData*)(PGAPSINDATA.ptr())->getData();
- auto* const PGAPSOUT = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
+ auto* const PGAPSIN = sc<CCssGapData*>((PGAPSINDATA.ptr())->getData());
+ auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
@@ -179,9 +179,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
}
}
- const auto GAPOFFSETTOPLEFT = Vector2D((double)(DISPLAYLEFT ? gapsOut.m_left : gapsIn.m_left), (double)(DISPLAYTOP ? gapsOut.m_top : gapsIn.m_top));
+ const auto GAPOFFSETTOPLEFT = Vector2D(sc<double>(DISPLAYLEFT ? gapsOut.m_left : gapsIn.m_left), sc<double>(DISPLAYTOP ? gapsOut.m_top : gapsIn.m_top));
- const auto GAPOFFSETBOTTOMRIGHT = Vector2D((double)(DISPLAYRIGHT ? gapsOut.m_right : gapsIn.m_right), (double)(DISPLAYBOTTOM ? gapsOut.m_bottom : gapsIn.m_bottom));
+ const auto GAPOFFSETBOTTOMRIGHT = Vector2D(sc<double>(DISPLAYRIGHT ? gapsOut.m_right : gapsIn.m_right), sc<double>(DISPLAYBOTTOM ? gapsOut.m_bottom : gapsIn.m_bottom));
calcPos = calcPos + GAPOFFSETTOPLEFT + ratioPadding / 2;
calcSize = calcSize - GAPOFFSETTOPLEFT - GAPOFFSETBOTTOMRIGHT - ratioPadding;
diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp
index ca610605..23f19956 100644
--- a/src/layout/DwindleLayout.hpp
+++ b/src/layout/DwindleLayout.hpp
@@ -100,7 +100,7 @@ struct std::formatter<SDwindleNodeData*, CharT> : std::formatter<CharT> {
auto out = ctx.out();
if (!node)
return std::format_to(out, "[Node nullptr]");
- std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->box.pos(), node->box.size());
+ std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", rc<uintptr_t>(node), node->workspaceID, node->box.pos(), node->box.size());
if (!node->isNode && !node->pWindow.expired())
std::format_to(out, ", window: {:x}", node->pWindow.lock());
return std::format_to(out, "]");
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index aacb9c45..464825c4 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -435,7 +435,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
const auto WSID = DRAGGINGWINDOW->workspaceID();
const bool HASFULLSCREEN = DRAGGINGWINDOW->m_workspace && DRAGGINGWINDOW->m_workspace->m_hasFullscreenWindow;
- const auto* GAPSIN = *SNAPRESPECTGAPS ? (CCssGapData*)PGAPSIN.ptr()->getData() : &GAPSNONE;
+ const auto* GAPSIN = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSIN.ptr()->getData()) : &GAPSNONE;
const double GAPSX = GAPSIN->m_left + GAPSIN->m_right;
const double GAPSY = GAPSIN->m_top + GAPSIN->m_bottom;
@@ -497,7 +497,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
const auto EXTENTNONE = SBoxExtents{{0, 0}, {0, 0}};
const auto* EXTENTDIFF = *SNAPBORDEROVERLAP ? &EXTENTS : &EXTENTNONE;
const auto MON = DRAGGINGWINDOW->m_monitor.lock();
- const auto* GAPSOUT = *SNAPRESPECTGAPS ? (CCssGapData*)PGAPSOUT.ptr()->getData() : &GAPSNONE;
+ const auto* GAPSOUT = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSOUT.ptr()->getData()) : &GAPSNONE;
SRange monX = {MON->m_position.x + MON->m_reservedTopLeft.x + GAPSOUT->m_left, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x - GAPSOUT->m_right};
SRange monY = {MON->m_position.y + MON->m_reservedTopLeft.y + GAPSOUT->m_top, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y - GAPSOUT->m_bottom};
@@ -745,7 +745,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
const auto TILED = isWindowTiled(pWindow);
// event
- g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", std::format("{:x},{}", (uintptr_t)pWindow.get(), (int)TILED)});
+ g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", std::format("{:x},{}", rc<uintptr_t>(pWindow.get()), sc<int>(TILED))});
EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
if (!TILED) {
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index 53dc5c2f..d5a89c94 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -392,7 +392,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
nextX = (WSSIZE.x - WIDTH) / 2;
PMASTERNODE->size = Vector2D(WIDTH, WSSIZE.y);
- PMASTERNODE->position = WSPOS + Vector2D((double)nextX, 0.0);
+ PMASTERNODE->position = WSPOS + Vector2D(nextX, 0.0);
} else {
PMASTERNODE->size = WSSIZE;
PMASTERNODE->position = WSPOS;
@@ -661,8 +661,8 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
static auto PANIMATE = CConfigValue<Hyprlang::INT>("misc:animate_manual_resizes");
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
- auto* PGAPSIN = (CCssGapData*)(PGAPSINDATA.ptr())->getData();
- auto* PGAPSOUT = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
+ auto* PGAPSIN = sc<CCssGapData*>((PGAPSINDATA.ptr())->getData());
+ auto* PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
@@ -680,9 +680,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
auto calcPos = PWINDOW->m_position;
auto calcSize = PWINDOW->m_size;
- const auto OFFSETTOPLEFT = Vector2D((double)(DISPLAYLEFT ? gapsOut.m_left : gapsIn.m_left), (double)(DISPLAYTOP ? gapsOut.m_top : gapsIn.m_top));
+ const auto OFFSETTOPLEFT = Vector2D(sc<double>(DISPLAYLEFT ? gapsOut.m_left : gapsIn.m_left), sc<double>(DISPLAYTOP ? gapsOut.m_top : gapsIn.m_top));
- const auto OFFSETBOTTOMRIGHT = Vector2D((double)(DISPLAYRIGHT ? gapsOut.m_right : gapsIn.m_right), (double)(DISPLAYBOTTOM ? gapsOut.m_bottom : gapsIn.m_bottom));
+ const auto OFFSETBOTTOMRIGHT = Vector2D(sc<double>(DISPLAYRIGHT ? gapsOut.m_right : gapsIn.m_right), sc<double>(DISPLAYBOTTOM ? gapsOut.m_bottom : gapsIn.m_bottom));
calcPos = calcPos + OFFSETTOPLEFT;
calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT;
@@ -1382,10 +1382,10 @@ void CHyprMasterLayout::runOrientationCycle(SLayoutMessageHeader& header, CVarLi
}
}
- if (nextOrPrev >= (int)cycle.size())
- nextOrPrev = nextOrPrev % (int)cycle.size();
+ if (nextOrPrev >= sc<int>(cycle.size()))
+ nextOrPrev = nextOrPrev % sc<int>(cycle.size());
else if (nextOrPrev < 0)
- nextOrPrev = cycle.size() + (nextOrPrev % (int)cycle.size());
+ nextOrPrev = cycle.size() + (nextOrPrev % sc<int>(cycle.size()));
PWORKSPACEDATA->orientation = cycle.at(nextOrPrev);
recalculateMonitor(header.pWindow->monitorID());
@@ -1393,7 +1393,7 @@ void CHyprMasterLayout::runOrientationCycle(SLayoutMessageHeader& header, CVarLi
void CHyprMasterLayout::buildOrientationCycleVectorFromEOperation(std::vector<eOrientation>& cycle) {
for (int i = 0; i <= ORIENTATION_CENTER; ++i) {
- cycle.push_back((eOrientation)i);
+ cycle.push_back(sc<eOrientation>(i));
}
}
diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp
index 20743690..4da31a8d 100644
--- a/src/layout/MasterLayout.hpp
+++ b/src/layout/MasterLayout.hpp
@@ -100,7 +100,7 @@ struct std::formatter<SMasterNodeData*, CharT> : std::formatter<CharT> {
auto out = ctx.out();
if (!node)
return std::format_to(out, "[Node nullptr]");
- std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
+ std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", rc<uintptr_t>(node), node->workspaceID, node->position, node->size);
if (node->isMaster)
std::format_to(out, ", master");
if (!node->pWindow.expired())