diff options
| author | Kamikadze <40305144+Kam1k4dze@users.noreply.github.com> | 2025-08-14 19:44:56 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-14 15:44:56 +0100 |
| commit | beee22a95ed9044950e5486f22edd813e00ffa2c (patch) | |
| tree | 4612fa3d9b17275d417a059c19f998c64e871997 /src/desktop | |
| parent | aa6a78f0a4e17c49ed4aff8b58c3f7ec7ef0408f (diff) | |
refactor: Use new hyprutils casts (#11377)
Diffstat (limited to 'src/desktop')
| -rw-r--r-- | src/desktop/LayerSurface.cpp | 15 | ||||
| -rw-r--r-- | src/desktop/Popup.cpp | 12 | ||||
| -rw-r--r-- | src/desktop/WLSurface.cpp | 4 | ||||
| -rw-r--r-- | src/desktop/WLSurface.hpp | 2 | ||||
| -rw-r--r-- | src/desktop/Window.cpp | 64 | ||||
| -rw-r--r-- | src/desktop/Window.hpp | 8 | ||||
| -rw-r--r-- | src/desktop/Workspace.cpp | 10 |
7 files changed, 58 insertions, 57 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index de808e2a..de38a843 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -46,7 +46,8 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) { pLS->m_alpha->setValueAndWarp(0.f); - Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->m_layerNamespace, (int)pLS->m_layer, pMonitor->m_name); + Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", rc<uintptr_t>(resource.get()), resource->m_layerNamespace, sc<int>(pLS->m_layer), + pMonitor->m_name); return pLS; } @@ -84,7 +85,7 @@ CLayerSurface::~CLayerSurface() { } void CLayerSurface::onDestroy() { - Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)m_layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} destroyed", rc<uintptr_t>(m_layerSurface.get())); const auto PMONITOR = m_monitor.lock(); @@ -130,7 +131,7 @@ void CLayerSurface::onDestroy() { } void CLayerSurface::onMap() { - Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)m_layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} mapped", rc<uintptr_t>(m_layerSurface.get())); m_mapped = true; m_interactivity = m_layerSurface->m_current.interactivity; @@ -196,7 +197,7 @@ void CLayerSurface::onMap() { } void CLayerSurface::onUnmap() { - Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)m_layerSurface.get()); + Debug::log(LOG, "LayerSurface {:x} unmapped", rc<uintptr_t>(m_layerSurface.get())); g_pEventManager->postEvent(SHyprIPCEvent{.event = "closelayer", .data = m_layerSurface->m_layerNamespace}); EMIT_HOOK_EVENT("closeLayer", m_self.lock()); @@ -249,8 +250,8 @@ void CLayerSurface::onUnmap() { CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height}; g_pHyprRenderer->damageBox(geomFixed); - geomFixed = {m_geometry.x + (int)PMONITOR->m_position.x, m_geometry.y + (int)PMONITOR->m_position.y, (int)m_layerSurface->m_surface->m_current.size.x, - (int)m_layerSurface->m_surface->m_current.size.y}; + geomFixed = {m_geometry.x + sc<int>(PMONITOR->m_position.x), m_geometry.y + sc<int>(PMONITOR->m_position.y), sc<int>(m_layerSurface->m_surface->m_current.size.x), + sc<int>(m_layerSurface->m_surface->m_current.size.y)}; g_pHyprRenderer->damageBox(geomFixed); g_pInputManager->simulateMouseMovement(); @@ -596,7 +597,7 @@ int CLayerSurface::popupsCount() { return 0; int no = -1; // we have one dummy - m_popupHead->breadthfirst([](WP<CPopup> p, void* data) { *(int*)data += 1; }, &no); + m_popupHead->breadthfirst([](WP<CPopup> p, void* data) { *sc<int*>(data) += 1; }, &no); return no; } diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index 2b0fdbf8..7dc8ad53 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -90,7 +90,7 @@ void CPopup::initAllSignals() { void CPopup::onNewPopup(SP<CXDGPopupResource> popup) { const auto& POPUP = m_children.emplace_back(CPopup::create(popup, m_self)); POPUP->m_self = POPUP; - Debug::log(LOG, "New popup at {:x}", (uintptr_t)this); + Debug::log(LOG, "New popup at {:x}", rc<uintptr_t>(this)); } void CPopup::onDestroy() { @@ -104,7 +104,7 @@ void CPopup::onDestroy() { m_wlSurface.reset(); if (m_fadingOut && m_alpha->isBeingAnimated()) { - Debug::log(LOG, "popup {:x}: skipping full destroy, animating", (uintptr_t)this); + Debug::log(LOG, "popup {:x}: skipping full destroy, animating", rc<uintptr_t>(this)); return; } @@ -112,7 +112,7 @@ void CPopup::onDestroy() { } void CPopup::fullyDestroy() { - Debug::log(LOG, "popup {:x} fully destroying", (uintptr_t)this); + Debug::log(LOG, "popup {:x} fully destroying", rc<uintptr_t>(this)); g_pHyprRenderer->makeEGLCurrent(); std::erase_if(g_pHyprOpenGL->m_popupFramebuffers, [&](const auto& other) { return other.first.expired() || other.first == m_self; }); @@ -151,7 +151,7 @@ void CPopup::onMap() { m_alpha->setValueAndWarp(0.F); *m_alpha = 1.F; - Debug::log(LOG, "popup {:x}: mapped", (uintptr_t)this); + Debug::log(LOG, "popup {:x}: mapped", rc<uintptr_t>(this)); } void CPopup::onUnmap() { @@ -164,7 +164,7 @@ void CPopup::onUnmap() { return; } - Debug::log(LOG, "popup {:x}: unmapped", (uintptr_t)this); + Debug::log(LOG, "popup {:x}: unmapped", rc<uintptr_t>(this)); // if the popup committed a different size right now, we also need to damage the old size. const Vector2D MAX_DAMAGE_SIZE = {std::max(m_lastSize.x, m_resource->m_surface->m_surface->m_current.size.x), @@ -266,7 +266,7 @@ void CPopup::onCommit(bool ignoreSiblings) { } void CPopup::onReposition() { - Debug::log(LOG, "Popup {:x} requests reposition", (uintptr_t)this); + Debug::log(LOG, "Popup {:x} requests reposition", rc<uintptr_t>(this)); m_requestedReposition = true; diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index d1483db2..d868e1a9 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -148,7 +148,7 @@ void CWLSurface::destroy() { m_resource.reset(); - Debug::log(LOG, "CWLSurface {:x} called destroy()", (uintptr_t)this); + Debug::log(LOG, "CWLSurface {:x} called destroy()", rc<uintptr_t>(this)); } void CWLSurface::init() { @@ -161,7 +161,7 @@ void CWLSurface::init() { m_listeners.destroy = m_resource->m_events.destroy.listen([this] { destroy(); }); - Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this); + Debug::log(LOG, "CWLSurface {:x} called init()", rc<uintptr_t>(this)); } PHLWINDOW CWLSurface::getWindow() const { diff --git a/src/desktop/WLSurface.hpp b/src/desktop/WLSurface.hpp index 3aed5046..4d26d509 100644 --- a/src/desktop/WLSurface.hpp +++ b/src/desktop/WLSurface.hpp @@ -58,7 +58,7 @@ class CWLSurface { // track surface data and avoid dupes float m_lastScaleFloat = 0; int m_lastScaleInt = 0; - wl_output_transform m_lastTransform = (wl_output_transform)-1; + wl_output_transform m_lastTransform = sc<wl_output_transform>(-1); // CWLSurface& operator=(SP<CWLSurfaceResource> pSurface) { diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index a42a27fe..e9c386ce 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -163,7 +163,7 @@ SBoxExtents CWindow::getFullWindowExtents() { if (!popup->m_wlSurface || !popup->m_wlSurface->resource()) return; - CBox* pSurfaceExtents = (CBox*)data; + CBox* pSurfaceExtents = sc<CBox*>(data); CBox surf = CBox{popup->coordsRelativeToParent(), popup->size()}; pSurfaceExtents->x = std::min(surf.x, pSurfaceExtents->x); pSurfaceExtents->y = std::min(surf.y, pSurfaceExtents->y); @@ -215,7 +215,7 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { POS = PMONITOR->m_position; SIZE = PMONITOR->m_size; - return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; + return CBox{sc<int>(POS.x), sc<int>(POS.y), sc<int>(SIZE.x), sc<int>(SIZE.y)}; } if (DELTALESSTHAN(POS.y - PMONITOR->m_position.y, PMONITOR->m_reservedTopLeft.y, 1)) { @@ -233,7 +233,7 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { SIZE.y += PMONITOR->m_reservedBottomRight.y; } - return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; + return CBox{sc<int>(POS.x), sc<int>(POS.y), sc<int>(SIZE.x), sc<int>(SIZE.y)}; } SBoxExtents CWindow::getWindowExtentsUnified(uint64_t properties) { @@ -450,8 +450,8 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { g_pCompositor->updateAllWindowsAnimatedDecorationValues(); if (valid(pWorkspace)) { - g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindow", .data = std::format("{:x},{}", (uintptr_t)this, pWorkspace->m_name)}); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindowv2", .data = std::format("{:x},{},{}", (uintptr_t)this, pWorkspace->m_id, pWorkspace->m_name)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindow", .data = std::format("{:x},{}", rc<uintptr_t>(this), pWorkspace->m_name)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindowv2", .data = std::format("{:x},{},{}", rc<uintptr_t>(this), pWorkspace->m_id, pWorkspace->m_name)}); EMIT_HOOK_EVENT("moveWindow", (std::vector<std::any>{m_self.lock(), pWorkspace})); } @@ -603,7 +603,7 @@ void CWindow::onBorderAngleAnimEnd(WP<CBaseAnimatedVariable> pav) { if (PAV->getStyle() != "loop" || !PAV->enabled()) return; - const auto PANIMVAR = dynamic_cast<CAnimatedVariable<float>*>(PAV.get()); + const auto PANIMVAR = dc<CAnimatedVariable<float>*>(PAV.get()); PANIMVAR->setCallbackOnEnd(nullptr); // we remove the callback here because otherwise setvalueandwarp will recurse this @@ -785,7 +785,7 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) { const CVarList VARS(r->m_rule, 0, ' '); if (auto search = NWindowProperties::intWindowProperties.find(VARS[1]); search != NWindowProperties::intWindowProperties.end()) { try { - *(search->second(m_self.lock())) = CWindowOverridableVar(Hyprlang::INT(std::stoi(VARS[2])), priority); + *(search->second(m_self.lock())) = CWindowOverridableVar(sc<Hyprlang::INT>(std::stoi(VARS[2])), priority); } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); } } else if (auto search = NWindowProperties::floatWindowProperties.find(VARS[1]); search != NWindowProperties::floatWindowProperties.end()) { try { @@ -793,7 +793,7 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) { } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); } } else if (auto search = NWindowProperties::boolWindowProperties.find(VARS[1]); search != NWindowProperties::boolWindowProperties.end()) { try { - *(search->second(m_self.lock())) = CWindowOverridableVar(VARS[2].empty() ? true : (bool)std::stoi(VARS[2]), priority); + *(search->second(m_self.lock())) = CWindowOverridableVar(VARS[2].empty() ? true : sc<bool>(std::stoi(VARS[2])), priority); } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); } } break; @@ -852,16 +852,16 @@ bool CWindow::isInCurvedCorner(double x, double y) { double y1 = m_realPosition->value().y + m_realSize->value().y - ROUNDING; if (x < x0 && y < y0) { - return std::pow(x0 - x, ROUNDINGPOWER) + std::pow(y0 - y, ROUNDINGPOWER) > std::pow((double)ROUNDING, ROUNDINGPOWER); + return std::pow(x0 - x, ROUNDINGPOWER) + std::pow(y0 - y, ROUNDINGPOWER) > std::pow(sc<double>(ROUNDING), ROUNDINGPOWER); } if (x > x1 && y < y0) { - return std::pow(x - x1, ROUNDINGPOWER) + std::pow(y0 - y, ROUNDINGPOWER) > std::pow((double)ROUNDING, ROUNDINGPOWER); + return std::pow(x - x1, ROUNDINGPOWER) + std::pow(y0 - y, ROUNDINGPOWER) > std::pow(sc<double>(ROUNDING), ROUNDINGPOWER); } if (x < x0 && y > y1) { - return std::pow(x0 - x, ROUNDINGPOWER) + std::pow(y - y1, ROUNDINGPOWER) > std::pow((double)ROUNDING, ROUNDINGPOWER); + return std::pow(x0 - x, ROUNDINGPOWER) + std::pow(y - y1, ROUNDINGPOWER) > std::pow(sc<double>(ROUNDING), ROUNDINGPOWER); } if (x > x1 && y > y1) { - return std::pow(x - x1, ROUNDINGPOWER) + std::pow(y - y1, ROUNDINGPOWER) > std::pow((double)ROUNDING, ROUNDINGPOWER); + return std::pow(x - x1, ROUNDINGPOWER) + std::pow(y - y1, ROUNDINGPOWER) > std::pow(sc<double>(ROUNDING), ROUNDINGPOWER); } return false; @@ -887,7 +887,7 @@ void CWindow::applyGroupRules() { void CWindow::createGroup() { if (m_groupData.deny) { - Debug::log(LOG, "createGroup: window:{:x},title:{} is denied as a group, ignored", (uintptr_t)this, this->m_title); + Debug::log(LOG, "createGroup: window:{:x},title:{} is denied as a group, ignored", rc<uintptr_t>(this), this->m_title); return; } @@ -906,14 +906,14 @@ void CWindow::createGroup() { g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "togglegroup", .data = std::format("1,{:x}", (uintptr_t)this)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "togglegroup", .data = std::format("1,{:x}", rc<uintptr_t>(this))}); } } void CWindow::destroyGroup() { if (m_groupData.pNextWindow == m_self) { if (m_groupRules & GROUP_SET_ALWAYS) { - Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", (uintptr_t)this, this->m_title); + Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", rc<uintptr_t>(this), this->m_title); return; } m_groupData.pNextWindow.reset(); @@ -926,7 +926,7 @@ void CWindow::destroyGroup() { g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "togglegroup", .data = std::format("0,{:x}", (uintptr_t)this)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "togglegroup", .data = std::format("0,{:x}", rc<uintptr_t>(this))}); return; } @@ -940,7 +940,7 @@ void CWindow::destroyGroup() { curr->setHidden(false); members.push_back(curr); - addresses += std::format("{:x},", (uintptr_t)curr.get()); + addresses += std::format("{:x},", rc<uintptr_t>(curr.get())); } while (curr.get() != this); for (auto const& w : members) { @@ -1003,7 +1003,7 @@ int CWindow::getGroupSize() { bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) { static auto ALLOWGROUPMERGE = CConfigValue<Hyprlang::INT>("group:merge_groups_on_drag"); bool isGroup = m_groupData.pNextWindow; - bool disallowDragIntoGroup = g_pInputManager->m_wasDraggingWindow && isGroup && !bool(*ALLOWGROUPMERGE); + bool disallowDragIntoGroup = g_pInputManager->m_wasDraggingWindow && isGroup && !sc<bool>(*ALLOWGROUPMERGE); return !g_pKeybindManager->m_groupsLocked // global group lock disengaged && ((m_groupRules & GROUP_INVADE && m_firstMap) // window ignore local group locks, or || (!pWindow->getGroupHead()->m_groupData.locked // target unlocked @@ -1323,7 +1323,7 @@ int CWindow::popupsCount() { return 0; int no = -1; - m_popupHead->breadthfirst([](WP<CPopup> p, void* d) { *((int*)d) += 1; }, &no); + m_popupHead->breadthfirst([](WP<CPopup> p, void* d) { *sc<int*>(d) += 1; }, &no); return no; } @@ -1332,7 +1332,7 @@ int CWindow::surfacesCount() { return 1; int no = 0; - m_wlSurface->resource()->breadthfirst([](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { *((int*)d) += 1; }, &no); + m_wlSurface->resource()->breadthfirst([](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { *sc<int*>(d) += 1; }, &no); return no; } @@ -1350,7 +1350,7 @@ bool CWindow::isFullscreen() { } bool CWindow::isEffectiveInternalFSMode(const eFullscreenMode MODE) { - return (eFullscreenMode)std::bit_floor((uint8_t)m_fullscreenState.internal) == MODE; + return sc<eFullscreenMode>(std::bit_floor(sc<uint8_t>(m_fullscreenState.internal))) == MODE; } WORKSPACEID CWindow::workspaceID() { @@ -1415,7 +1415,7 @@ void CWindow::activate(bool force) { m_isUrgent = true; - g_pEventManager->postEvent(SHyprIPCEvent{.event = "urgent", .data = std::format("{:x}", (uintptr_t)this)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "urgent", .data = std::format("{:x}", rc<uintptr_t>(this))}); EMIT_HOOK_EVENT("urgent", m_self.lock()); if (!force && (!m_windowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_suppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_suppressedEvents & SUPPRESS_ACTIVATE))) @@ -1470,17 +1470,17 @@ void CWindow::onUpdateMeta() { if (m_title != NEWTITLE) { m_title = NEWTITLE; - g_pEventManager->postEvent(SHyprIPCEvent{.event = "windowtitle", .data = std::format("{:x}", (uintptr_t)this)}); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "windowtitlev2", .data = std::format("{:x},{}", (uintptr_t)this, m_title)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "windowtitle", .data = std::format("{:x}", rc<uintptr_t>(this))}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "windowtitlev2", .data = std::format("{:x},{}", rc<uintptr_t>(this), m_title)}); EMIT_HOOK_EVENT("windowTitle", m_self.lock()); if (m_self == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindow", .data = m_class + "," + m_title}); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", (uintptr_t)this)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", rc<uintptr_t>(this))}); EMIT_HOOK_EVENT("activeWindow", m_self.lock()); } - Debug::log(LOG, "Window {:x} set title to {}", (uintptr_t)this, m_title); + Debug::log(LOG, "Window {:x} set title to {}", rc<uintptr_t>(this), m_title); doUpdate = true; } @@ -1490,11 +1490,11 @@ void CWindow::onUpdateMeta() { if (m_self == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindow", .data = m_class + "," + m_title}); - g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", (uintptr_t)this)}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", rc<uintptr_t>(this))}); EMIT_HOOK_EVENT("activeWindow", m_self.lock()); } - Debug::log(LOG, "Window {:x} set class to {}", (uintptr_t)this, m_class); + Debug::log(LOG, "Window {:x} set class to {}", rc<uintptr_t>(this), m_class); doUpdate = true; } @@ -1549,7 +1549,7 @@ void CWindow::onResourceChangeX11() { // could be first assoc and we need to catch the class onUpdateMeta(); - Debug::log(LOG, "xwayland window {:x} -> association to {:x}", (uintptr_t)m_xwaylandSurface.get(), (uintptr_t)m_wlSurface->resource().get()); + Debug::log(LOG, "xwayland window {:x} -> association to {:x}", rc<uintptr_t>(m_xwaylandSurface.get()), rc<uintptr_t>(m_wlSurface->resource().get())); } void CWindow::onX11ConfigureRequest(CBox box) { @@ -1766,8 +1766,8 @@ void CWindow::updateX11SurfaceScale() { void CWindow::sendWindowSize(bool force) { const auto PMONITOR = m_monitor.lock(); - Debug::log(TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", (uintptr_t)this, this->m_title, m_realPosition->goal(), m_realSize->goal(), - force); + Debug::log(TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", rc<uintptr_t>(this), this->m_title, m_realPosition->goal(), + m_realSize->goal(), force); // TODO: this should be decoupled from setWindowSize IMO const auto REPORTPOS = realToReportPosition(); @@ -1799,7 +1799,7 @@ void CWindow::setContentType(NContentType::eContentType contentType) { m_wlSurface->resource()->m_contentType = PROTO::contentType->getContentType(m_wlSurface->resource()); // else disallow content type change if proto is used? - Debug::log(INFO, "ContentType for window {}", (int)contentType); + Debug::log(INFO, "ContentType for window {}", sc<int>(contentType)); m_wlSurface->resource()->m_contentType->m_value = contentType; } diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 8f421672..8f234a4b 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -106,8 +106,8 @@ struct SWindowData { CWindowOverridableVar<bool> noFollowMouse = false; CWindowOverridableVar<bool> noScreenShare = false; - CWindowOverridableVar<Hyprlang::INT> borderSize = {std::string("general:border_size"), Hyprlang::INT(0), std::nullopt}; - CWindowOverridableVar<Hyprlang::INT> rounding = {std::string("decoration:rounding"), Hyprlang::INT(0), std::nullopt}; + CWindowOverridableVar<Hyprlang::INT> borderSize = {std::string("general:border_size"), sc<Hyprlang::INT>(0), std::nullopt}; + CWindowOverridableVar<Hyprlang::INT> rounding = {std::string("decoration:rounding"), sc<Hyprlang::INT>(0), std::nullopt}; CWindowOverridableVar<Hyprlang::FLOAT> roundingPower = {std::string("decoration:rounding_power")}; CWindowOverridableVar<Hyprlang::FLOAT> scrollMouse = {std::string("input:scroll_factor")}; @@ -531,12 +531,12 @@ struct std::formatter<PHLWINDOW, CharT> : std::formatter<CharT> { auto format(PHLWINDOW const& w, FormatContext& ctx) const { auto&& out = ctx.out(); if (formatAddressOnly) - return std::format_to(out, "{:x}", (uintptr_t)w.get()); + return std::format_to(out, "{:x}", rc<uintptr_t>(w.get())); if (!w) return std::format_to(out, "[Window nullptr]"); std::format_to(out, "["); - std::format_to(out, "Window {:x}: title: \"{}\"", (uintptr_t)w.get(), w->m_title); + std::format_to(out, "Window {:x}: title: \"{}\"", rc<uintptr_t>(w.get()), w->m_title); if (formatWorkspace) std::format_to(out, ", workspace: {}", w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID); if (formatMonitor) diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index c14d6e38..1782950a 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -316,7 +316,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { const auto SHOULDBESPECIAL = configStringToInt(prop); - if (SHOULDBESPECIAL && (bool)*SHOULDBESPECIAL != m_isSpecialWorkspace) + if (SHOULDBESPECIAL && sc<bool>(*SHOULDBESPECIAL) != m_isSpecialWorkspace) return false; continue; } @@ -410,11 +410,11 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { int count; if (wantsCountGroup) - count = getGroups(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>((bool)wantsOnlyTiled), + count = getGroups(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>(sc<bool>(wantsOnlyTiled)), wantsOnlyPinned ? std::optional<bool>(wantsOnlyPinned) : std::nullopt, wantsCountVisible ? std::optional<bool>(wantsCountVisible) : std::nullopt); else - count = getWindows(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>((bool)wantsOnlyTiled), + count = getWindows(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>(sc<bool>(wantsOnlyTiled)), wantsOnlyPinned ? std::optional<bool>(wantsOnlyPinned) : std::nullopt, wantsCountVisible ? std::optional<bool>(wantsCountVisible) : std::nullopt); @@ -447,10 +447,10 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { WORKSPACEID count; if (wantsCountGroup) count = - getGroups(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>((bool)wantsOnlyTiled), + getGroups(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>(sc<bool>(wantsOnlyTiled)), wantsOnlyPinned ? std::optional<bool>(wantsOnlyPinned) : std::nullopt, wantsCountVisible ? std::optional<bool>(wantsCountVisible) : std::nullopt); else - count = getWindows(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>((bool)wantsOnlyTiled), + count = getWindows(wantsOnlyTiled == -1 ? std::nullopt : std::optional<bool>(sc<bool>(wantsOnlyTiled)), wantsOnlyPinned ? std::optional<bool>(wantsOnlyPinned) : std::nullopt, wantsCountVisible ? std::optional<bool>(wantsCountVisible) : std::nullopt); |
