refactor: Use new hyprutils casts (#11377)

This commit is contained in:
Kamikadze 2025-08-14 19:44:56 +05:00 committed by GitHub
parent aa6a78f0a4
commit beee22a95e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
116 changed files with 715 additions and 696 deletions

View file

@ -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));
}
}