From 21184404885cf61f7c10d2eb749478ef6b035dd2 Mon Sep 17 00:00:00 2001 From: davc0n Date: Mon, 28 Apr 2025 22:25:22 +0200 Subject: [PATCH] windows: refactor class member vars (#10168) --- src/Compositor.cpp | 379 +++--- src/config/ConfigManager.cpp | 170 +-- src/config/ConfigManager.hpp | 2 +- src/debug/HyprCtl.cpp | 43 +- src/desktop/Popup.cpp | 11 +- src/desktop/Subsurface.cpp | 12 +- src/desktop/WLSurface.cpp | 6 +- src/desktop/Window.cpp | 1038 ++++++++--------- src/desktop/Window.hpp | 249 ++-- src/desktop/WindowRule.cpp | 66 +- src/desktop/WindowRule.hpp | 50 +- src/desktop/Workspace.cpp | 32 +- src/events/Windows.cpp | 462 ++++---- src/helpers/Monitor.cpp | 24 +- src/layout/DwindleLayout.cpp | 164 +-- src/layout/IHyprLayout.cpp | 293 +++-- src/layout/MasterLayout.cpp | 126 +- src/managers/ANRManager.cpp | 25 +- src/managers/AnimationManager.cpp | 88 +- src/managers/KeybindManager.cpp | 334 +++--- src/managers/XWaylandManager.cpp | 86 +- src/managers/input/IdleInhibitor.cpp | 8 +- src/managers/input/InputManager.cpp | 52 +- src/managers/input/Tablets.cpp | 10 +- src/managers/input/Touch.cpp | 12 +- src/plugins/PluginAPI.cpp | 2 +- src/protocols/ForeignToplevel.cpp | 8 +- src/protocols/ForeignToplevelWlr.cpp | 36 +- src/protocols/LinuxDMABUF.cpp | 2 +- src/protocols/PointerConstraints.cpp | 4 +- src/protocols/ShortcutsInhibit.cpp | 2 +- src/protocols/TearingControl.cpp | 4 +- src/protocols/ToplevelExport.cpp | 20 +- src/render/OpenGL.cpp | 28 +- src/render/Renderer.cpp | 222 ++-- .../decorations/CHyprBorderDecoration.cpp | 28 +- .../decorations/CHyprDropShadowDecoration.cpp | 42 +- .../decorations/CHyprGroupBarDecoration.cpp | 82 +- .../decorations/DecorationPositioner.cpp | 14 +- src/render/pass/Pass.cpp | 2 +- src/render/pass/SurfacePassElement.cpp | 14 +- src/xwayland/XWM.cpp | 4 +- src/xwayland/XWayland.cpp | 2 +- 43 files changed, 2124 insertions(+), 2134 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a32ba056..be03edac 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -851,7 +851,7 @@ PHLMONITOR CCompositor::getMonitorFromVector(const Vector2D& point) { } void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) { - if (!pWindow->m_bFadingOut) { + if (!pWindow->m_fadingOut) { EMIT_HOOK_EVENT("destroyWindow", pWindow); std::erase_if(m_windows, [&](SP& el) { return el == pWindow; }); @@ -874,14 +874,13 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper // pinned windows on top of floating regardless if (properties & ALLOW_FLOATING) { for (auto const& w : m_windows | std::views::reverse) { - if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() && - w != pIgnoreWindow) { + if (w->m_isFloating && w->m_isMapped && !w->isHidden() && !w->m_X11ShouldntFocus && w->m_pinned && !w->m_windowData.noFocus.valueOrDefault() && w != pIgnoreWindow) { const auto BB = w->getWindowBoxUnified(properties); CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0); if (box.containsPoint(g_pPointerManager->position())) return w; - if (!w->m_bIsX11) { + if (!w->m_isX11) { if (w->hasPopupAt(pos)) return w; } @@ -896,13 +895,13 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular continue; - if (!w->m_pWorkspace) + if (!w->m_workspace) continue; - const auto PWINDOWMONITOR = w->m_pMonitor.lock(); + const auto PWINDOWMONITOR = w->m_monitor.lock(); // to avoid focusing windows behind special workspaces from other monitors - if (!*PSPECIALFALLTHRU && PWINDOWMONITOR && PWINDOWMONITOR->activeSpecialWorkspace && w->m_pWorkspace != PWINDOWMONITOR->activeSpecialWorkspace) { + if (!*PSPECIALFALLTHRU && PWINDOWMONITOR && PWINDOWMONITOR->activeSpecialWorkspace && w->m_workspace != PWINDOWMONITOR->activeSpecialWorkspace) { const auto BB = w->getWindowBoxUnified(properties); if (BB.x >= PWINDOWMONITOR->vecPosition.x && BB.y >= PWINDOWMONITOR->vecPosition.y && BB.x + BB.width <= PWINDOWMONITOR->vecPosition.x + PWINDOWMONITOR->vecSize.x && @@ -910,17 +909,17 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper continue; } - if (w->m_bIsFloating && w->m_bIsMapped && w->m_pWorkspace->isVisible() && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() && - w != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) { + if (w->m_isFloating && w->m_isMapped && w->m_workspace->isVisible() && !w->isHidden() && !w->m_pinned && !w->m_windowData.noFocus.valueOrDefault() && + w != pIgnoreWindow && (!aboveFullscreen || w->m_createdOverFullscreen)) { // OR windows should add focus to parent - if (w->m_bX11ShouldntFocus && !w->isX11OverrideRedirect()) + if (w->m_X11ShouldntFocus && !w->isX11OverrideRedirect()) continue; const auto BB = w->getWindowBoxUnified(properties); CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0); if (box.containsPoint(g_pPointerManager->position())) { - if (w->m_bIsX11 && w->isX11OverrideRedirect() && !w->m_pXWaylandSurface->wantsFocus()) { + if (w->m_isX11 && w->isX11OverrideRedirect() && !w->m_xwaylandSurface->wantsFocus()) { // Override Redirect return g_pCompositor->m_lastWindow.lock(); // we kinda trick everything here. // TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases. @@ -929,7 +928,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper return w; } - if (!w->m_bIsX11) { + if (!w->m_isX11) { if (w->hasPopupAt(pos)) return w; } @@ -964,11 +963,11 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper if (special != w->onSpecialWorkspace()) continue; - if (!w->m_pWorkspace) + if (!w->m_workspace) continue; - if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_bX11ShouldntFocus && - !w->m_sWindowData.noFocus.valueOrDefault() && w != pIgnoreWindow) { + if (!w->m_isX11 && !w->m_isFloating && w->m_isMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_X11ShouldntFocus && + !w->m_windowData.noFocus.valueOrDefault() && w != pIgnoreWindow) { if (w->hasPopupAt(pos)) return w; } @@ -978,12 +977,12 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper if (special != w->onSpecialWorkspace()) continue; - if (!w->m_pWorkspace) + if (!w->m_workspace) continue; - if (!w->m_bIsFloating && w->m_bIsMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_sWindowData.noFocus.valueOrDefault() && + if (!w->m_isFloating && w->m_isMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_X11ShouldntFocus && !w->m_windowData.noFocus.valueOrDefault() && w != pIgnoreWindow) { - CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize}; + CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_position, w->m_size}; if (box.containsPoint(pos)) return w; } @@ -1011,18 +1010,18 @@ SP CCompositor::vectorWindowToSurface(const Vector2D& pos, P if (!validMapped(pWindow)) return nullptr; - RASSERT(!pWindow->m_bIsX11, "Cannot call vectorWindowToSurface on an X11 window!"); + RASSERT(!pWindow->m_isX11, "Cannot call vectorWindowToSurface on an X11 window!"); // try popups first - const auto PPOPUP = pWindow->m_pPopupHead->at(pos); + const auto PPOPUP = pWindow->m_popupHead->at(pos); if (PPOPUP) { const auto OFF = PPOPUP->coordsRelativeToParent(); - sl = pos - pWindow->m_vRealPosition->goal() - OFF; + sl = pos - pWindow->m_realPosition->goal() - OFF; return PPOPUP->m_wlSurface->resource(); } - auto [surf, local] = pWindow->m_pWLSurface->resource()->at(pos - pWindow->m_vRealPosition->goal(), true); + auto [surf, local] = pWindow->m_wlSurface->resource()->at(pos - pWindow->m_realPosition->goal(), true); if (surf) { sl = local; return surf; @@ -1035,16 +1034,16 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo if (!validMapped(pWindow)) return {}; - if (pWindow->m_bIsX11) - return vec - pWindow->m_vRealPosition->goal(); + if (pWindow->m_isX11) + return vec - pWindow->m_realPosition->goal(); - const auto PPOPUP = pWindow->m_pPopupHead->at(vec); + const auto PPOPUP = pWindow->m_popupHead->at(vec); if (PPOPUP) return vec - PPOPUP->coordsGlobal(); std::tuple, Vector2D> iterData = {pSurface, {-1337, -1337}}; - pWindow->m_pWLSurface->resource()->breadthfirst( + pWindow->m_wlSurface->resource()->breadthfirst( [](SP surf, const Vector2D& offset, void* data) { const auto PDATA = (std::tuple, Vector2D>*)data; if (surf == std::get<0>(*PDATA)) @@ -1052,12 +1051,12 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo }, &iterData); - CBox geom = pWindow->m_pXDGSurface->current.geometry; + CBox geom = pWindow->m_xdgSurface->current.geometry; if (std::get<1>(iterData) == Vector2D{-1337, -1337}) - return vec - pWindow->m_vRealPosition->goal(); + return vec - pWindow->m_realPosition->goal(); - return vec - pWindow->m_vRealPosition->goal() - std::get<1>(iterData) + Vector2D{geom.x, geom.y}; + return vec - pWindow->m_realPosition->goal() - std::get<1>(iterData) + Vector2D{geom.x, geom.y}; } PHLMONITOR CCompositor::getMonitorFromOutput(SP out) { @@ -1095,7 +1094,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface return; } - if (pWindow && pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect() && !pWindow->m_pXWaylandSurface->wantsFocus()) + if (pWindow && pWindow->m_isX11 && pWindow->isX11OverrideRedirect() && !pWindow->m_xwaylandSurface->wantsFocus()) return; g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow); @@ -1108,7 +1107,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface const auto PLASTWINDOW = m_lastWindow.lock(); m_lastWindow.reset(); - if (PLASTWINDOW && PLASTWINDOW->m_bIsMapped) { + if (PLASTWINDOW && PLASTWINDOW->m_isMapped) { updateWindowAnimatedDecorationValues(PLASTWINDOW); g_pXWaylandManager->activateWindow(PLASTWINDOW, false); @@ -1129,7 +1128,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface return; } - if (pWindow->m_sWindowData.noFocus.valueOrDefault()) { + if (pWindow->m_windowData.noFocus.valueOrDefault()) { Debug::log(LOG, "Ignoring focus to nofocus window!"); return; } @@ -1137,13 +1136,13 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface if (m_lastWindow.lock() == pWindow && g_pSeatManager->state.keyboardFocus == pSurface && g_pSeatManager->state.keyboardFocus) return; - if (pWindow->m_bPinned) - pWindow->m_pWorkspace = m_lastMonitor->activeWorkspace; + if (pWindow->m_pinned) + pWindow->m_workspace = m_lastMonitor->activeWorkspace; - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); - if (!pWindow->m_pWorkspace || !pWindow->m_pWorkspace->isVisible()) { - const auto PWORKSPACE = pWindow->m_pWorkspace; + if (!pWindow->m_workspace || !pWindow->m_workspace->isVisible()) { + const auto PWORKSPACE = pWindow->m_workspace; // This is to fix incorrect feedback on the focus history. PWORKSPACE->m_lastFocusedWindow = pWindow; if (m_lastMonitor->activeWorkspace) @@ -1161,22 +1160,22 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface /* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which window focuses are "via keybinds" and which ones aren't. */ - if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace != pWindow->m_pWorkspace && !pWindow->m_bPinned && !*PSPECIALFALLTHROUGH) + if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace != pWindow->m_workspace && !pWindow->m_pinned && !*PSPECIALFALLTHROUGH) PMONITOR->setSpecialWorkspace(nullptr); // we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window - if (PLASTWINDOW && PLASTWINDOW->m_bIsMapped) { + if (PLASTWINDOW && PLASTWINDOW->m_isMapped) { PLASTWINDOW->updateDynamicRules(); updateWindowAnimatedDecorationValues(PLASTWINDOW); - if (!pWindow->m_bIsX11 || !pWindow->isX11OverrideRedirect()) + if (!pWindow->m_isX11 || !pWindow->isX11OverrideRedirect()) g_pXWaylandManager->activateWindow(PLASTWINDOW, false); } m_lastWindow = PLASTWINDOW; - const auto PWINDOWSURFACE = pSurface ? pSurface : pWindow->m_pWLSurface->resource(); + const auto PWINDOWSURFACE = pSurface ? pSurface : pWindow->m_wlSurface->resource(); focusSurface(PWINDOWSURFACE, pWindow); @@ -1187,11 +1186,11 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface updateWindowAnimatedDecorationValues(pWindow); - if (pWindow->m_bIsUrgent) - pWindow->m_bIsUrgent = false; + if (pWindow->m_isUrgent) + pWindow->m_isUrgent = false; // Send an event - g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindow", .data = pWindow->m_szClass + "," + pWindow->m_szTitle}); + g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindow", .data = pWindow->m_class + "," + pWindow->m_title}); g_pEventManager->postEvent(SHyprIPCEvent{.event = "activewindowv2", .data = std::format("{:x}", (uintptr_t)pWindow.get())}); EMIT_HOOK_EVENT("activeWindow", pWindow); @@ -1212,13 +1211,13 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface if (*PFOLLOWMOUSE == 0) g_pInputManager->sendMotionEventsToFocused(); - if (pWindow->m_sGroupData.pNextWindow) + if (pWindow->m_groupData.pNextWindow) pWindow->deactivateGroupMembers(); } void CCompositor::focusSurface(SP pSurface, PHLWINDOW pWindowOwner) { - if (g_pSeatManager->state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->state.keyboardFocus == pWindowOwner->m_pWLSurface->resource())) + if (g_pSeatManager->state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->state.keyboardFocus == pWindowOwner->m_wlSurface->resource())) return; // Don't focus when already focused on this. if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface)) @@ -1354,7 +1353,7 @@ void CCompositor::sanityCheckWorkspaces() { PHLWINDOW CCompositor::getUrgentWindow() { for (auto const& w : m_windows) { - if (w->m_bIsMapped && w->m_bIsUrgent) + if (w->m_isMapped && w->m_isUrgent) return w; } @@ -1365,10 +1364,10 @@ bool CCompositor::isWindowActive(PHLWINDOW pWindow) { if (m_lastWindow.expired() && !m_lastFocus) return false; - if (!pWindow->m_bIsMapped) + if (!pWindow->m_isMapped) return false; - const auto PSURFACE = pWindow->m_pWLSurface->resource(); + const auto PSURFACE = pWindow->m_wlSurface->resource(); return PSURFACE == m_lastFocus || pWindow == m_lastWindow.lock(); } @@ -1378,7 +1377,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) { return; if (top) - pWindow->m_bCreatedOverFullscreen = true; + pWindow->m_createdOverFullscreen = true; if (pWindow == (top ? m_windows.back() : m_windows.front())) return; @@ -1400,11 +1399,11 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) { } } - if (pw->m_bIsMapped) - g_pHyprRenderer->damageMonitor(pw->m_pMonitor.lock()); + if (pw->m_isMapped) + g_pHyprRenderer->damageMonitor(pw->m_monitor.lock()); }; - if (!pWindow->m_bIsX11) + if (!pWindow->m_isX11) moveToZ(pWindow, top); else { // move X11 window stack @@ -1418,7 +1417,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) { toMove.insert(toMove.begin(), pw); for (auto const& w : m_windows) { - if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->x11TransientFor() == pw && w != pw && std::ranges::find(toMove, w) == toMove.end()) { + if (w->m_isMapped && !w->isHidden() && w->m_isX11 && w->x11TransientFor() == pw && w != pw && std::ranges::find(toMove, w) == toMove.end()) { x11Stack(w, top, x11Stack); } } @@ -1436,14 +1435,14 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) { auto w = ww.lock(); - if (w->monitorID() != monid && w->m_pMonitor) + if (w->monitorID() != monid && w->m_monitor) continue; - if (!w->m_bFadingOut || w->m_fAlpha->value() == 0.f) { + if (!w->m_fadingOut || w->m_alpha->value() == 0.f) { - w->m_bFadingOut = false; + w->m_fadingOut = false; - if (!w->m_bReadyToDelete) + if (!w->m_readyToDelete) continue; removeWindowFromVectorSafe(w); @@ -1524,15 +1523,15 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) { if (!isDirection(dir)) return nullptr; - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); if (!PMONITOR) return nullptr; // ?? const auto WINDOWIDEALBB = pWindow->isFullscreen() ? CBox{PMONITOR->vecPosition, PMONITOR->vecSize} : pWindow->getWindowIdealBoundingBoxIgnoreReserved(); - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PWORKSPACE = pWindow->m_workspace; - return getWindowInDirection(WINDOWIDEALBB, PWORKSPACE, dir, pWindow, pWindow->m_bIsFloating); + return getWindowInDirection(WINDOWIDEALBB, PWORKSPACE, dir, pWindow, pWindow->m_isFloating); } PHLWINDOW CCompositor::getWindowInDirection(const CBox& box, PHLWORKSPACE pWorkspace, char dir, PHLWINDOW ignoreWindow, bool useVectorAngles) { @@ -1551,16 +1550,16 @@ PHLWINDOW CCompositor::getWindowInDirection(const CBox& box, PHLWORKSPACE pWorks if (!useVectorAngles) { for (auto const& w : m_windows) { - if (w == ignoreWindow || !w->m_pWorkspace || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && w->m_bIsFloating) || !w->m_pWorkspace->isVisible()) + if (w == ignoreWindow || !w->m_workspace || !w->m_isMapped || w->isHidden() || (!w->isFullscreen() && w->m_isFloating) || !w->m_workspace->isVisible()) continue; - if (pWorkspace->m_monitor == w->m_pMonitor && pWorkspace != w->m_pWorkspace) + if (pWorkspace->m_monitor == w->m_monitor && pWorkspace != w->m_workspace) continue; - if (pWorkspace->m_hasFullscreenWindow && !w->isFullscreen() && !w->m_bCreatedOverFullscreen) + if (pWorkspace->m_hasFullscreenWindow && !w->isFullscreen() && !w->m_createdOverFullscreen) continue; - if (!*PMONITORFALLBACK && pWorkspace->m_monitor != w->m_pMonitor) + if (!*PMONITORFALLBACK && pWorkspace->m_monitor != w->m_monitor) continue; const auto BWINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved(); @@ -1640,16 +1639,16 @@ PHLWINDOW CCompositor::getWindowInDirection(const CBox& box, PHLWORKSPACE pWorks constexpr float THRESHOLD = 0.3 * M_PI; for (auto const& w : m_windows) { - if (w == ignoreWindow || !w->m_bIsMapped || !w->m_pWorkspace || w->isHidden() || (!w->isFullscreen() && !w->m_bIsFloating) || !w->m_pWorkspace->isVisible()) + if (w == ignoreWindow || !w->m_isMapped || !w->m_workspace || w->isHidden() || (!w->isFullscreen() && !w->m_isFloating) || !w->m_workspace->isVisible()) continue; - if (pWorkspace->m_monitor == w->m_pMonitor && pWorkspace != w->m_pWorkspace) + if (pWorkspace->m_monitor == w->m_monitor && pWorkspace != w->m_workspace) continue; - if (pWorkspace->m_hasFullscreenWindow && !w->isFullscreen() && !w->m_bCreatedOverFullscreen) + if (pWorkspace->m_hasFullscreenWindow && !w->isFullscreen() && !w->m_createdOverFullscreen) continue; - if (!*PMONITORFALLBACK && pWorkspace->m_monitor != w->m_pMonitor) + if (!*PMONITORFALLBACK && pWorkspace->m_monitor != w->m_monitor) continue; const auto DIST = w->middle().distance(box.middle()); @@ -1677,18 +1676,18 @@ PHLWINDOW CCompositor::getWindowInDirection(const CBox& box, PHLWORKSPACE pWorks template static bool isWorkspaceMatches(WINDOWPTR pWindow, const WINDOWPTR w, bool anyWorkspace) { - return anyWorkspace ? w->m_pWorkspace && w->m_pWorkspace->isVisible() : w->m_pWorkspace == pWindow->m_pWorkspace; + return anyWorkspace ? w->m_workspace && w->m_workspace->isVisible() : w->m_workspace == pWindow->m_workspace; } template static bool isFloatingMatches(WINDOWPTR w, std::optional floating) { - return !floating.has_value() || w->m_bIsFloating == floating.value(); + return !floating.has_value() || w->m_isFloating == floating.value(); } template static bool isWindowAvailableForCycle(WINDOWPTR pWindow, WINDOWPTR w, bool focusableOnly, std::optional floating, bool anyWorkspace = false) { return isFloatingMatches(w, floating) && - (w != pWindow && isWorkspaceMatches(pWindow, w, anyWorkspace) && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.valueOrDefault())); + (w != pWindow && isWorkspaceMatches(pWindow, w, anyWorkspace) && w->m_isMapped && !w->isHidden() && (!focusableOnly || !w->m_windowData.noFocus.valueOrDefault())); } template @@ -1837,7 +1836,7 @@ PHLMONITOR CCompositor::getMonitorInDirection(PHLMONITOR pSourceMonitor, const c void CCompositor::updateAllWindowsAnimatedDecorationValues() { for (auto const& w : m_windows) { - if (!w->m_bIsMapped) + if (!w->m_isMapped) continue; updateWindowAnimatedDecorationValues(w); @@ -1872,48 +1871,48 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) { auto* const GROUPINACTIVELOCKEDCOL = (CGradientValueData*)(PGROUPINACTIVELOCKEDCOL.ptr())->getData(); auto setBorderColor = [&](CGradientValueData grad) -> void { - if (grad == pWindow->m_cRealBorderColor) + if (grad == pWindow->m_realBorderColor) return; - pWindow->m_cRealBorderColorPrevious = pWindow->m_cRealBorderColor; - pWindow->m_cRealBorderColor = grad; - pWindow->m_fBorderFadeAnimationProgress->setValueAndWarp(0.f); - *pWindow->m_fBorderFadeAnimationProgress = 1.f; + pWindow->m_realBorderColorPrevious = pWindow->m_realBorderColor; + pWindow->m_realBorderColor = grad; + pWindow->m_borderFadeAnimationProgress->setValueAndWarp(0.f); + *pWindow->m_borderFadeAnimationProgress = 1.f; }; - const bool IS_SHADOWED_BY_MODAL = pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel && pWindow->m_pXDGSurface->toplevel->anyChildModal(); + const bool IS_SHADOWED_BY_MODAL = pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel && pWindow->m_xdgSurface->toplevel->anyChildModal(); // border const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow); if (RENDERDATA.isBorderGradient) setBorderColor(*RENDERDATA.borderGradient); else { - const bool GROUPLOCKED = pWindow->m_sGroupData.pNextWindow.lock() ? pWindow->getGroupHead()->m_sGroupData.locked : false; + const bool GROUPLOCKED = pWindow->m_groupData.pNextWindow.lock() ? pWindow->getGroupHead()->m_groupData.locked : false; if (pWindow == m_lastWindow) { const auto* const ACTIVECOLOR = - !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? ACTIVECOL : NOGROUPACTIVECOL) : (GROUPLOCKED ? GROUPACTIVELOCKEDCOL : GROUPACTIVECOL); - setBorderColor(pWindow->m_sWindowData.activeBorderColor.valueOr(*ACTIVECOLOR)); + !pWindow->m_groupData.pNextWindow.lock() ? (!pWindow->m_groupData.deny ? ACTIVECOL : NOGROUPACTIVECOL) : (GROUPLOCKED ? GROUPACTIVELOCKEDCOL : GROUPACTIVECOL); + setBorderColor(pWindow->m_windowData.activeBorderColor.valueOr(*ACTIVECOLOR)); } else { - const auto* const INACTIVECOLOR = !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : - (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL); - setBorderColor(pWindow->m_sWindowData.inactiveBorderColor.valueOr(*INACTIVECOLOR)); + const auto* const INACTIVECOLOR = !pWindow->m_groupData.pNextWindow.lock() ? (!pWindow->m_groupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : + (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL); + setBorderColor(pWindow->m_windowData.inactiveBorderColor.valueOr(*INACTIVECOLOR)); } } // opacity - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PWORKSPACE = pWindow->m_workspace; if (pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN)) { - *pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.valueOrDefault().applyAlpha(*PFULLSCREENALPHA); + *pWindow->m_activeInactiveAlpha = pWindow->m_windowData.alphaFullscreen.valueOrDefault().applyAlpha(*PFULLSCREENALPHA); } else { if (pWindow == m_lastWindow) - *pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.valueOrDefault().applyAlpha(*PACTIVEALPHA); + *pWindow->m_activeInactiveAlpha = pWindow->m_windowData.alpha.valueOrDefault().applyAlpha(*PACTIVEALPHA); else - *pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.valueOrDefault().applyAlpha(*PINACTIVEALPHA); + *pWindow->m_activeInactiveAlpha = pWindow->m_windowData.alphaInactive.valueOrDefault().applyAlpha(*PINACTIVEALPHA); } // dim float goalDim = 1.F; - if (pWindow == m_lastWindow.lock() || pWindow->m_sWindowData.noDim.valueOrDefault() || !*PDIMENABLED) + if (pWindow == m_lastWindow.lock() || pWindow->m_windowData.noDim.valueOrDefault() || !*PDIMENABLED) goalDim = 0; else goalDim = *PDIMSTRENGTH; @@ -1921,16 +1920,16 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) { if (IS_SHADOWED_BY_MODAL) goalDim += (1.F - goalDim) / 2.F; - *pWindow->m_fDimPercent = goalDim; + *pWindow->m_dimPercent = goalDim; // shadow - if (!pWindow->isX11OverrideRedirect() && !pWindow->m_bX11DoesntWantBorders) { + if (!pWindow->isX11OverrideRedirect() && !pWindow->m_X11DoesntWantBorders) { if (pWindow == m_lastWindow) - *pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOL); + *pWindow->m_realShadowColor = CHyprColor(*PSHADOWCOL); else - *pWindow->m_cRealShadowColor = CHyprColor(*PSHADOWCOLINACTIVE != INT64_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL); + *pWindow->m_realShadowColor = CHyprColor(*PSHADOWCOLINACTIVE != INT64_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL); } else { - pWindow->m_cRealShadowColor->setValueAndWarp(CHyprColor(0, 0, 0, 0)); // no shadow + pWindow->m_realShadowColor->setValueAndWarp(CHyprColor(0, 0, 0, 0)); // no shadow } pWindow->updateWindowDecos(); @@ -1963,21 +1962,21 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor PWORKSPACEA->moveToMonitor(pMonitorB->ID); for (auto const& w : m_windows) { - if (w->m_pWorkspace == PWORKSPACEA) { - if (w->m_bPinned) { - w->m_pWorkspace = PWORKSPACEB; + if (w->m_workspace == PWORKSPACEA) { + if (w->m_pinned) { + w->m_workspace = PWORKSPACEB; continue; } - w->m_pMonitor = pMonitorB; + w->m_monitor = pMonitorB; // additionally, move floating and fs windows manually - if (w->m_bIsFloating) - *w->m_vRealPosition = w->m_vRealPosition->goal() - pMonitorA->vecPosition + pMonitorB->vecPosition; + if (w->m_isFloating) + *w->m_realPosition = w->m_realPosition->goal() - pMonitorA->vecPosition + pMonitorB->vecPosition; if (w->isFullscreen()) { - *w->m_vRealPosition = pMonitorB->vecPosition; - *w->m_vRealSize = pMonitorB->vecSize; + *w->m_realPosition = pMonitorB->vecPosition; + *w->m_realSize = pMonitorB->vecSize; } w->updateToplevel(); @@ -1988,21 +1987,21 @@ void CCompositor::swapActiveWorkspaces(PHLMONITOR pMonitorA, PHLMONITOR pMonitor PWORKSPACEB->moveToMonitor(pMonitorA->ID); for (auto const& w : m_windows) { - if (w->m_pWorkspace == PWORKSPACEB) { - if (w->m_bPinned) { - w->m_pWorkspace = PWORKSPACEA; + if (w->m_workspace == PWORKSPACEB) { + if (w->m_pinned) { + w->m_workspace = PWORKSPACEA; continue; } - w->m_pMonitor = pMonitorA; + w->m_monitor = pMonitorA; // additionally, move floating and fs windows manually - if (w->m_bIsFloating) - *w->m_vRealPosition = w->m_vRealPosition->goal() - pMonitorB->vecPosition + pMonitorA->vecPosition; + if (w->m_isFloating) + *w->m_realPosition = w->m_realPosition->goal() - pMonitorB->vecPosition + pMonitorA->vecPosition; if (w->isFullscreen()) { - *w->m_vRealPosition = pMonitorA->vecPosition; - *w->m_vRealSize = pMonitorA->vecSize; + *w->m_realPosition = pMonitorA->vecPosition; + *w->m_realSize = pMonitorA->vecSize; } w->updateToplevel(); @@ -2168,28 +2167,28 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, PHLMONITOR pMo pWorkspace->moveToMonitor(pMonitor->ID); for (auto const& w : m_windows) { - if (w->m_pWorkspace == pWorkspace) { - if (w->m_bPinned) { - w->m_pWorkspace = g_pCompositor->getWorkspaceByID(nextWorkspaceOnMonitorID); + if (w->m_workspace == pWorkspace) { + if (w->m_pinned) { + w->m_workspace = g_pCompositor->getWorkspaceByID(nextWorkspaceOnMonitorID); continue; } - w->m_pMonitor = pMonitor; + w->m_monitor = pMonitor; // additionally, move floating and fs windows manually - if (w->m_bIsMapped && !w->isHidden()) { + if (w->m_isMapped && !w->isHidden()) { if (POLDMON) { - if (w->m_bIsFloating) - *w->m_vRealPosition = w->m_vRealPosition->goal() - POLDMON->vecPosition + pMonitor->vecPosition; + if (w->m_isFloating) + *w->m_realPosition = w->m_realPosition->goal() - POLDMON->vecPosition + pMonitor->vecPosition; if (w->isFullscreen()) { - *w->m_vRealPosition = pMonitor->vecPosition; - *w->m_vRealSize = pMonitor->vecSize; + *w->m_realPosition = pMonitor->vecPosition; + *w->m_realSize = pMonitor->vecSize; } } else - *w->m_vRealPosition = Vector2D{ - (pMonitor->vecSize.x != 0) ? (int)w->m_vRealPosition->goal().x % (int)pMonitor->vecSize.x : 0, - (pMonitor->vecSize.y != 0) ? (int)w->m_vRealPosition->goal().y % (int)pMonitor->vecSize.y : 0, + *w->m_realPosition = Vector2D{ + (pMonitor->vecSize.x != 0) ? (int)w->m_realPosition->goal().x % (int)pMonitor->vecSize.x : 0, + (pMonitor->vecSize.y != 0) ? (int)w->m_realPosition->goal().y % (int)pMonitor->vecSize.y : 0, }; } @@ -2260,15 +2259,15 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) { const auto FULLSCREEN = pWorkspace->m_hasFullscreenWindow; for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == pWorkspace) { + if (w->m_workspace == pWorkspace) { - if (w->m_bFadingOut || w->m_bPinned || w->isFullscreen()) + if (w->m_fadingOut || w->m_pinned || w->isFullscreen()) continue; if (!FULLSCREEN) - *w->m_fAlpha = 1.f; + *w->m_alpha = 1.f; else if (!w->isFullscreen()) - *w->m_fAlpha = !w->m_bCreatedOverFullscreen ? 0.f : 1.f; + *w->m_alpha = !w->m_createdOverFullscreen ? 0.f : 1.f; } } @@ -2284,21 +2283,21 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) { void CCompositor::changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON) { setWindowFullscreenClient(PWINDOW, - (eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_sFullscreenState.client | (uint8_t)MODE : ((uint8_t)PWINDOW->m_sFullscreenState.client & (uint8_t)~MODE))); + (eFullscreenMode)(ON ? (uint8_t)PWINDOW->m_fullscreenState.client | (uint8_t)MODE : ((uint8_t)PWINDOW->m_fullscreenState.client & (uint8_t)~MODE))); } void CCompositor::setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) { - if (PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault()) + if (PWINDOW->m_windowData.syncFullscreen.valueOrDefault()) setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE}); else - setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = PWINDOW->m_sFullscreenState.client}); + setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = PWINDOW->m_fullscreenState.client}); } void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE) { - if (PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault()) + if (PWINDOW->m_windowData.syncFullscreen.valueOrDefault()) setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = MODE, .client = MODE}); else - setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = MODE}); + setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = MODE}); } void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenState state) { @@ -2311,35 +2310,35 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS state.internal = std::clamp(state.internal, (eFullscreenMode)0, FSMODE_MAX); state.client = std::clamp(state.client, (eFullscreenMode)0, FSMODE_MAX); - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); - const auto PWORKSPACE = PWINDOW->m_pWorkspace; + const auto PMONITOR = PWINDOW->m_monitor.lock(); + const auto PWORKSPACE = PWINDOW->m_workspace; - const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_sFullscreenState.internal); + const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_fullscreenState.internal); const eFullscreenMode EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)state.internal); - if (PWINDOW->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE && EFFECTIVE_MODE != FSMODE_NONE) + if (PWINDOW->m_isFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE && EFFECTIVE_MODE != FSMODE_NONE) g_pHyprRenderer->damageWindow(PWINDOW); - if (*PALLOWPINFULLSCREEN && !PWINDOW->m_bPinFullscreened && !PWINDOW->isFullscreen() && PWINDOW->m_bPinned) { - PWINDOW->m_bPinned = false; - PWINDOW->m_bPinFullscreened = true; + if (*PALLOWPINFULLSCREEN && !PWINDOW->m_pinFullscreened && !PWINDOW->isFullscreen() && PWINDOW->m_pinned) { + PWINDOW->m_pinned = false; + PWINDOW->m_pinFullscreened = true; } if (PWORKSPACE->m_hasFullscreenWindow && !PWINDOW->isFullscreen()) setWindowFullscreenInternal(PWORKSPACE->getFullscreenWindow(), FSMODE_NONE); - const bool CHANGEINTERNAL = !PWINDOW->m_bPinned && CURRENT_EFFECTIVE_MODE != EFFECTIVE_MODE; + const bool CHANGEINTERNAL = !PWINDOW->m_pinned && CURRENT_EFFECTIVE_MODE != EFFECTIVE_MODE; - if (*PALLOWPINFULLSCREEN && PWINDOW->m_bPinFullscreened && PWINDOW->isFullscreen() && !PWINDOW->m_bPinned && state.internal == FSMODE_NONE) { - PWINDOW->m_bPinned = true; - PWINDOW->m_bPinFullscreened = false; + if (*PALLOWPINFULLSCREEN && PWINDOW->m_pinFullscreened && PWINDOW->isFullscreen() && !PWINDOW->m_pinned && state.internal == FSMODE_NONE) { + PWINDOW->m_pinned = true; + PWINDOW->m_pinFullscreened = false; } // TODO: update the state on syncFullscreen changes - if (!CHANGEINTERNAL && PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault()) + if (!CHANGEINTERNAL && PWINDOW->m_windowData.syncFullscreen.valueOrDefault()) return; - PWINDOW->m_sFullscreenState.client = state.client; + PWINDOW->m_fullscreenState.client = state.client; g_pXWaylandManager->setWindowFullscreen(PWINDOW, state.client & FSMODE_FULLSCREEN); if (!CHANGEINTERNAL) { @@ -2351,9 +2350,9 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, CURRENT_EFFECTIVE_MODE, EFFECTIVE_MODE); - PWINDOW->m_sFullscreenState.internal = state.internal; - PWORKSPACE->m_fullscreenMode = EFFECTIVE_MODE; - PWORKSPACE->m_hasFullscreenWindow = EFFECTIVE_MODE != FSMODE_NONE; + PWINDOW->m_fullscreenState.internal = state.internal; + PWORKSPACE->m_fullscreenMode = EFFECTIVE_MODE; + PWORKSPACE->m_hasFullscreenWindow = EFFECTIVE_MODE != FSMODE_NONE; g_pEventManager->postEvent(SHyprIPCEvent{.event = "fullscreen", .data = std::to_string((int)EFFECTIVE_MODE != FSMODE_NONE)}); EMIT_HOOK_EVENT("fullscreen", PWINDOW); @@ -2364,8 +2363,8 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS // make all windows on the same workspace under the fullscreen window for (auto const& w : m_windows) { - if (w->m_pWorkspace == PWORKSPACE && !w->isFullscreen() && !w->m_bFadingOut && !w->m_bPinned) - w->m_bCreatedOverFullscreen = false; + if (w->m_workspace == PWORKSPACE && !w->isFullscreen() && !w->m_fadingOut && !w->m_pinned) + w->m_createdOverFullscreen = false; } updateFullscreenFadeOnWorkspace(PWORKSPACE); @@ -2383,20 +2382,20 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS // send a scanout tranche if we are entering fullscreen, and send a regular one if we aren't. // ignore if DS is disabled. if (*PDIRECTSCANOUT == 1 || (*PDIRECTSCANOUT == 2 && PWINDOW->getContentType() == CONTENT_TYPE_GAME)) - g_pHyprRenderer->setSurfaceScanoutMode(PWINDOW->m_pWLSurface->resource(), EFFECTIVE_MODE != FSMODE_NONE ? PMONITOR->self.lock() : nullptr); + g_pHyprRenderer->setSurfaceScanoutMode(PWINDOW->m_wlSurface->resource(), EFFECTIVE_MODE != FSMODE_NONE ? PMONITOR->self.lock() : nullptr); g_pConfigManager->ensureVRR(PMONITOR); } PHLWINDOW CCompositor::getX11Parent(PHLWINDOW pWindow) { - if (!pWindow->m_bIsX11) + if (!pWindow->m_isX11) return nullptr; for (auto const& w : m_windows) { - if (!w->m_bIsX11) + if (!w->m_isX11) continue; - if (w->m_pXWaylandSurface == pWindow->m_pXWaylandSurface->parent) + if (w->m_xwaylandSurface == pWindow->m_xwaylandSurface->parent) return w; } @@ -2429,7 +2428,7 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp_) { const bool FLOAT = regexp.starts_with("floating"); for (auto const& w : m_windows) { - if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_lastWindow->m_pWorkspace || w->isHidden()) + if (!w->m_isMapped || w->m_isFloating != FLOAT || w->m_workspace != m_lastWindow->m_workspace || w->isHidden()) continue; return w; @@ -2465,30 +2464,30 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp_) { } for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w))) + if (!w->m_isMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w))) continue; switch (mode) { case MODE_CLASS_REGEX: { - const auto windowClass = w->m_szClass; + const auto windowClass = w->m_class; if (!RE2::FullMatch(windowClass, regexCheck)) continue; break; } case MODE_INITIAL_CLASS_REGEX: { - const auto initialWindowClass = w->m_szInitialClass; + const auto initialWindowClass = w->m_initialClass; if (!RE2::FullMatch(initialWindowClass, regexCheck)) continue; break; } case MODE_TITLE_REGEX: { - const auto windowTitle = w->m_szTitle; + const auto windowTitle = w->m_title; if (!RE2::FullMatch(windowTitle, regexCheck)) continue; break; } case MODE_INITIAL_TITLE_REGEX: { - const auto initialWindowTitle = w->m_szInitialTitle; + const auto initialWindowTitle = w->m_initialTitle; if (!RE2::FullMatch(initialWindowTitle, regexCheck)) continue; break; @@ -2720,40 +2719,40 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor if (!pWindow || !pWorkspace) return; - if (pWindow->m_bPinned && pWorkspace->m_isSpecialWorkspace) + if (pWindow->m_pinned && pWorkspace->m_isSpecialWorkspace) return; - if (pWindow->m_pWorkspace == pWorkspace) + if (pWindow->m_workspace == pWorkspace) return; const bool FULLSCREEN = pWindow->isFullscreen(); - const auto FULLSCREENMODE = pWindow->m_sFullscreenState.internal; - const bool WASVISIBLE = pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible(); + const auto FULLSCREENMODE = pWindow->m_fullscreenState.internal; + const bool WASVISIBLE = pWindow->m_workspace && pWindow->m_workspace->isVisible(); if (FULLSCREEN) setWindowFullscreenInternal(pWindow, FSMODE_NONE); const PHLWINDOW pFirstWindowOnWorkspace = pWorkspace->getFirstWindow(); const int visibleWindowsOnWorkspace = pWorkspace->getWindows(std::nullopt, true); - const auto POSTOMON = pWindow->m_vRealPosition->goal() - (pWindow->m_pMonitor ? pWindow->m_pMonitor->vecPosition : Vector2D{}); + const auto POSTOMON = pWindow->m_realPosition->goal() - (pWindow->m_monitor ? pWindow->m_monitor->vecPosition : Vector2D{}); const auto PWORKSPACEMONITOR = pWorkspace->m_monitor.lock(); - if (!pWindow->m_bIsFloating) + if (!pWindow->m_isFloating) g_pLayoutManager->getCurrentLayout()->onWindowRemovedTiling(pWindow); pWindow->moveToWorkspace(pWorkspace); - pWindow->m_pMonitor = pWorkspace->m_monitor; + pWindow->m_monitor = pWorkspace->m_monitor; static auto PGROUPONMOVETOWORKSPACE = CConfigValue("group:group_on_movetoworkspace"); if (*PGROUPONMOVETOWORKSPACE && visibleWindowsOnWorkspace == 1 && pFirstWindowOnWorkspace && pFirstWindowOnWorkspace != pWindow && - pFirstWindowOnWorkspace->m_sGroupData.pNextWindow.lock() && pWindow->canBeGroupedInto(pFirstWindowOnWorkspace)) { + pFirstWindowOnWorkspace->m_groupData.pNextWindow.lock() && pWindow->canBeGroupedInto(pFirstWindowOnWorkspace)) { - pWindow->m_bIsFloating = pFirstWindowOnWorkspace->m_bIsFloating; // match the floating state. Needed to group tiled into floated and vice versa. - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); + pWindow->m_isFloating = pFirstWindowOnWorkspace->m_isFloating; // match the floating state. Needed to group tiled into floated and vice versa. + if (!pWindow->m_groupData.pNextWindow.expired()) { + PHLWINDOW next = pWindow->m_groupData.pNextWindow.lock(); while (next != pWindow) { - next->m_bIsFloating = pFirstWindowOnWorkspace->m_bIsFloating; // match the floating state of group members - next = next->m_sGroupData.pNextWindow.lock(); + next->m_isFloating = pFirstWindowOnWorkspace->m_isFloating; // match the floating state of group members + next = next->m_groupData.pNextWindow.lock(); } } @@ -2768,11 +2767,11 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor pWindow->addWindowDeco(makeUnique(pWindow)); } else { - if (!pWindow->m_bIsFloating) + if (!pWindow->m_isFloating) g_pLayoutManager->getCurrentLayout()->onWindowCreatedTiling(pWindow); - if (pWindow->m_bIsFloating) - *pWindow->m_vRealPosition = POSTOMON + PWORKSPACEMONITOR->vecPosition; + if (pWindow->m_isFloating) + *pWindow->m_realPosition = POSTOMON + PWORKSPACEMONITOR->vecPosition; } pWindow->updateToplevel(); @@ -2780,11 +2779,11 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor pWindow->uncacheWindowDecos(); pWindow->updateGroupOutputs(); - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); + if (!pWindow->m_groupData.pNextWindow.expired()) { + PHLWINDOW next = pWindow->m_groupData.pNextWindow.lock(); while (next != pWindow) { next->updateToplevel(); - next = next->m_sGroupData.pNextWindow.lock(); + next = next->m_groupData.pNextWindow.lock(); } } @@ -2792,22 +2791,22 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor setWindowFullscreenInternal(pWindow, FULLSCREENMODE); pWorkspace->updateWindows(); - if (pWindow->m_pWorkspace) - pWindow->m_pWorkspace->updateWindows(); + if (pWindow->m_workspace) + pWindow->m_workspace->updateWindows(); g_pCompositor->updateSuspendedStates(); - if (!WASVISIBLE && pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible()) { - pWindow->m_fMovingFromWorkspaceAlpha->setValueAndWarp(0.F); - *pWindow->m_fMovingFromWorkspaceAlpha = 1.F; + if (!WASVISIBLE && pWindow->m_workspace && pWindow->m_workspace->isVisible()) { + pWindow->m_movingFromWorkspaceAlpha->setValueAndWarp(0.F); + *pWindow->m_movingFromWorkspaceAlpha = 1.F; } } PHLWINDOW CCompositor::getForceFocus() { for (auto const& w : m_windows) { - if (!w->m_bIsMapped || w->isHidden() || !w->m_pWorkspace || !w->m_pWorkspace->isVisible()) + if (!w->m_isMapped || w->isHidden() || !w->m_workspace || !w->m_workspace->isVisible()) continue; - if (!w->m_bStayFocused) + if (!w->m_stayFocused) continue; return w; @@ -2971,10 +2970,10 @@ void CCompositor::setPreferredTransformForSurface(SP pSurfac void CCompositor::updateSuspendedStates() { for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped) + if (!w->m_isMapped) continue; - w->setSuspended(w->isHidden() || !w->m_pWorkspace || !w->m_pWorkspace->isVisible()); + w->setSuspended(w->isHidden() || !w->m_workspace || !w->m_workspace->isVisible()); } } @@ -3047,8 +3046,8 @@ void CCompositor::onNewMonitor(SP output) { checkDefaultCursorWarp(PNEWMONITOR); for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pMonitor == PNEWMONITOR) { - w->m_iLastSurfaceMonitorID = MONITOR_INVALID; + if (w->m_monitor == PNEWMONITOR) { + w->m_lastSurfaceMonitorID = MONITOR_INVALID; w->updateSurfaceScaleTransformDetails(); } } diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 9d177798..26b14dda 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1343,14 +1343,14 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, return std::vector>(); // if the window is unmapped, don't process exec rules yet. - shadowExec = shadowExec || !pWindow->m_bIsMapped; + shadowExec = shadowExec || !pWindow->m_isMapped; std::vector> returns; - Debug::log(LOG, "Searching for matching rules for {} (title: {})", pWindow->m_szClass, pWindow->m_szTitle); + Debug::log(LOG, "Searching for matching rules for {} (title: {})", pWindow->m_class, pWindow->m_title); // since some rules will be applied later, we need to store some flags - bool hasFloating = pWindow->m_bIsFloating; + bool hasFloating = pWindow->m_isFloating; bool hasFullscreen = pWindow->isFullscreen(); // local tags for dynamic tag rule match @@ -1358,50 +1358,50 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, for (auto const& rule : m_windowRules) { // check if we have a matching rule - if (!rule->v2) { + if (!rule->m_v2) { try { - if (rule->szValue.starts_with("tag:") && !tags.isTagged(rule->szValue.substr(4))) + if (rule->m_value.starts_with("tag:") && !tags.isTagged(rule->m_value.substr(4))) continue; - if (rule->szValue.starts_with("title:") && !rule->rV1Regex.passes(pWindow->m_szTitle)) + if (rule->m_value.starts_with("title:") && !rule->m_v1Regex.passes(pWindow->m_title)) continue; - if (!rule->rV1Regex.passes(pWindow->m_szClass)) + if (!rule->m_v1Regex.passes(pWindow->m_class)) continue; } catch (...) { - Debug::log(ERR, "Regex error at {}", rule->szValue); + Debug::log(ERR, "Regex error at {}", rule->m_value); continue; } } else { try { - if (rule->bX11 != -1) { - if (pWindow->m_bIsX11 != rule->bX11) + if (rule->m_X11 != -1) { + if (pWindow->m_isX11 != rule->m_X11) continue; } - if (rule->bFloating != -1) { - if (hasFloating != rule->bFloating) + if (rule->m_floating != -1) { + if (hasFloating != rule->m_floating) continue; } - if (rule->bFullscreen != -1) { - if (hasFullscreen != rule->bFullscreen) + if (rule->m_fullscreen != -1) { + if (hasFullscreen != rule->m_fullscreen) continue; } - if (rule->bPinned != -1) { - if (pWindow->m_bPinned != rule->bPinned) + if (rule->m_pinned != -1) { + if (pWindow->m_pinned != rule->m_pinned) continue; } - if (rule->bFocus != -1) { - if (rule->bFocus != (g_pCompositor->m_lastWindow.lock() == pWindow)) + if (rule->m_focus != -1) { + if (rule->m_focus != (g_pCompositor->m_lastWindow.lock() == pWindow)) continue; } - if (!rule->szFullscreenState.empty()) { - const auto ARGS = CVarList(rule->szFullscreenState, 2, ' '); + if (!rule->m_fullscreenState.empty()) { + const auto ARGS = CVarList(rule->m_fullscreenState, 2, ' '); // std::optional internalMode, clientMode; @@ -1419,82 +1419,82 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, else throw std::runtime_error("szFullscreenState client mode not valid"); - if (internalMode.has_value() && pWindow->m_sFullscreenState.internal != internalMode) + if (internalMode.has_value() && pWindow->m_fullscreenState.internal != internalMode) continue; - if (clientMode.has_value() && pWindow->m_sFullscreenState.client != clientMode) + if (clientMode.has_value() && pWindow->m_fullscreenState.client != clientMode) continue; } - if (!rule->szOnWorkspace.empty()) { - const auto PWORKSPACE = pWindow->m_pWorkspace; - if (!PWORKSPACE || !PWORKSPACE->matchesStaticSelector(rule->szOnWorkspace)) + if (!rule->m_onWorkspace.empty()) { + const auto PWORKSPACE = pWindow->m_workspace; + if (!PWORKSPACE || !PWORKSPACE->matchesStaticSelector(rule->m_onWorkspace)) continue; } - if (!rule->szContentType.empty()) { + if (!rule->m_contentType.empty()) { try { - const auto contentType = NContentType::fromString(rule->szContentType); + const auto contentType = NContentType::fromString(rule->m_contentType); if (pWindow->getContentType() != contentType) continue; - } catch (std::exception& e) { Debug::log(ERR, "Rule \"content:{}\" failed with: {}", rule->szContentType, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "Rule \"content:{}\" failed with: {}", rule->m_contentType, e.what()); } } - if (!rule->szXdgTag.empty()) { - if (pWindow->xdgTag().value_or("") != rule->szXdgTag) + if (!rule->m_xdgTag.empty()) { + if (pWindow->xdgTag().value_or("") != rule->m_xdgTag) continue; } - if (!rule->szWorkspace.empty()) { - const auto PWORKSPACE = pWindow->m_pWorkspace; + if (!rule->m_workspace.empty()) { + const auto PWORKSPACE = pWindow->m_workspace; if (!PWORKSPACE) continue; - if (rule->szWorkspace.starts_with("name:")) { - if (PWORKSPACE->m_name != rule->szWorkspace.substr(5)) + if (rule->m_workspace.starts_with("name:")) { + if (PWORKSPACE->m_name != rule->m_workspace.substr(5)) continue; } else { // number - if (!isNumber(rule->szWorkspace)) + if (!isNumber(rule->m_workspace)) throw std::runtime_error("szWorkspace not name: or number"); - const int64_t ID = std::stoll(rule->szWorkspace); + const int64_t ID = std::stoll(rule->m_workspace); if (PWORKSPACE->m_id != ID) continue; } } - if (!rule->szTag.empty() && !tags.isTagged(rule->szTag)) + if (!rule->m_tag.empty() && !tags.isTagged(rule->m_tag)) continue; - if (!rule->szClass.empty() && !rule->rClass.passes(pWindow->m_szClass)) + if (!rule->m_class.empty() && !rule->m_classRegex.passes(pWindow->m_class)) continue; - if (!rule->szTitle.empty() && !rule->rTitle.passes(pWindow->m_szTitle)) + if (!rule->m_title.empty() && !rule->m_titleRegex.passes(pWindow->m_title)) continue; - if (!rule->szInitialTitle.empty() && !rule->rInitialTitle.passes(pWindow->m_szInitialTitle)) + if (!rule->m_initialTitle.empty() && !rule->m_initialTitleRegex.passes(pWindow->m_initialTitle)) continue; - if (!rule->szInitialClass.empty() && !rule->rInitialClass.passes(pWindow->m_szInitialClass)) + if (!rule->m_initialClass.empty() && !rule->m_initialClassRegex.passes(pWindow->m_initialClass)) continue; } catch (std::exception& e) { - Debug::log(ERR, "Regex error at {} ({})", rule->szValue, e.what()); + Debug::log(ERR, "Regex error at {} ({})", rule->m_value, e.what()); continue; } } // applies. Read the rule and behave accordingly - Debug::log(LOG, "Window rule {} -> {} matched {}", rule->szRule, rule->szValue, pWindow); + Debug::log(LOG, "Window rule {} -> {} matched {}", rule->m_rule, rule->m_value, pWindow); returns.emplace_back(rule); // apply tag with local tags - if (rule->ruleType == CWindowRule::RULE_TAG) { - CVarList vars{rule->szRule, 0, 's', true}; + if (rule->m_ruleType == CWindowRule::RULE_TAG) { + CVarList vars{rule->m_rule, 0, 's', true}; if (vars.size() == 2 && vars[0] == "tag") tags.applyTag(vars[1], true); } @@ -1502,9 +1502,9 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, if (dynamic) continue; - if (rule->szRule == "float") + if (rule->m_rule == "float") hasFloating = true; - else if (rule->szRule == "fullscreen") + else if (rule->m_rule == "fullscreen") hasFullscreen = true; } @@ -2418,7 +2418,7 @@ std::optional CConfigManager::handleWindowRule(const std::string& c auto rule = makeShared(RULE, VALUE, true); - if (rule->ruleType == CWindowRule::RULE_INVALID && RULE != "unset") { + if (rule->m_ruleType == CWindowRule::RULE_INVALID && RULE != "unset") { Debug::log(ERR, "Invalid rulev2 found: {}", RULE); return "Invalid rulev2 found: " + RULE; } @@ -2504,103 +2504,103 @@ std::optional CConfigManager::handleWindowRule(const std::string& c }; if (TAGPOS != std::string::npos) - rule->szTag = extract(TAGPOS + 4); + rule->m_tag = extract(TAGPOS + 4); if (CLASSPOS != std::string::npos) { - rule->szClass = extract(CLASSPOS + 6); - rule->rClass = {rule->szClass}; + rule->m_class = extract(CLASSPOS + 6); + rule->m_classRegex = {rule->m_class}; } if (TITLEPOS != std::string::npos) { - rule->szTitle = extract(TITLEPOS + 6); - rule->rTitle = {rule->szTitle}; + rule->m_title = extract(TITLEPOS + 6); + rule->m_titleRegex = {rule->m_title}; } if (INITIALCLASSPOS != std::string::npos) { - rule->szInitialClass = extract(INITIALCLASSPOS + 13); - rule->rInitialClass = {rule->szInitialClass}; + rule->m_initialClass = extract(INITIALCLASSPOS + 13); + rule->m_initialClassRegex = {rule->m_initialClass}; } if (INITIALTITLEPOS != std::string::npos) { - rule->szInitialTitle = extract(INITIALTITLEPOS + 13); - rule->rInitialTitle = {rule->szInitialTitle}; + rule->m_initialTitle = extract(INITIALTITLEPOS + 13); + rule->m_initialTitleRegex = {rule->m_initialTitle}; } if (X11POS != std::string::npos) - rule->bX11 = extract(X11POS + 9) == "1" ? 1 : 0; + rule->m_X11 = extract(X11POS + 9) == "1" ? 1 : 0; if (FLOATPOS != std::string::npos) - rule->bFloating = extract(FLOATPOS + 9) == "1" ? 1 : 0; + rule->m_floating = extract(FLOATPOS + 9) == "1" ? 1 : 0; if (FULLSCREENPOS != std::string::npos) - rule->bFullscreen = extract(FULLSCREENPOS + 11) == "1" ? 1 : 0; + rule->m_fullscreen = extract(FULLSCREENPOS + 11) == "1" ? 1 : 0; if (PINNEDPOS != std::string::npos) - rule->bPinned = extract(PINNEDPOS + 7) == "1" ? 1 : 0; + rule->m_pinned = extract(PINNEDPOS + 7) == "1" ? 1 : 0; if (FULLSCREENSTATEPOS != std::string::npos) - rule->szFullscreenState = extract(FULLSCREENSTATEPOS + 16); + rule->m_fullscreenState = extract(FULLSCREENSTATEPOS + 16); if (WORKSPACEPOS != std::string::npos) - rule->szWorkspace = extract(WORKSPACEPOS + 10); + rule->m_workspace = extract(WORKSPACEPOS + 10); if (FOCUSPOS != std::string::npos) - rule->bFocus = extract(FOCUSPOS + 6) == "1" ? 1 : 0; + rule->m_focus = extract(FOCUSPOS + 6) == "1" ? 1 : 0; if (ONWORKSPACEPOS != std::string::npos) - rule->szOnWorkspace = extract(ONWORKSPACEPOS + 12); + rule->m_onWorkspace = extract(ONWORKSPACEPOS + 12); if (CONTENTTYPEPOS != std::string::npos) - rule->szContentType = extract(CONTENTTYPEPOS + 8); + rule->m_contentType = extract(CONTENTTYPEPOS + 8); if (XDGTAGPOS != std::string::npos) - rule->szXdgTag = extract(XDGTAGPOS + 8); + rule->m_xdgTag = extract(XDGTAGPOS + 8); if (RULE == "unset") { std::erase_if(m_windowRules, [&](const auto& other) { - if (!other->v2) - return other->szClass == rule->szClass && !rule->szClass.empty(); + if (!other->m_v2) + return other->m_class == rule->m_class && !rule->m_class.empty(); else { - if (!rule->szTag.empty() && rule->szTag != other->szTag) + if (!rule->m_tag.empty() && rule->m_tag != other->m_tag) return false; - if (!rule->szClass.empty() && rule->szClass != other->szClass) + if (!rule->m_class.empty() && rule->m_class != other->m_class) return false; - if (!rule->szTitle.empty() && rule->szTitle != other->szTitle) + if (!rule->m_title.empty() && rule->m_title != other->m_title) return false; - if (!rule->szInitialClass.empty() && rule->szInitialClass != other->szInitialClass) + if (!rule->m_initialClass.empty() && rule->m_initialClass != other->m_initialClass) return false; - if (!rule->szInitialTitle.empty() && rule->szInitialTitle != other->szInitialTitle) + if (!rule->m_initialTitle.empty() && rule->m_initialTitle != other->m_initialTitle) return false; - if (rule->bX11 != -1 && rule->bX11 != other->bX11) + if (rule->m_X11 != -1 && rule->m_X11 != other->m_X11) return false; - if (rule->bFloating != -1 && rule->bFloating != other->bFloating) + if (rule->m_floating != -1 && rule->m_floating != other->m_floating) return false; - if (rule->bFullscreen != -1 && rule->bFullscreen != other->bFullscreen) + if (rule->m_fullscreen != -1 && rule->m_fullscreen != other->m_fullscreen) return false; - if (rule->bPinned != -1 && rule->bPinned != other->bPinned) + if (rule->m_pinned != -1 && rule->m_pinned != other->m_pinned) return false; - if (!rule->szFullscreenState.empty() && rule->szFullscreenState != other->szFullscreenState) + if (!rule->m_fullscreenState.empty() && rule->m_fullscreenState != other->m_fullscreenState) return false; - if (!rule->szWorkspace.empty() && rule->szWorkspace != other->szWorkspace) + if (!rule->m_workspace.empty() && rule->m_workspace != other->m_workspace) return false; - if (rule->bFocus != -1 && rule->bFocus != other->bFocus) + if (rule->m_focus != -1 && rule->m_focus != other->m_focus) return false; - if (!rule->szOnWorkspace.empty() && rule->szOnWorkspace != other->szOnWorkspace) + if (!rule->m_onWorkspace.empty() && rule->m_onWorkspace != other->m_onWorkspace) return false; - if (!rule->szContentType.empty() && rule->szContentType != other->szContentType) + if (!rule->m_contentType.empty() && rule->m_contentType != other->m_contentType) return false; return true; @@ -3051,7 +3051,7 @@ void CConfigManager::ensurePersistentWorkspacesPresent() { } void CConfigManager::storeFloatingSize(PHLWINDOW window, const Vector2D& size) { - Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_szClass, window->m_szTitle); + Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_class, window->m_title); SFloatCache id{window}; m_mStoredFloatingSizes[id] = size; } @@ -3059,7 +3059,7 @@ void CConfigManager::storeFloatingSize(PHLWINDOW window, const Vector2D& size) { std::optional CConfigManager::getStoredFloatingSize(PHLWINDOW window) { SFloatCache id{window}; if (m_mStoredFloatingSizes.contains(id)) { - Debug::log(LOG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_szClass, window->m_szTitle); + Debug::log(LOG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_class, window->m_title); return m_mStoredFloatingSizes[id]; } return std::nullopt; diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 574d861d..eca2bb28 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -142,7 +142,7 @@ struct SFloatCache { size_t hash; SFloatCache(PHLWINDOW window) { - hash = std::hash{}(window->m_szClass) ^ (std::hash{}(window->m_szTitle) << 1); + hash = std::hash{}(window->m_class) ^ (std::hash{}(window->m_title) << 1); } bool operator==(const SFloatCache& other) const { diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index e66e4208..762f5d84 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -199,7 +199,7 @@ static std::string getTagsData(PHLWINDOW w, eHyprCtlOutputFormat format) { static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) { const bool isJson = format == eHyprCtlOutputFormat::FORMAT_JSON; - if (w->m_sGroupData.pNextWindow.expired()) + if (w->m_groupData.pNextWindow.expired()) return isJson ? "" : "0"; std::ostringstream result; @@ -211,7 +211,7 @@ static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) { result << std::format("\"0x{:x}\"", (uintptr_t)curr.get()); else result << std::format("{:x}", (uintptr_t)curr.get()); - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); // We've wrapped around to the start, break out without trailing comma if (curr == head) break; @@ -262,14 +262,13 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) { "xdgTag": "{}", "xdgDescription": "{}" }},)#", - (uintptr_t)w.get(), (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition->goal().x, (int)w->m_vRealPosition->goal().y, - (int)w->m_vRealSize->goal().x, (int)w->m_vRealSize->goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID, - escapeJSONStrings(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_name), ((int)w->m_bIsFloating == 1 ? "true" : "false"), (w->m_bIsPseudotiled ? "true" : "false"), - (int64_t)w->monitorID(), escapeJSONStrings(w->m_szClass), escapeJSONStrings(w->m_szTitle), escapeJSONStrings(w->m_szInitialClass), - escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"), - (uint8_t)w->m_sFullscreenState.internal, (uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format), (uintptr_t)w->m_pSwallowed.get(), - getFocusHistoryID(w), (g_pInputManager->isWindowInhibiting(w, false) ? "true" : "false"), escapeJSONStrings(w->xdgTag().value_or("")), - escapeJSONStrings(w->xdgDescription().value_or(""))); + (uintptr_t)w.get(), (w->m_isMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_realPosition->goal().x, (int)w->m_realPosition->goal().y, + (int)w->m_realSize->goal().x, (int)w->m_realSize->goal().y, w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID, + escapeJSONStrings(!w->m_workspace ? "" : w->m_workspace->m_name), ((int)w->m_isFloating == 1 ? "true" : "false"), (w->m_isPseudotiled ? "true" : "false"), + (int64_t)w->monitorID(), escapeJSONStrings(w->m_class), escapeJSONStrings(w->m_title), escapeJSONStrings(w->m_initialClass), escapeJSONStrings(w->m_initialTitle), + w->getPID(), ((int)w->m_isX11 == 1 ? "true" : "false"), (w->m_pinned ? "true" : "false"), (uint8_t)w->m_fullscreenState.internal, (uint8_t)w->m_fullscreenState.client, + getGroupedData(w, format), getTagsData(w, format), (uintptr_t)w->m_swallowed.get(), getFocusHistoryID(w), + (g_pInputManager->isWindowInhibiting(w, false) ? "true" : "false"), escapeJSONStrings(w->xdgTag().value_or("")), escapeJSONStrings(w->xdgDescription().value_or(""))); } else { return std::format( "Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tpseudo: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: " @@ -277,11 +276,11 @@ std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) { "{}\n\txwayland: {}\n\tpinned: " "{}\n\tfullscreen: {}\n\tfullscreenClient: {}\n\tgrouped: {}\n\ttags: {}\n\tswallowing: {:x}\n\tfocusHistoryID: {}\n\tinhibitingIdle: {}\n\txdgTag: " "{}\n\txdgDescription: {}\n\n", - (uintptr_t)w.get(), w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition->goal().x, (int)w->m_vRealPosition->goal().y, - (int)w->m_vRealSize->goal().x, (int)w->m_vRealSize->goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID, (!w->m_pWorkspace ? "" : w->m_pWorkspace->m_name), - (int)w->m_bIsFloating, (int)w->m_bIsPseudotiled, (int64_t)w->monitorID(), w->m_szClass, w->m_szTitle, w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), - (int)w->m_bIsX11, (int)w->m_bPinned, (uint8_t)w->m_sFullscreenState.internal, (uint8_t)w->m_sFullscreenState.client, getGroupedData(w, format), getTagsData(w, format), - (uintptr_t)w->m_pSwallowed.get(), getFocusHistoryID(w), (int)g_pInputManager->isWindowInhibiting(w, false), w->xdgTag().value_or(""), w->xdgDescription().value_or("")); + (uintptr_t)w.get(), w->m_title, (int)w->m_isMapped, (int)w->isHidden(), (int)w->m_realPosition->goal().x, (int)w->m_realPosition->goal().y, + (int)w->m_realSize->goal().x, (int)w->m_realSize->goal().y, w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID, (!w->m_workspace ? "" : w->m_workspace->m_name), + (int)w->m_isFloating, (int)w->m_isPseudotiled, (int64_t)w->monitorID(), w->m_class, w->m_title, w->m_initialClass, w->m_initialTitle, w->getPID(), (int)w->m_isX11, + (int)w->m_pinned, (uint8_t)w->m_fullscreenState.internal, (uint8_t)w->m_fullscreenState.client, getGroupedData(w, format), getTagsData(w, format), + (uintptr_t)w->m_swallowed.get(), getFocusHistoryID(w), (int)g_pInputManager->isWindowInhibiting(w, false), w->xdgTag().value_or(""), w->xdgDescription().value_or("")); } } @@ -291,7 +290,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque result += "["; for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all) + if (!w->m_isMapped && !g_pHyprCtl->m_currentRequestParams.all) continue; result += CHyprCtl::getWindowData(w, format); @@ -302,7 +301,7 @@ static std::string clientsRequest(eHyprCtlOutputFormat format, std::string reque result += "]"; } else { for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped && !g_pHyprCtl->m_currentRequestParams.all) + if (!w->m_isMapped && !g_pHyprCtl->m_currentRequestParams.all) continue; result += CHyprCtl::getWindowData(w, format); @@ -328,12 +327,12 @@ std::string CHyprCtl::getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat form }})#", w->m_id, escapeJSONStrings(w->m_name), escapeJSONStrings(PMONITOR ? PMONITOR->szName : "?"), escapeJSONStrings(PMONITOR ? std::to_string(PMONITOR->ID) : "null"), w->getWindows(), w->m_hasFullscreenWindow ? "true" : "false", - (uintptr_t)PLASTW.get(), PLASTW ? escapeJSONStrings(PLASTW->m_szTitle) : "", w->m_persistent ? "true" : "false"); + (uintptr_t)PLASTW.get(), PLASTW ? escapeJSONStrings(PLASTW->m_title) : "", w->m_persistent ? "true" : "false"); } else { return std::format( "workspace ID {} ({}) on monitor {}:\n\tmonitorID: {}\n\twindows: {}\n\thasfullscreen: {}\n\tlastwindow: 0x{:x}\n\tlastwindowtitle: {}\n\tispersistent: {}\n\n", w->m_id, w->m_name, PMONITOR ? PMONITOR->szName : "?", PMONITOR ? std::to_string(PMONITOR->ID) : "null", w->getWindows(), (int)w->m_hasFullscreenWindow, - (uintptr_t)PLASTW.get(), PLASTW ? PLASTW->m_szTitle : "", (int)w->m_persistent); + (uintptr_t)PLASTW.get(), PLASTW ? PLASTW->m_title : "", (int)w->m_persistent); } } @@ -1397,7 +1396,7 @@ static std::string decorationRequest(eHyprCtlOutputFormat format, std::string re std::string result = ""; if (format == eHyprCtlOutputFormat::FORMAT_JSON) { result += "["; - for (auto const& wd : PWINDOW->m_dWindowDecorations) { + for (auto const& wd : PWINDOW->m_windowDecorations) { result += "{\n\"decorationName\": \"" + wd->getDisplayName() + "\",\n\"priority\": " + std::to_string(wd->getPositioningInfo().priority) + "\n},"; } @@ -1405,7 +1404,7 @@ static std::string decorationRequest(eHyprCtlOutputFormat format, std::string re result += "]"; } else { result = +"Decoration\tPriority\n"; - for (auto const& wd : PWINDOW->m_dWindowDecorations) { + for (auto const& wd : PWINDOW->m_windowDecorations) { result += wd->getDisplayName() + "\t" + std::to_string(wd->getPositioningInfo().priority) + "\n"; } } @@ -1794,7 +1793,7 @@ std::string CHyprCtl::getReply(std::string request) { } for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || !w->m_pWorkspace || !w->m_pWorkspace->isVisible()) + if (!w->m_isMapped || !w->m_workspace || !w->m_workspace->isVisible()) continue; w->updateDynamicRules(); diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index 8043bc31..049db245 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -54,8 +54,7 @@ void CPopup::initAllSignals() { if (!m_resource) { if (!m_windowOwner.expired()) - m_listeners.newPopup = - m_windowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); + m_listeners.newPopup = m_windowOwner->m_xdgSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); else if (!m_layerOwner.expired()) m_listeners.newPopup = m_layerOwner->m_layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast>(d)); }); @@ -172,7 +171,7 @@ void CPopup::onCommit(bool ignoreSiblings) { return; } - if (!m_windowOwner.expired() && (!m_windowOwner->m_bIsMapped || !m_windowOwner->m_pWorkspace->m_visible)) { + if (!m_windowOwner.expired() && (!m_windowOwner->m_isMapped || !m_windowOwner->m_workspace->m_visible)) { m_lastSize = m_resource->surface->surface->current.size; static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); @@ -231,7 +230,7 @@ void CPopup::reposition() { SP CPopup::getT1Owner() { if (m_windowOwner) - return m_windowOwner->m_pWLSurface; + return m_windowOwner->m_wlSurface; else return m_layerOwner->m_surface; } @@ -266,7 +265,7 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) { Vector2D CPopup::t1ParentCoords() { if (!m_windowOwner.expired()) - return m_windowOwner->m_vRealPosition->value(); + return m_windowOwner->m_realPosition->value(); if (!m_layerOwner.expired()) return m_layerOwner->m_realPosition->value(); @@ -301,7 +300,7 @@ Vector2D CPopup::size() { void CPopup::sendScale() { if (!m_windowOwner.expired()) - g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_pWLSurface->m_lastScaleFloat); + g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_windowOwner->m_wlSurface->m_lastScaleFloat); else if (!m_layerOwner.expired()) g_pCompositor->setPreferredScaleForSurface(m_wlSurface->resource(), m_layerOwner->m_surface->m_lastScaleFloat); else diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index 60032ead..419c7e31 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -13,7 +13,7 @@ UP CSubsurface::create(PHLWINDOW pOwner) { subsurface->m_self = subsurface; subsurface->initSignals(); - subsurface->initExistingSubsurfaces(pOwner->m_pWLSurface->resource()); + subsurface->initExistingSubsurfaces(pOwner->m_wlSurface->resource()); return subsurface; } @@ -60,7 +60,7 @@ void CSubsurface::initSignals() { m_subsurface->surface->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast>(d)); }); } else { if (m_windowParent) - m_listeners.newSubsurface = m_windowParent->m_pWLSurface->resource()->events.newSubsurface.registerListener( + m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->events.newSubsurface.registerListener( [this](std::any d) { onNewSubsurface(std::any_cast>(d)); }); else if (m_popupParent) m_listeners.newSubsurface = @@ -74,7 +74,7 @@ void CSubsurface::checkSiblingDamage() { if (!m_parent) return; // ?????????? - const double SCALE = m_windowParent.lock() && m_windowParent->m_bIsX11 ? 1.0 / m_windowParent->m_fX11SurfaceScaledBy : 1.0; + const double SCALE = m_windowParent.lock() && m_windowParent->m_isX11 ? 1.0 / m_windowParent->m_X11SurfaceScaledBy : 1.0; for (auto const& n : m_parent->m_children) { if (n.get() == this) @@ -94,7 +94,7 @@ void CSubsurface::recheckDamageForSubsurfaces() { void CSubsurface::onCommit() { // no damaging if it's not visible - if (!m_windowParent.expired() && (!m_windowParent->m_bIsMapped || !m_windowParent->m_pWorkspace->m_visible)) { + if (!m_windowParent.expired() && (!m_windowParent->m_isMapped || !m_windowParent->m_workspace->m_visible)) { m_lastSize = m_wlSurface->resource()->current.size; static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); @@ -110,7 +110,7 @@ void CSubsurface::onCommit() { if (m_popupParent && !m_popupParent->inert() && m_popupParent->m_wlSurface) m_popupParent->recheckTree(); if (!m_windowParent.expired()) // I hate you firefox why are you doing this - m_windowParent->m_pPopupHead->recheckTree(); + m_windowParent->m_popupHead->recheckTree(); // I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox) checkSiblingDamage(); @@ -191,7 +191,7 @@ Vector2D CSubsurface::coordsGlobal() { Vector2D coords = coordsRelativeToParent(); if (!m_windowParent.expired()) - coords += m_windowParent->m_vRealPosition->value(); + coords += m_windowParent->m_realPosition->value(); else if (m_popupParent) coords += m_popupParent->coordsGlobal(); diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index 5d0a32de..d5e35be1 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -64,7 +64,7 @@ bool CWLSurface::small() const { const auto O = m_windowOwner.lock(); - return O->m_vReportedSize.x > m_resource->current.size.x + 1 || O->m_vReportedSize.y > m_resource->current.size.y + 1; + return O->m_reportedSize.x > m_resource->current.size.x + 1 || O->m_reportedSize.y > m_resource->current.size.y + 1; } Vector2D CWLSurface::correctSmallVec() const { @@ -74,7 +74,7 @@ Vector2D CWLSurface::correctSmallVec() const { const auto SIZE = getViewporterCorrectedSize(); const auto O = m_windowOwner.lock(); - return Vector2D{(O->m_vReportedSize.x - SIZE.x) / 2, (O->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_vRealSize->value() / O->m_vReportedSize); + return Vector2D{(O->m_reportedSize.x - SIZE.x) / 2, (O->m_reportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_realSize->value() / O->m_reportedSize); } Vector2D CWLSurface::correctSmallVecBuf() const { @@ -121,7 +121,7 @@ CRegion CWLSurface::computeDamage() const { damage.scale(SCALE); if (m_windowOwner) - damage.scale(m_windowOwner->m_fX11SurfaceScaledBy); // fix xwayland:force_zero_scaling stuff that will be fucked by the above a bit + damage.scale(m_windowOwner->m_X11SurfaceScaledBy); // fix xwayland:force_zero_scaling stuff that will be fucked by the above a bit return damage; } diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 4843c491..899c260a 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -38,19 +38,19 @@ using enum NContentType::eContentType; PHLWINDOW CWindow::create(SP surface) { PHLWINDOW pWindow = SP(new CWindow(surface)); - pWindow->m_pSelf = pWindow; - pWindow->m_bIsX11 = true; + pWindow->m_self = pWindow; + pWindow->m_isX11 = true; - g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER); - g_pAnimationManager->createAnimation(1.f, pWindow->m_fAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(1.f, pWindow->m_fActiveInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_cRealShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fDimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); - 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); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_realPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_realSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_borderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER); + g_pAnimationManager->createAnimation(0.f, pWindow->m_borderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER); + g_pAnimationManager->createAnimation(1.f, pWindow->m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(1.f, pWindow->m_activeInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); + g_pAnimationManager->createAnimation(0.f, pWindow->m_dimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_movingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_movingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); g_pAnimationManager->createAnimation(0.f, pWindow->m_notRespondingTint, g_pConfigManager->getAnimationPropertyConfig("fade"), pWindow, AVARDAMAGE_ENTIRE); pWindow->addWindowDeco(makeUnique(pWindow)); @@ -62,65 +62,65 @@ PHLWINDOW CWindow::create(SP surface) { PHLWINDOW CWindow::create(SP resource) { PHLWINDOW pWindow = SP(new CWindow(resource)); - pWindow->m_pSelf = pWindow; + pWindow->m_self = pWindow; resource->toplevel->window = pWindow; - g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_vRealSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fBorderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER); - g_pAnimationManager->createAnimation(1.f, pWindow->m_fAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(1.f, pWindow->m_fActiveInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE); - g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_cRealShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); - g_pAnimationManager->createAnimation(0.f, pWindow->m_fDimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); - 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); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_realPosition, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(Vector2D(0, 0), pWindow->m_realSize, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_borderFadeAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER); + g_pAnimationManager->createAnimation(0.f, pWindow->m_borderAngleAnimationProgress, g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER); + g_pAnimationManager->createAnimation(1.f, pWindow->m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(1.f, pWindow->m_activeInactiveAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realShadowColor, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW); + g_pAnimationManager->createAnimation(0.f, pWindow->m_dimPercent, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_movingToWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE); + g_pAnimationManager->createAnimation(0.f, pWindow->m_movingFromWorkspaceAlpha, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE); g_pAnimationManager->createAnimation(0.f, pWindow->m_notRespondingTint, g_pConfigManager->getAnimationPropertyConfig("fade"), pWindow, AVARDAMAGE_ENTIRE); pWindow->addWindowDeco(makeUnique(pWindow)); pWindow->addWindowDeco(makeUnique(pWindow)); - pWindow->m_pWLSurface->assign(pWindow->m_pXDGSurface->surface.lock(), pWindow); + pWindow->m_wlSurface->assign(pWindow->m_xdgSurface->surface.lock(), pWindow); return pWindow; } -CWindow::CWindow(SP resource) : m_pXDGSurface(resource) { - m_pWLSurface = CWLSurface::create(); +CWindow::CWindow(SP resource) : m_xdgSurface(resource) { + m_wlSurface = CWLSurface::create(); - listeners.map = m_pXDGSurface->events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); }); - listeners.ack = m_pXDGSurface->events.ack.registerListener([this](std::any d) { onAck(std::any_cast(d)); }); - listeners.unmap = m_pXDGSurface->events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); }); - listeners.destroy = m_pXDGSurface->events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); }); - listeners.commit = m_pXDGSurface->events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); }); - listeners.updateState = m_pXDGSurface->toplevel->events.stateChanged.registerListener([this](std::any d) { onUpdateState(); }); - listeners.updateMetadata = m_pXDGSurface->toplevel->events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); }); + m_listeners.map = m_xdgSurface->events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); }); + m_listeners.ack = m_xdgSurface->events.ack.registerListener([this](std::any d) { onAck(std::any_cast(d)); }); + m_listeners.unmap = m_xdgSurface->events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); }); + m_listeners.destroy = m_xdgSurface->events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); }); + m_listeners.commit = m_xdgSurface->events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); }); + m_listeners.updateState = m_xdgSurface->toplevel->events.stateChanged.registerListener([this](std::any d) { onUpdateState(); }); + m_listeners.updateMetadata = m_xdgSurface->toplevel->events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); }); } -CWindow::CWindow(SP surface) : m_pXWaylandSurface(surface) { - m_pWLSurface = CWLSurface::create(); +CWindow::CWindow(SP surface) : m_xwaylandSurface(surface) { + m_wlSurface = CWLSurface::create(); - listeners.map = m_pXWaylandSurface->events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); }); - listeners.unmap = m_pXWaylandSurface->events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); }); - listeners.destroy = m_pXWaylandSurface->events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); }); - listeners.commit = m_pXWaylandSurface->events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); }); - listeners.configureRequest = m_pXWaylandSurface->events.configureRequest.registerListener([this](std::any d) { onX11ConfigureRequest(std::any_cast(d)); }); - listeners.updateState = m_pXWaylandSurface->events.stateChanged.registerListener([this](std::any d) { onUpdateState(); }); - listeners.updateMetadata = m_pXWaylandSurface->events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); }); - listeners.resourceChange = m_pXWaylandSurface->events.resourceChange.registerListener([this](std::any d) { onResourceChangeX11(); }); - listeners.activate = m_pXWaylandSurface->events.activate.registerListener([this](std::any d) { Events::listener_activateX11(this, nullptr); }); + m_listeners.map = m_xwaylandSurface->events.map.registerListener([this](std::any d) { Events::listener_mapWindow(this, nullptr); }); + m_listeners.unmap = m_xwaylandSurface->events.unmap.registerListener([this](std::any d) { Events::listener_unmapWindow(this, nullptr); }); + m_listeners.destroy = m_xwaylandSurface->events.destroy.registerListener([this](std::any d) { Events::listener_destroyWindow(this, nullptr); }); + m_listeners.commit = m_xwaylandSurface->events.commit.registerListener([this](std::any d) { Events::listener_commitWindow(this, nullptr); }); + m_listeners.configureRequest = m_xwaylandSurface->events.configureRequest.registerListener([this](std::any d) { onX11ConfigureRequest(std::any_cast(d)); }); + m_listeners.updateState = m_xwaylandSurface->events.stateChanged.registerListener([this](std::any d) { onUpdateState(); }); + m_listeners.updateMetadata = m_xwaylandSurface->events.metadataChanged.registerListener([this](std::any d) { onUpdateMeta(); }); + m_listeners.resourceChange = m_xwaylandSurface->events.resourceChange.registerListener([this](std::any d) { onResourceChangeX11(); }); + m_listeners.activate = m_xwaylandSurface->events.activate.registerListener([this](std::any d) { Events::listener_activateX11(this, nullptr); }); - if (m_pXWaylandSurface->overrideRedirect) - listeners.setGeometry = m_pXWaylandSurface->events.setGeometry.registerListener([this](std::any d) { Events::listener_unmanagedSetGeometry(this, nullptr); }); + if (m_xwaylandSurface->overrideRedirect) + m_listeners.setGeometry = m_xwaylandSurface->events.setGeometry.registerListener([this](std::any d) { Events::listener_unmanagedSetGeometry(this, nullptr); }); } CWindow::~CWindow() { - if (g_pCompositor->m_lastWindow == m_pSelf) { + if (g_pCompositor->m_lastWindow == m_self) { g_pCompositor->m_lastFocus.reset(); g_pCompositor->m_lastWindow.reset(); } - events.destroy.emit(); + m_events.destroy.emit(); if (!g_pHyprOpenGL) return; @@ -130,20 +130,20 @@ CWindow::~CWindow() { } SBoxExtents CWindow::getFullWindowExtents() { - if (m_bFadingOut) - return m_eOriginalClosedExtents; + if (m_fadingOut) + return m_originalClosedExtents; const int BORDERSIZE = getRealBorderSize(); - if (m_sWindowData.dimAround.valueOrDefault()) { - if (const auto PMONITOR = m_pMonitor.lock(); PMONITOR) - return {{m_vRealPosition->value().x - PMONITOR->vecPosition.x, m_vRealPosition->value().y - PMONITOR->vecPosition.y}, - {PMONITOR->vecSize.x - (m_vRealPosition->value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition->value().y - PMONITOR->vecPosition.y)}}; + if (m_windowData.dimAround.valueOrDefault()) { + if (const auto PMONITOR = m_monitor.lock(); PMONITOR) + return {{m_realPosition->value().x - PMONITOR->vecPosition.x, m_realPosition->value().y - PMONITOR->vecPosition.y}, + {PMONITOR->vecSize.x - (m_realPosition->value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_realPosition->value().y - PMONITOR->vecPosition.y)}}; } SBoxExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}}; - const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock()); + const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock()); if (EXTENTS.topLeft.x > maxExtents.topLeft.x) maxExtents.topLeft.x = EXTENTS.topLeft.x; @@ -157,10 +157,10 @@ SBoxExtents CWindow::getFullWindowExtents() { if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y) maxExtents.bottomRight.y = EXTENTS.bottomRight.y; - if (m_pWLSurface->exists() && !m_bIsX11 && m_pPopupHead) { + if (m_wlSurface->exists() && !m_isX11 && m_popupHead) { CBox surfaceExtents = {0, 0, 0, 0}; // TODO: this could be better, perhaps make a getFullWindowRegion? - m_pPopupHead->breadthfirst( + m_popupHead->breadthfirst( [](WP popup, void* data) { if (!popup->m_wlSurface || !popup->m_wlSurface->resource()) return; @@ -184,38 +184,38 @@ SBoxExtents CWindow::getFullWindowExtents() { if (-surfaceExtents.y > maxExtents.topLeft.y) maxExtents.topLeft.y = -surfaceExtents.y; - if (surfaceExtents.x + surfaceExtents.width > m_pWLSurface->resource()->current.size.x + maxExtents.bottomRight.x) - maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_pWLSurface->resource()->current.size.x; + if (surfaceExtents.x + surfaceExtents.width > m_wlSurface->resource()->current.size.x + maxExtents.bottomRight.x) + maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_wlSurface->resource()->current.size.x; - if (surfaceExtents.y + surfaceExtents.height > m_pWLSurface->resource()->current.size.y + maxExtents.bottomRight.y) - maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_pWLSurface->resource()->current.size.y; + if (surfaceExtents.y + surfaceExtents.height > m_wlSurface->resource()->current.size.y + maxExtents.bottomRight.y) + maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_wlSurface->resource()->current.size.y; } return maxExtents; } CBox CWindow::getFullWindowBoundingBox() { - if (m_sWindowData.dimAround.valueOrDefault()) { - if (const auto PMONITOR = m_pMonitor.lock(); PMONITOR) + if (m_windowData.dimAround.valueOrDefault()) { + if (const auto PMONITOR = m_monitor.lock(); PMONITOR) return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; } auto maxExtents = getFullWindowExtents(); - CBox finalBox = {m_vRealPosition->value().x - maxExtents.topLeft.x, m_vRealPosition->value().y - maxExtents.topLeft.y, - m_vRealSize->value().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize->value().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; + CBox finalBox = {m_realPosition->value().x - maxExtents.topLeft.x, m_realPosition->value().y - maxExtents.topLeft.y, + m_realSize->value().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_realSize->value().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; return finalBox; } CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_monitor.lock(); if (!PMONITOR) - return {m_vPosition, m_vSize}; + return {m_position, m_size}; - auto POS = m_vPosition; - auto SIZE = m_vSize; + auto POS = m_position; + auto SIZE = m_size; if (isFullscreen()) { POS = PMONITOR->vecPosition; @@ -243,82 +243,82 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { } CBox CWindow::getWindowBoxUnified(uint64_t properties) { - if (m_sWindowData.dimAround.valueOrDefault()) { - const auto PMONITOR = m_pMonitor.lock(); + if (m_windowData.dimAround.valueOrDefault()) { + const auto PMONITOR = m_monitor.lock(); if (PMONITOR) return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; } SBoxExtents EXTENTS = {{0, 0}, {0, 0}}; if (properties & RESERVED_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock())); + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_self.lock())); if (properties & INPUT_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock(), true)); + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), true)); if (properties & FULL_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock(), false)); + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), false)); - CBox box = {m_vRealPosition->value().x, m_vRealPosition->value().y, m_vRealSize->value().x, m_vRealSize->value().y}; + CBox box = {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y}; box.addExtents(EXTENTS); return box; } SBoxExtents CWindow::getFullWindowReservedArea() { - return g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock()); + return g_pDecorationPositioner->getWindowDecorationReserved(m_self.lock()); } void CWindow::updateWindowDecos() { - if (!m_bIsMapped || isHidden()) + if (!m_isMapped || isHidden()) return; - for (auto const& wd : m_vDecosToRemove) { - for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) { + for (auto const& wd : m_decosToRemove) { + for (auto it = m_windowDecorations.begin(); it != m_windowDecorations.end(); it++) { if (it->get() == wd) { g_pDecorationPositioner->uncacheDecoration(it->get()); - it = m_dWindowDecorations.erase(it); - if (it == m_dWindowDecorations.end()) + it = m_windowDecorations.erase(it); + if (it == m_windowDecorations.end()) break; } } } - g_pDecorationPositioner->onWindowUpdate(m_pSelf.lock()); + g_pDecorationPositioner->onWindowUpdate(m_self.lock()); - m_vDecosToRemove.clear(); + m_decosToRemove.clear(); // make a copy because updateWindow can remove decos. std::vector decos; // reserve to avoid reallocations - decos.reserve(m_dWindowDecorations.size()); + decos.reserve(m_windowDecorations.size()); - for (auto const& wd : m_dWindowDecorations) { + for (auto const& wd : m_windowDecorations) { decos.push_back(wd.get()); } for (auto const& wd : decos) { - if (std::find_if(m_dWindowDecorations.begin(), m_dWindowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_dWindowDecorations.end()) + if (std::find_if(m_windowDecorations.begin(), m_windowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_windowDecorations.end()) continue; - wd->updateWindow(m_pSelf.lock()); + wd->updateWindow(m_self.lock()); } } void CWindow::addWindowDeco(UP deco) { - m_dWindowDecorations.emplace_back(std::move(deco)); - g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock()); + m_windowDecorations.emplace_back(std::move(deco)); + g_pDecorationPositioner->forceRecalcFor(m_self.lock()); updateWindowDecos(); - g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pSelf.lock()); + g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_self.lock()); } void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) { - m_vDecosToRemove.push_back(deco); - g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock()); + m_decosToRemove.push_back(deco); + g_pDecorationPositioner->forceRecalcFor(m_self.lock()); updateWindowDecos(); - g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pSelf.lock()); + g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_self.lock()); } void CWindow::uncacheWindowDecos() { - for (auto const& wd : m_dWindowDecorations) { + for (auto const& wd : m_windowDecorations) { g_pDecorationPositioner->uncacheDecoration(wd.get()); } } @@ -327,7 +327,7 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords)) return false; - for (auto const& wd : m_dWindowDecorations) { + for (auto const& wd : m_windowDecorations) { if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)) continue; @@ -343,23 +343,23 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor pid_t CWindow::getPID() { pid_t PID = -1; - if (!m_bIsX11) { - if (!m_pXDGSurface || !m_pXDGSurface->owner /* happens at unmap */) + if (!m_isX11) { + if (!m_xdgSurface || !m_xdgSurface->owner /* happens at unmap */) return -1; - wl_client_get_credentials(m_pXDGSurface->owner->client(), &PID, nullptr, nullptr); + wl_client_get_credentials(m_xdgSurface->owner->client(), &PID, nullptr, nullptr); } else { - if (!m_pXWaylandSurface) + if (!m_xwaylandSurface) return -1; - PID = m_pXWaylandSurface->pid; + PID = m_xwaylandSurface->pid; } return PID; } IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) { - for (auto const& wd : m_dWindowDecorations) { + for (auto const& wd : m_windowDecorations) { if (wd->getDecorationType() == type) return wd.get(); } @@ -372,28 +372,28 @@ void CWindow::updateToplevel() { } void CWindow::updateSurfaceScaleTransformDetails(bool force) { - if (!m_bIsMapped || m_bHidden || g_pCompositor->m_unsafeState) + if (!m_isMapped || m_hidden || g_pCompositor->m_unsafeState) return; - const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID); + const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_lastSurfaceMonitorID); - m_iLastSurfaceMonitorID = monitorID(); + m_lastSurfaceMonitorID = monitorID(); - const auto PNEWMONITOR = m_pMonitor.lock(); + const auto PNEWMONITOR = m_monitor.lock(); if (!PNEWMONITOR) return; if (PNEWMONITOR != PLASTMONITOR || force) { if (PLASTMONITOR && PLASTMONITOR->m_bEnabled && PNEWMONITOR != PLASTMONITOR) - m_pWLSurface->resource()->breadthfirst([PLASTMONITOR](SP s, const Vector2D& offset, void* d) { s->leave(PLASTMONITOR->self.lock()); }, nullptr); + m_wlSurface->resource()->breadthfirst([PLASTMONITOR](SP s, const Vector2D& offset, void* d) { s->leave(PLASTMONITOR->self.lock()); }, nullptr); - m_pWLSurface->resource()->breadthfirst([PNEWMONITOR](SP s, const Vector2D& offset, void* d) { s->enter(PNEWMONITOR->self.lock()); }, nullptr); + m_wlSurface->resource()->breadthfirst([PNEWMONITOR](SP s, const Vector2D& offset, void* d) { s->enter(PNEWMONITOR->self.lock()); }, nullptr); } - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_monitor.lock(); - m_pWLSurface->resource()->breadthfirst( + m_wlSurface->resource()->breadthfirst( [PMONITOR](SP s, const Vector2D& offset, void* d) { const auto PSURFACE = CWLSurface::fromResource(s); if (PSURFACE && PSURFACE->m_lastScaleFloat == PMONITOR->scale) @@ -407,18 +407,18 @@ void CWindow::updateSurfaceScaleTransformDetails(bool force) { } void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { - if (m_pWorkspace == pWorkspace) + if (m_workspace == pWorkspace) return; static auto PINITIALWSTRACKING = CConfigValue("misc:initial_workspace_tracking"); - if (!m_szInitialWorkspaceToken.empty()) { - const auto TOKEN = g_pTokenManager->getToken(m_szInitialWorkspaceToken); + if (!m_initialWorkspaceToken.empty()) { + const auto TOKEN = g_pTokenManager->getToken(m_initialWorkspaceToken); if (TOKEN) { if (*PINITIALWSTRACKING == 2) { // persistent SInitialWorkspaceToken token = std::any_cast(TOKEN->m_data); - if (token.primaryOwner == m_pSelf) { + if (token.primaryOwner == m_self) { token.workspace = pWorkspace->getConfigName(); TOKEN->m_data = token; } @@ -428,16 +428,16 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { static auto PCLOSEONLASTSPECIAL = CConfigValue("misc:close_special_on_empty"); - const auto OLDWORKSPACE = m_pWorkspace; + const auto OLDWORKSPACE = m_workspace; if (OLDWORKSPACE->isVisible()) { - m_fMovingToWorkspaceAlpha->setValueAndWarp(1.F); - *m_fMovingToWorkspaceAlpha = 0.F; - m_fMovingToWorkspaceAlpha->setCallbackOnEnd([this](auto) { m_iMonitorMovedFrom = -1; }); - m_iMonitorMovedFrom = OLDWORKSPACE ? OLDWORKSPACE->monitorID() : -1; + m_movingToWorkspaceAlpha->setValueAndWarp(1.F); + *m_movingToWorkspaceAlpha = 0.F; + m_movingToWorkspaceAlpha->setCallbackOnEnd([this](auto) { m_monitorMovedFrom = -1; }); + m_monitorMovedFrom = OLDWORKSPACE ? OLDWORKSPACE->monitorID() : -1; } - m_pWorkspace = pWorkspace; + m_workspace = pWorkspace; setAnimationsToMove(); @@ -454,13 +454,13 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { if (valid(pWorkspace)) { g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", std::format("{:x},{}", (uintptr_t)this, pWorkspace->m_name)}); g_pEventManager->postEvent(SHyprIPCEvent{"movewindowv2", std::format("{:x},{},{}", (uintptr_t)this, pWorkspace->m_id, pWorkspace->m_name)}); - EMIT_HOOK_EVENT("moveWindow", (std::vector{m_pSelf.lock(), pWorkspace})); + EMIT_HOOK_EVENT("moveWindow", (std::vector{m_self.lock(), pWorkspace})); } - if (const auto SWALLOWED = m_pSwallowed.lock()) { - if (SWALLOWED->m_bCurrentlySwallowed) { + if (const auto SWALLOWED = m_swallowed.lock()) { + if (SWALLOWED->m_currentlySwallowed) { SWALLOWED->moveToWorkspace(pWorkspace); - SWALLOWED->m_pMonitor = m_pMonitor; + SWALLOWED->m_monitor = m_monitor; } } @@ -471,10 +471,10 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { } PHLWINDOW CWindow::x11TransientFor() { - if (!m_pXWaylandSurface || !m_pXWaylandSurface->parent) + if (!m_xwaylandSurface || !m_xwaylandSurface->parent) return nullptr; - auto s = m_pXWaylandSurface->parent; + auto s = m_xwaylandSurface->parent; std::vector> visited; while (s) { // break loops. Some X apps make them, and it seems like it's valid behavior?!?!?! @@ -486,11 +486,11 @@ PHLWINDOW CWindow::x11TransientFor() { s = s->parent; } - if (s == m_pXWaylandSurface) + if (s == m_xwaylandSurface) return nullptr; // dead-ass circle for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pXWaylandSurface != s) + if (w->m_xwaylandSurface != s) continue; return w; } @@ -502,93 +502,93 @@ void CWindow::onUnmap() { static auto PCLOSEONLASTSPECIAL = CConfigValue("misc:close_special_on_empty"); static auto PINITIALWSTRACKING = CConfigValue("misc:initial_workspace_tracking"); - if (!m_szInitialWorkspaceToken.empty()) { - const auto TOKEN = g_pTokenManager->getToken(m_szInitialWorkspaceToken); + if (!m_initialWorkspaceToken.empty()) { + const auto TOKEN = g_pTokenManager->getToken(m_initialWorkspaceToken); if (TOKEN) { if (*PINITIALWSTRACKING == 2) { // persistent token, but the first window got removed so the token is gone SInitialWorkspaceToken token = std::any_cast(TOKEN->m_data); - if (token.primaryOwner == m_pSelf) + if (token.primaryOwner == m_self) g_pTokenManager->removeToken(TOKEN); } } } - m_iLastWorkspace = m_pWorkspace->m_id; + m_lastWorkspace = m_workspace->m_id; - std::erase_if(g_pCompositor->m_windowFocusHistory, [this](const auto& other) { return other.expired() || other == m_pSelf; }); + std::erase_if(g_pCompositor->m_windowFocusHistory, [this](const auto& other) { return other.expired() || other == m_self; }); - if (*PCLOSEONLASTSPECIAL && m_pWorkspace && m_pWorkspace->getWindows() == 0 && onSpecialWorkspace()) { - const auto PMONITOR = m_pMonitor.lock(); - if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace == m_pWorkspace) + if (*PCLOSEONLASTSPECIAL && m_workspace && m_workspace->getWindows() == 0 && onSpecialWorkspace()) { + const auto PMONITOR = m_monitor.lock(); + if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace == m_workspace) PMONITOR->setSpecialWorkspace(nullptr); } - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_monitor.lock(); - if (PMONITOR && PMONITOR->solitaryClient == m_pSelf) + if (PMONITOR && PMONITOR->solitaryClient == m_self) PMONITOR->solitaryClient.reset(); - if (m_pWorkspace) { - m_pWorkspace->updateWindows(); - m_pWorkspace->updateWindowData(); + if (m_workspace) { + m_workspace->updateWindows(); + m_workspace->updateWindowData(); } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); - m_pWorkspace.reset(); + m_workspace.reset(); - if (m_bIsX11) + if (m_isX11) return; - m_pSubsurfaceHead.reset(); - m_pPopupHead.reset(); + m_subsurfaceHead.reset(); + m_popupHead.reset(); } void CWindow::onMap() { // JIC, reset the callbacks. If any are set, we'll make sure they are cleared so we don't accidentally unset them. (In case a window got remapped) - m_vRealPosition->resetAllCallbacks(); - m_vRealSize->resetAllCallbacks(); - m_fBorderFadeAnimationProgress->resetAllCallbacks(); - m_fBorderAngleAnimationProgress->resetAllCallbacks(); - m_fActiveInactiveAlpha->resetAllCallbacks(); - m_fAlpha->resetAllCallbacks(); - m_cRealShadowColor->resetAllCallbacks(); - m_fDimPercent->resetAllCallbacks(); - m_fMovingToWorkspaceAlpha->resetAllCallbacks(); - m_fMovingFromWorkspaceAlpha->resetAllCallbacks(); + m_realPosition->resetAllCallbacks(); + m_realSize->resetAllCallbacks(); + m_borderFadeAnimationProgress->resetAllCallbacks(); + m_borderAngleAnimationProgress->resetAllCallbacks(); + m_activeInactiveAlpha->resetAllCallbacks(); + m_alpha->resetAllCallbacks(); + m_realShadowColor->resetAllCallbacks(); + m_dimPercent->resetAllCallbacks(); + m_movingToWorkspaceAlpha->resetAllCallbacks(); + m_movingFromWorkspaceAlpha->resetAllCallbacks(); - m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F); + m_movingFromWorkspaceAlpha->setValueAndWarp(1.F); - if (m_fBorderAngleAnimationProgress->enabled()) { - m_fBorderAngleAnimationProgress->setValueAndWarp(0.f); - m_fBorderAngleAnimationProgress->setCallbackOnEnd([&](WP p) { onBorderAngleAnimEnd(p); }, false); - *m_fBorderAngleAnimationProgress = 1.f; + if (m_borderAngleAnimationProgress->enabled()) { + m_borderAngleAnimationProgress->setValueAndWarp(0.f); + m_borderAngleAnimationProgress->setCallbackOnEnd([&](WP p) { onBorderAngleAnimEnd(p); }, false); + *m_borderAngleAnimationProgress = 1.f; } - m_vRealSize->setCallbackOnBegin( + m_realSize->setCallbackOnBegin( [this](auto) { - if (!m_bIsMapped || isX11OverrideRedirect()) + if (!m_isMapped || isX11OverrideRedirect()) return; sendWindowSize(); }, false); - m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F); + m_movingFromWorkspaceAlpha->setValueAndWarp(1.F); - g_pCompositor->m_windowFocusHistory.push_back(m_pSelf); + g_pCompositor->m_windowFocusHistory.push_back(m_self); - m_vReportedSize = m_vPendingReportedSize; - m_bAnimatingIn = true; + m_reportedSize = m_pendingReportedSize; + m_animatingIn = true; updateSurfaceScaleTransformDetails(true); - if (m_bIsX11) + if (m_isX11) return; - m_pSubsurfaceHead = CSubsurface::create(m_pSelf.lock()); - m_pPopupHead = CPopup::create(m_pSelf.lock()); + m_subsurfaceHead = CSubsurface::create(m_self.lock()); + m_popupHead = CPopup::create(m_self.lock()); } void CWindow::onBorderAngleAnimEnd(WP pav) { @@ -610,34 +610,34 @@ void CWindow::onBorderAngleAnimEnd(WP pav) { } void CWindow::setHidden(bool hidden) { - m_bHidden = hidden; + m_hidden = hidden; - if (hidden && g_pCompositor->m_lastWindow == m_pSelf) + if (hidden && g_pCompositor->m_lastWindow == m_self) g_pCompositor->m_lastWindow.reset(); setSuspended(hidden); } bool CWindow::isHidden() { - return m_bHidden; + return m_hidden; } void CWindow::applyDynamicRule(const SP& r) { - const eOverridePriority priority = r->execRule ? PRIORITY_SET_PROP : PRIORITY_WINDOW_RULE; + const eOverridePriority priority = r->m_execRule ? PRIORITY_SET_PROP : PRIORITY_WINDOW_RULE; - switch (r->ruleType) { + switch (r->m_ruleType) { case CWindowRule::RULE_TAG: { - CVarList vars{r->szRule, 0, 's', true}; + CVarList vars{r->m_rule, 0, 's', true}; if (vars.size() == 2 && vars[0] == "tag") m_tags.applyTag(vars[1], true); else - Debug::log(ERR, "Tag rule invalid: {}", r->szRule); + Debug::log(ERR, "Tag rule invalid: {}", r->m_rule); break; } case CWindowRule::RULE_OPACITY: { try { - CVarList vars(r->szRule, 0, ' '); + CVarList vars(r->m_rule, 0, ' '); int opacityIDX = 0; @@ -647,18 +647,18 @@ void CWindow::applyDynamicRule(const SP& r) { if (r == "override") { if (opacityIDX == 1) - m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{m_sWindowData.alpha.value().m_fAlpha, true}, priority); + m_windowData.alpha = CWindowOverridableVar(SAlphaValue{m_windowData.alpha.value().alpha, true}, priority); else if (opacityIDX == 2) - m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaInactive.value().m_fAlpha, true}, priority); + m_windowData.alphaInactive = CWindowOverridableVar(SAlphaValue{m_windowData.alphaInactive.value().alpha, true}, priority); else if (opacityIDX == 3) - m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaFullscreen.value().m_fAlpha, true}, priority); + m_windowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{m_windowData.alphaFullscreen.value().alpha, true}, priority); } else { if (opacityIDX == 0) { - m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); + m_windowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else if (opacityIDX == 1) { - m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); + m_windowData.alphaInactive = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else if (opacityIDX == 2) { - m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); + m_windowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else { throw std::runtime_error("more than 3 alpha values"); } @@ -668,15 +668,15 @@ void CWindow::applyDynamicRule(const SP& r) { } if (opacityIDX == 1) { - m_sWindowData.alphaInactive = m_sWindowData.alpha; - m_sWindowData.alphaFullscreen = m_sWindowData.alpha; + m_windowData.alphaInactive = m_windowData.alpha; + m_windowData.alphaFullscreen = m_windowData.alpha; } - } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r->szRule, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r->m_rule, e.what()); } break; } case CWindowRule::RULE_ANIMATION: { - auto STYLE = r->szRule.substr(r->szRule.find_first_of(' ') + 1); - m_sWindowData.animationStyle = CWindowOverridableVar(STYLE, priority); + auto STYLE = r->m_rule.substr(r->m_rule.find_first_of(' ') + 1); + m_windowData.animationStyle = CWindowOverridableVar(STYLE, priority); break; } case CWindowRule::RULE_BORDERCOLOR: { @@ -685,12 +685,12 @@ void CWindow::applyDynamicRule(const SP& r) { CGradientValueData activeBorderGradient = {}; CGradientValueData inactiveBorderGradient = {}; bool active = true; - CVarList colorsAndAngles = CVarList(trim(r->szRule.substr(r->szRule.find_first_of(' ') + 1)), 0, 's', true); + CVarList colorsAndAngles = CVarList(trim(r->m_rule.substr(r->m_rule.find_first_of(' ') + 1)), 0, 's', true); // Basic form has only two colors, everything else can be parsed as a gradient if (colorsAndAngles.size() == 2 && !colorsAndAngles[1].contains("deg")) { - m_sWindowData.activeBorderColor = CWindowOverridableVar(CGradientValueData(CHyprColor(configStringToInt(colorsAndAngles[0]).value_or(0))), priority); - m_sWindowData.inactiveBorderColor = CWindowOverridableVar(CGradientValueData(CHyprColor(configStringToInt(colorsAndAngles[1]).value_or(0))), priority); + m_windowData.activeBorderColor = CWindowOverridableVar(CGradientValueData(CHyprColor(configStringToInt(colorsAndAngles[0]).value_or(0))), priority); + m_windowData.inactiveBorderColor = CWindowOverridableVar(CGradientValueData(CHyprColor(configStringToInt(colorsAndAngles[1]).value_or(0))), priority); return; } @@ -711,91 +711,91 @@ void CWindow::applyDynamicRule(const SP& r) { // Includes sanity checks for the number of colors in each gradient if (activeBorderGradient.m_colors.size() > 10 || inactiveBorderGradient.m_colors.size() > 10) - Debug::log(WARN, "Bordercolor rule \"{}\" has more than 10 colors in one gradient, ignoring", r->szRule); + Debug::log(WARN, "Bordercolor rule \"{}\" has more than 10 colors in one gradient, ignoring", r->m_rule); else if (activeBorderGradient.m_colors.empty()) - Debug::log(WARN, "Bordercolor rule \"{}\" has no colors, ignoring", r->szRule); + Debug::log(WARN, "Bordercolor rule \"{}\" has no colors, ignoring", r->m_rule); else if (inactiveBorderGradient.m_colors.empty()) - m_sWindowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); + m_windowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); else { - m_sWindowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); - m_sWindowData.inactiveBorderColor = CWindowOverridableVar(inactiveBorderGradient, priority); + m_windowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); + m_windowData.inactiveBorderColor = CWindowOverridableVar(inactiveBorderGradient, priority); } - } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"{}\" failed with: {}", r->szRule, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"{}\" failed with: {}", r->m_rule, e.what()); } break; } case CWindowRule::RULE_IDLEINHIBIT: { - auto IDLERULE = r->szRule.substr(r->szRule.find_first_of(' ') + 1); + auto IDLERULE = r->m_rule.substr(r->m_rule.find_first_of(' ') + 1); if (IDLERULE == "none") - m_eIdleInhibitMode = IDLEINHIBIT_NONE; + m_idleInhibitMode = IDLEINHIBIT_NONE; else if (IDLERULE == "always") - m_eIdleInhibitMode = IDLEINHIBIT_ALWAYS; + m_idleInhibitMode = IDLEINHIBIT_ALWAYS; else if (IDLERULE == "focus") - m_eIdleInhibitMode = IDLEINHIBIT_FOCUS; + m_idleInhibitMode = IDLEINHIBIT_FOCUS; else if (IDLERULE == "fullscreen") - m_eIdleInhibitMode = IDLEINHIBIT_FULLSCREEN; + m_idleInhibitMode = IDLEINHIBIT_FULLSCREEN; else Debug::log(ERR, "Rule idleinhibit: unknown mode {}", IDLERULE); break; } case CWindowRule::RULE_MAXSIZE: { try { - if (!m_bIsFloating) + if (!m_isFloating) return; - const auto VEC = configStringToVector2D(r->szRule.substr(8)); + const auto VEC = configStringToVector2D(r->m_rule.substr(8)); if (VEC.x < 1 || VEC.y < 1) { Debug::log(ERR, "Invalid size for maxsize"); return; } - m_sWindowData.maxSize = CWindowOverridableVar(VEC, priority); - clampWindowSize(std::nullopt, m_sWindowData.maxSize.value()); + m_windowData.maxSize = CWindowOverridableVar(VEC, priority); + clampWindowSize(std::nullopt, m_windowData.maxSize.value()); - } catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", r->szRule, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", r->m_rule, e.what()); } break; } case CWindowRule::RULE_MINSIZE: { try { - if (!m_bIsFloating) + if (!m_isFloating) return; - const auto VEC = configStringToVector2D(r->szRule.substr(8)); + const auto VEC = configStringToVector2D(r->m_rule.substr(8)); if (VEC.x < 1 || VEC.y < 1) { Debug::log(ERR, "Invalid size for minsize"); return; } - m_sWindowData.minSize = CWindowOverridableVar(VEC, priority); - clampWindowSize(m_sWindowData.minSize.value(), std::nullopt); + m_windowData.minSize = CWindowOverridableVar(VEC, priority); + clampWindowSize(m_windowData.minSize.value(), std::nullopt); - if (m_sGroupData.pNextWindow.expired()) + if (m_groupData.pNextWindow.expired()) setHidden(false); - } catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r->szRule, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r->m_rule, e.what()); } break; } case CWindowRule::RULE_RENDERUNFOCUSED: { - m_sWindowData.renderUnfocused = CWindowOverridableVar(true, priority); - g_pHyprRenderer->addWindowToRenderUnfocused(m_pSelf.lock()); + m_windowData.renderUnfocused = CWindowOverridableVar(true, priority); + g_pHyprRenderer->addWindowToRenderUnfocused(m_self.lock()); break; } case CWindowRule::RULE_PROP: { - const CVarList VARS(r->szRule, 0, ' '); + const CVarList VARS(r->m_rule, 0, ' '); if (auto search = NWindowProperties::intWindowProperties.find(VARS[1]); search != NWindowProperties::intWindowProperties.end()) { try { - *(search->second(m_pSelf.lock())) = CWindowOverridableVar(Hyprlang::INT(std::stoi(VARS[2])), priority); - } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->szRule, e.what()); } + *(search->second(m_self.lock())) = CWindowOverridableVar(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 { - *(search->second(m_pSelf.lock())) = CWindowOverridableVar(std::stof(VARS[2]), priority); - } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->szRule, e.what()); } + *(search->second(m_self.lock())) = CWindowOverridableVar(std::stof(VARS[2]), priority); + } 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_pSelf.lock())) = CWindowOverridableVar(VARS[2].empty() ? true : (bool)std::stoi(VARS[2]), priority); - } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->szRule, e.what()); } + *(search->second(m_self.lock())) = CWindowOverridableVar(VARS[2].empty() ? true : (bool)std::stoi(VARS[2]), priority); + } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); } } break; } case CWindowRule::RULE_PERSISTENTSIZE: { - m_sWindowData.persistentSize = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE); + m_windowData.persistentSize = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE); break; } default: break; @@ -803,31 +803,31 @@ void CWindow::applyDynamicRule(const SP& r) { } void CWindow::updateDynamicRules() { - m_sWindowData.alpha.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.alphaInactive.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.alphaFullscreen.unset(PRIORITY_WINDOW_RULE); + m_windowData.alpha.unset(PRIORITY_WINDOW_RULE); + m_windowData.alphaInactive.unset(PRIORITY_WINDOW_RULE); + m_windowData.alphaFullscreen.unset(PRIORITY_WINDOW_RULE); unsetWindowData(PRIORITY_WINDOW_RULE); - m_sWindowData.animationStyle.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.maxSize.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.minSize.unset(PRIORITY_WINDOW_RULE); + m_windowData.animationStyle.unset(PRIORITY_WINDOW_RULE); + m_windowData.maxSize.unset(PRIORITY_WINDOW_RULE); + m_windowData.minSize.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE); + m_windowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE); + m_windowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE); - m_sWindowData.renderUnfocused.unset(PRIORITY_WINDOW_RULE); + m_windowData.renderUnfocused.unset(PRIORITY_WINDOW_RULE); - m_eIdleInhibitMode = IDLEINHIBIT_NONE; + m_idleInhibitMode = IDLEINHIBIT_NONE; m_tags.removeDynamicTags(); - m_vMatchedRules = g_pConfigManager->getMatchingRules(m_pSelf.lock()); - for (const auto& r : m_vMatchedRules) { + m_matchedRules = g_pConfigManager->getMatchingRules(m_self.lock()); + for (const auto& r : m_matchedRules) { applyDynamicRule(r); } - EMIT_HOOK_EVENT("windowUpdateRules", m_pSelf.lock()); + EMIT_HOOK_EVENT("windowUpdateRules", m_self.lock()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); } @@ -842,10 +842,10 @@ bool CWindow::isInCurvedCorner(double x, double y) { return false; // (x0, y0), (x0, y1), ... are the center point of rounding at each corner - double x0 = m_vRealPosition->value().x + ROUNDING; - double y0 = m_vRealPosition->value().y + ROUNDING; - double x1 = m_vRealPosition->value().x + m_vRealSize->value().x - ROUNDING; - double y1 = m_vRealPosition->value().y + m_vRealSize->value().y - ROUNDING; + double x0 = m_realPosition->value().x + ROUNDING; + double y0 = m_realPosition->value().y + ROUNDING; + double x1 = m_realPosition->value().x + m_realSize->value().x - ROUNDING; + 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); @@ -865,39 +865,39 @@ bool CWindow::isInCurvedCorner(double x, double y) { // checks if the wayland window has a popup at pos bool CWindow::hasPopupAt(const Vector2D& pos) { - if (m_bIsX11) + if (m_isX11) return false; - auto popup = m_pPopupHead->at(pos); + auto popup = m_popupHead->at(pos); return popup && popup->m_wlSurface->resource(); } void CWindow::applyGroupRules() { - if ((m_eGroupRules & GROUP_SET && m_bFirstMap) || m_eGroupRules & GROUP_SET_ALWAYS) + if ((m_groupRules & GROUP_SET && m_firstMap) || m_groupRules & GROUP_SET_ALWAYS) createGroup(); - if (m_sGroupData.pNextWindow.lock() && ((m_eGroupRules & GROUP_LOCK && m_bFirstMap) || m_eGroupRules & GROUP_LOCK_ALWAYS)) - getGroupHead()->m_sGroupData.locked = true; + if (m_groupData.pNextWindow.lock() && ((m_groupRules & GROUP_LOCK && m_firstMap) || m_groupRules & GROUP_LOCK_ALWAYS)) + getGroupHead()->m_groupData.locked = true; } void CWindow::createGroup() { - if (m_sGroupData.deny) { - Debug::log(LOG, "createGroup: window:{:x},title:{} is denied as a group, ignored", (uintptr_t)this, this->m_szTitle); + if (m_groupData.deny) { + Debug::log(LOG, "createGroup: window:{:x},title:{} is denied as a group, ignored", (uintptr_t)this, this->m_title); return; } - if (m_sGroupData.pNextWindow.expired()) { - m_sGroupData.pNextWindow = m_pSelf; - m_sGroupData.head = true; - m_sGroupData.locked = false; - m_sGroupData.deny = false; + if (m_groupData.pNextWindow.expired()) { + m_groupData.pNextWindow = m_self; + m_groupData.head = true; + m_groupData.locked = false; + m_groupData.deny = false; - addWindowDeco(makeUnique(m_pSelf.lock())); + addWindowDeco(makeUnique(m_self.lock())); - if (m_pWorkspace) { - m_pWorkspace->updateWindows(); - m_pWorkspace->updateWindowData(); + if (m_workspace) { + m_workspace->updateWindows(); + m_workspace->updateWindowData(); } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -907,17 +907,17 @@ void CWindow::createGroup() { } void CWindow::destroyGroup() { - if (m_sGroupData.pNextWindow == m_pSelf) { - if (m_eGroupRules & GROUP_SET_ALWAYS) { - Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", (uintptr_t)this, this->m_szTitle); + 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); return; } - m_sGroupData.pNextWindow.reset(); - m_sGroupData.head = false; + m_groupData.pNextWindow.reset(); + m_groupData.head = false; updateWindowDecos(); - if (m_pWorkspace) { - m_pWorkspace->updateWindows(); - m_pWorkspace->updateWindowData(); + if (m_workspace) { + m_workspace->updateWindows(); + m_workspace->updateWindowData(); } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -927,12 +927,12 @@ void CWindow::destroyGroup() { } std::string addresses; - PHLWINDOW curr = m_pSelf.lock(); + PHLWINDOW curr = m_self.lock(); std::vector members; do { const auto PLASTWIN = curr; - curr = curr->m_sGroupData.pNextWindow.lock(); - PLASTWIN->m_sGroupData.pNextWindow.reset(); + curr = curr->m_groupData.pNextWindow.lock(); + PLASTWIN->m_groupData.pNextWindow.reset(); curr->setHidden(false); members.push_back(curr); @@ -940,9 +940,9 @@ void CWindow::destroyGroup() { } while (curr.get() != this); for (auto const& w : members) { - if (w->m_sGroupData.head) + if (w->m_groupData.head) g_pLayoutManager->getCurrentLayout()->onWindowRemoved(curr); - w->m_sGroupData.head = false; + w->m_groupData.head = false; } const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked; @@ -953,9 +953,9 @@ void CWindow::destroyGroup() { } g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV; - if (m_pWorkspace) { - m_pWorkspace->updateWindows(); - m_pWorkspace->updateWindowData(); + if (m_workspace) { + m_workspace->updateWindows(); + m_workspace->updateWindowData(); } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(monitorID()); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -966,31 +966,31 @@ void CWindow::destroyGroup() { } PHLWINDOW CWindow::getGroupHead() { - PHLWINDOW curr = m_pSelf.lock(); - while (!curr->m_sGroupData.head) - curr = curr->m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_self.lock(); + while (!curr->m_groupData.head) + curr = curr->m_groupData.pNextWindow.lock(); return curr; } PHLWINDOW CWindow::getGroupTail() { - PHLWINDOW curr = m_pSelf.lock(); - while (!curr->m_sGroupData.pNextWindow->m_sGroupData.head) - curr = curr->m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_self.lock(); + while (!curr->m_groupData.pNextWindow->m_groupData.head) + curr = curr->m_groupData.pNextWindow.lock(); return curr; } PHLWINDOW CWindow::getGroupCurrent() { - PHLWINDOW curr = m_pSelf.lock(); + PHLWINDOW curr = m_self.lock(); while (curr->isHidden()) - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); return curr; } int CWindow::getGroupSize() { int size = 1; - PHLWINDOW curr = m_pSelf.lock(); - while (curr->m_sGroupData.pNextWindow != m_pSelf) { - curr = curr->m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_self.lock(); + while (curr->m_groupData.pNextWindow != m_self) { + curr = curr->m_groupData.pNextWindow.lock(); size++; } return size; @@ -998,15 +998,15 @@ int CWindow::getGroupSize() { bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) { static auto ALLOWGROUPMERGE = CConfigValue("group:merge_groups_on_drag"); - bool isGroup = m_sGroupData.pNextWindow; + bool isGroup = m_groupData.pNextWindow; bool disallowDragIntoGroup = g_pInputManager->m_bWasDraggingWindow && isGroup && !bool(*ALLOWGROUPMERGE); - return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged - && ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or - || (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked - && !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group - && !m_sGroupData.deny // source is not denied entry - && !(m_eGroupRules & GROUP_BARRED && m_bFirstMap) // group rule doesn't prevent adding window - && !disallowDragIntoGroup; // config allows groups to be merged + return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged + && ((m_groupRules & GROUP_INVADE && m_firstMap) // window ignore local group locks, or + || (!pWindow->getGroupHead()->m_groupData.locked // target unlocked + && !(m_groupData.pNextWindow.lock() && getGroupHead()->m_groupData.locked))) // source unlocked or isn't group + && !m_groupData.deny // source is not denied entry + && !(m_groupRules & GROUP_BARRED && m_firstMap) // group rule doesn't prevent adding window + && !disallowDragIntoGroup; // config allows groups to be merged } PHLWINDOW CWindow::getGroupWindowByIndex(int index) { @@ -1014,21 +1014,21 @@ PHLWINDOW CWindow::getGroupWindowByIndex(int index) { index = ((index % SIZE) + SIZE) % SIZE; PHLWINDOW curr = getGroupHead(); while (index > 0) { - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); index--; } return curr; } void CWindow::setGroupCurrent(PHLWINDOW pWindow) { - PHLWINDOW curr = m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_groupData.pNextWindow.lock(); bool isMember = false; while (curr.get() != this) { if (curr == pWindow) { isMember = true; break; } - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); } if (!isMember && pWindow.get() != this) @@ -1036,25 +1036,25 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) { const auto PCURRENT = getGroupCurrent(); const bool FULLSCREEN = PCURRENT->isFullscreen(); - const auto WORKSPACE = PCURRENT->m_pWorkspace; - const auto MODE = PCURRENT->m_sFullscreenState.internal; + const auto WORKSPACE = PCURRENT->m_workspace; + const auto MODE = PCURRENT->m_fullscreenState.internal; const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_lastWindow.lock(); if (FULLSCREEN) g_pCompositor->setWindowFullscreenInternal(PCURRENT, FSMODE_NONE); - const auto PWINDOWSIZE = PCURRENT->m_vRealSize->goal(); - const auto PWINDOWPOS = PCURRENT->m_vRealPosition->goal(); + const auto PWINDOWSIZE = PCURRENT->m_realSize->goal(); + const auto PWINDOWPOS = PCURRENT->m_realPosition->goal(); PCURRENT->setHidden(true); pWindow->setHidden(false); // can remove m_pLastWindow g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow); - if (PCURRENT->m_bIsFloating) { - pWindow->m_vRealPosition->setValueAndWarp(PWINDOWPOS); - pWindow->m_vRealSize->setValueAndWarp(PWINDOWSIZE); + if (PCURRENT->m_isFloating) { + pWindow->m_realPosition->setValueAndWarp(PWINDOWPOS); + pWindow->m_realSize->setValueAndWarp(PWINDOWSIZE); } g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -1071,126 +1071,126 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) { } void CWindow::insertWindowToGroup(PHLWINDOW pWindow) { - const auto BEGINAT = m_pSelf.lock(); - const auto ENDAT = m_sGroupData.pNextWindow.lock(); + const auto BEGINAT = m_self.lock(); + const auto ENDAT = m_groupData.pNextWindow.lock(); if (!pWindow->getDecorationByType(DECORATION_GROUPBAR)) pWindow->addWindowDeco(makeUnique(pWindow)); - if (!pWindow->m_sGroupData.pNextWindow.lock()) { - BEGINAT->m_sGroupData.pNextWindow = pWindow; - pWindow->m_sGroupData.pNextWindow = ENDAT; - pWindow->m_sGroupData.head = false; + if (!pWindow->m_groupData.pNextWindow.lock()) { + BEGINAT->m_groupData.pNextWindow = pWindow; + pWindow->m_groupData.pNextWindow = ENDAT; + pWindow->m_groupData.head = false; return; } const auto SHEAD = pWindow->getGroupHead(); const auto STAIL = pWindow->getGroupTail(); - SHEAD->m_sGroupData.head = false; - BEGINAT->m_sGroupData.pNextWindow = SHEAD; - STAIL->m_sGroupData.pNextWindow = ENDAT; + SHEAD->m_groupData.head = false; + BEGINAT->m_groupData.pNextWindow = SHEAD; + STAIL->m_groupData.pNextWindow = ENDAT; } PHLWINDOW CWindow::getGroupPrevious() { - PHLWINDOW curr = m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_groupData.pNextWindow.lock(); - while (curr != m_pSelf && curr->m_sGroupData.pNextWindow != m_pSelf) - curr = curr->m_sGroupData.pNextWindow.lock(); + while (curr != m_self && curr->m_groupData.pNextWindow != m_self) + curr = curr->m_groupData.pNextWindow.lock(); return curr; } void CWindow::switchWithWindowInGroup(PHLWINDOW pWindow) { - if (!m_sGroupData.pNextWindow.lock() || !pWindow->m_sGroupData.pNextWindow.lock()) + if (!m_groupData.pNextWindow.lock() || !pWindow->m_groupData.pNextWindow.lock()) return; - if (m_sGroupData.pNextWindow.lock() == pWindow) { // A -> this -> pWindow -> B >> A -> pWindow -> this -> B - getGroupPrevious()->m_sGroupData.pNextWindow = pWindow; - m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow; - pWindow->m_sGroupData.pNextWindow = m_pSelf; + if (m_groupData.pNextWindow.lock() == pWindow) { // A -> this -> pWindow -> B >> A -> pWindow -> this -> B + getGroupPrevious()->m_groupData.pNextWindow = pWindow; + m_groupData.pNextWindow = pWindow->m_groupData.pNextWindow; + pWindow->m_groupData.pNextWindow = m_self; - } else if (pWindow->m_sGroupData.pNextWindow == m_pSelf) { // A -> pWindow -> this -> B >> A -> this -> pWindow -> B - pWindow->getGroupPrevious()->m_sGroupData.pNextWindow = m_pSelf; - pWindow->m_sGroupData.pNextWindow = m_sGroupData.pNextWindow; - m_sGroupData.pNextWindow = pWindow; + } else if (pWindow->m_groupData.pNextWindow == m_self) { // A -> pWindow -> this -> B >> A -> this -> pWindow -> B + pWindow->getGroupPrevious()->m_groupData.pNextWindow = m_self; + pWindow->m_groupData.pNextWindow = m_groupData.pNextWindow; + m_groupData.pNextWindow = pWindow; } else { // A -> this -> B | C -> pWindow -> D >> A -> pWindow -> B | C -> this -> D - std::swap(m_sGroupData.pNextWindow, pWindow->m_sGroupData.pNextWindow); - std::swap(getGroupPrevious()->m_sGroupData.pNextWindow, pWindow->getGroupPrevious()->m_sGroupData.pNextWindow); + std::swap(m_groupData.pNextWindow, pWindow->m_groupData.pNextWindow); + std::swap(getGroupPrevious()->m_groupData.pNextWindow, pWindow->getGroupPrevious()->m_groupData.pNextWindow); } - std::swap(m_sGroupData.head, pWindow->m_sGroupData.head); - std::swap(m_sGroupData.locked, pWindow->m_sGroupData.locked); + std::swap(m_groupData.head, pWindow->m_groupData.head); + std::swap(m_groupData.locked, pWindow->m_groupData.locked); } void CWindow::updateGroupOutputs() { - if (m_sGroupData.pNextWindow.expired()) + if (m_groupData.pNextWindow.expired()) return; - PHLWINDOW curr = m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = m_groupData.pNextWindow.lock(); - const auto WS = m_pWorkspace; + const auto WS = m_workspace; while (curr.get() != this) { - curr->m_pMonitor = m_pMonitor; + curr->m_monitor = m_monitor; curr->moveToWorkspace(WS); - *curr->m_vRealPosition = m_vRealPosition->goal(); - *curr->m_vRealSize = m_vRealSize->goal(); + *curr->m_realPosition = m_realPosition->goal(); + *curr->m_realSize = m_realSize->goal(); - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); } } Vector2D CWindow::middle() { - return m_vRealPosition->goal() + m_vRealSize->goal() / 2.f; + return m_realPosition->goal() + m_realSize->goal() / 2.f; } bool CWindow::opaque() { - if (m_fAlpha->value() != 1.f || m_fActiveInactiveAlpha->value() != 1.f) + if (m_alpha->value() != 1.f || m_activeInactiveAlpha->value() != 1.f) return false; - const auto PWORKSPACE = m_pWorkspace; + const auto PWORKSPACE = m_workspace; - if (m_pWLSurface->small() && !m_pWLSurface->m_fillIgnoreSmall) + if (m_wlSurface->small() && !m_wlSurface->m_fillIgnoreSmall) return false; if (PWORKSPACE->m_alpha->value() != 1.f) return false; - if (m_bIsX11 && m_pXWaylandSurface && m_pXWaylandSurface->surface && m_pXWaylandSurface->surface->current.texture) - return m_pXWaylandSurface->surface->current.texture->m_bOpaque; + if (m_isX11 && m_xwaylandSurface && m_xwaylandSurface->surface && m_xwaylandSurface->surface->current.texture) + return m_xwaylandSurface->surface->current.texture->m_bOpaque; - if (!m_pWLSurface->resource() || !m_pWLSurface->resource()->current.texture) + if (!m_wlSurface->resource() || !m_wlSurface->resource()->current.texture) return false; // TODO: this is wrong - const auto EXTENTS = m_pXDGSurface->surface->current.opaque.getExtents(); - if (EXTENTS.w >= m_pXDGSurface->surface->current.bufferSize.x && EXTENTS.h >= m_pXDGSurface->surface->current.bufferSize.y) + const auto EXTENTS = m_xdgSurface->surface->current.opaque.getExtents(); + if (EXTENTS.w >= m_xdgSurface->surface->current.bufferSize.x && EXTENTS.h >= m_xdgSurface->surface->current.bufferSize.y) return true; - return m_pWLSurface->resource()->current.texture->m_bOpaque; + return m_wlSurface->resource()->current.texture->m_bOpaque; } float CWindow::rounding() { static auto PROUNDING = CConfigValue("decoration:rounding"); static auto PROUNDINGPOWER = CConfigValue("decoration:rounding_power"); - float roundingPower = m_sWindowData.roundingPower.valueOr(*PROUNDINGPOWER); - float rounding = m_sWindowData.rounding.valueOr(*PROUNDING) * (roundingPower / 2.0); /* Make perceived roundness consistent. */ + float roundingPower = m_windowData.roundingPower.valueOr(*PROUNDINGPOWER); + float rounding = m_windowData.rounding.valueOr(*PROUNDING) * (roundingPower / 2.0); /* Make perceived roundness consistent. */ - return m_sWindowData.noRounding.valueOrDefault() ? 0 : rounding; + return m_windowData.noRounding.valueOrDefault() ? 0 : rounding; } float CWindow::roundingPower() { static auto PROUNDINGPOWER = CConfigValue("decoration:rounding_power"); - return m_sWindowData.roundingPower.valueOr(*PROUNDINGPOWER); + return m_windowData.roundingPower.valueOr(*PROUNDINGPOWER); } void CWindow::updateWindowData() { - const auto PWORKSPACE = m_pWorkspace; + const auto PWORKSPACE = m_workspace; const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{}; updateWindowData(WORKSPACERULE); } @@ -1199,76 +1199,76 @@ void CWindow::updateWindowData(const SWorkspaceRule& workspaceRule) { static auto PNOBORDERONFLOATING = CConfigValue("general:no_border_on_floating"); if (*PNOBORDERONFLOATING) - m_sWindowData.noBorder = CWindowOverridableVar(m_bIsFloating, PRIORITY_LAYOUT); + m_windowData.noBorder = CWindowOverridableVar(m_isFloating, PRIORITY_LAYOUT); else - m_sWindowData.noBorder.unset(PRIORITY_LAYOUT); + m_windowData.noBorder.unset(PRIORITY_LAYOUT); - m_sWindowData.borderSize.matchOptional(workspaceRule.borderSize, PRIORITY_WORKSPACE_RULE); - m_sWindowData.decorate.matchOptional(workspaceRule.decorate, PRIORITY_WORKSPACE_RULE); - m_sWindowData.noBorder.matchOptional(workspaceRule.noBorder, PRIORITY_WORKSPACE_RULE); - m_sWindowData.noRounding.matchOptional(workspaceRule.noRounding, PRIORITY_WORKSPACE_RULE); - m_sWindowData.noShadow.matchOptional(workspaceRule.noShadow, PRIORITY_WORKSPACE_RULE); + m_windowData.borderSize.matchOptional(workspaceRule.borderSize, PRIORITY_WORKSPACE_RULE); + m_windowData.decorate.matchOptional(workspaceRule.decorate, PRIORITY_WORKSPACE_RULE); + m_windowData.noBorder.matchOptional(workspaceRule.noBorder, PRIORITY_WORKSPACE_RULE); + m_windowData.noRounding.matchOptional(workspaceRule.noRounding, PRIORITY_WORKSPACE_RULE); + m_windowData.noShadow.matchOptional(workspaceRule.noShadow, PRIORITY_WORKSPACE_RULE); } int CWindow::getRealBorderSize() { - if (m_sWindowData.noBorder.valueOrDefault() || (m_pWorkspace && isEffectiveInternalFSMode(FSMODE_FULLSCREEN))) + if (m_windowData.noBorder.valueOrDefault() || (m_workspace && isEffectiveInternalFSMode(FSMODE_FULLSCREEN))) return 0; static auto PBORDERSIZE = CConfigValue("general:border_size"); - return m_sWindowData.borderSize.valueOr(*PBORDERSIZE); + return m_windowData.borderSize.valueOr(*PBORDERSIZE); } float CWindow::getScrollMouse() { static auto PINPUTSCROLLFACTOR = CConfigValue("input:scroll_factor"); - return m_sWindowData.scrollMouse.valueOr(*PINPUTSCROLLFACTOR); + return m_windowData.scrollMouse.valueOr(*PINPUTSCROLLFACTOR); } float CWindow::getScrollTouchpad() { static auto PTOUCHPADSCROLLFACTOR = CConfigValue("input:touchpad:scroll_factor"); - return m_sWindowData.scrollTouchpad.valueOr(*PTOUCHPADSCROLLFACTOR); + return m_windowData.scrollTouchpad.valueOr(*PTOUCHPADSCROLLFACTOR); } bool CWindow::canBeTorn() { static auto PTEARING = CConfigValue("general:allow_tearing"); - return m_sWindowData.tearing.valueOr(m_bTearingHint) && *PTEARING; + return m_windowData.tearing.valueOr(m_tearingHint) && *PTEARING; } void CWindow::setSuspended(bool suspend) { - if (suspend == m_bSuspended) + if (suspend == m_suspended) return; - if (m_bIsX11 || !m_pXDGSurface || !m_pXDGSurface->toplevel) + if (m_isX11 || !m_xdgSurface || !m_xdgSurface->toplevel) return; - m_pXDGSurface->toplevel->setSuspeneded(suspend); - m_bSuspended = suspend; + m_xdgSurface->toplevel->setSuspeneded(suspend); + m_suspended = suspend; } bool CWindow::visibleOnMonitor(PHLMONITOR pMonitor) { - CBox wbox = {m_vRealPosition->value(), m_vRealSize->value()}; + CBox wbox = {m_realPosition->value(), m_realSize->value()}; return !wbox.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty(); } void CWindow::setAnimationsToMove() { - m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove")); - m_bAnimatingIn = false; + m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove")); + m_animatingIn = false; } void CWindow::onWorkspaceAnimUpdate() { // clip box for animated offsets - if (!m_bIsFloating || m_bPinned || isFullscreen() || m_bDraggingTiled) { - m_vFloatingOffset = Vector2D(0, 0); + if (!m_isFloating || m_pinned || isFullscreen() || m_draggingTiled) { + m_floatingOffset = Vector2D(0, 0); return; } Vector2D offset; - const auto PWORKSPACE = m_pWorkspace; + const auto PWORKSPACE = m_workspace; if (!PWORKSPACE) return; - const auto PWSMON = m_pMonitor.lock(); + const auto PWSMON = m_monitor.lock(); if (!PWSMON) return; @@ -1291,62 +1291,62 @@ void CWindow::onWorkspaceAnimUpdate() { offset.y += (WINBB.y + WINBB.height - PWSMON->vecPosition.y - PWSMON->vecSize.y) * PROGRESS; } - m_vFloatingOffset = offset; + m_floatingOffset = offset; } void CWindow::onFocusAnimUpdate() { // borderangle once - if (m_fBorderAngleAnimationProgress->enabled() && !m_fBorderAngleAnimationProgress->isBeingAnimated()) { - m_fBorderAngleAnimationProgress->setValueAndWarp(0.f); - *m_fBorderAngleAnimationProgress = 1.f; + if (m_borderAngleAnimationProgress->enabled() && !m_borderAngleAnimationProgress->isBeingAnimated()) { + m_borderAngleAnimationProgress->setValueAndWarp(0.f); + *m_borderAngleAnimationProgress = 1.f; } } int CWindow::popupsCount() { - if (m_bIsX11) + if (m_isX11) return 0; int no = -1; - m_pPopupHead->breadthfirst([](WP p, void* d) { *((int*)d) += 1; }, &no); + m_popupHead->breadthfirst([](WP p, void* d) { *((int*)d) += 1; }, &no); return no; } int CWindow::surfacesCount() { - if (m_bIsX11) + if (m_isX11) return 1; int no = 0; - m_pWLSurface->resource()->breadthfirst([](SP r, const Vector2D& offset, void* d) { *((int*)d) += 1; }, &no); + m_wlSurface->resource()->breadthfirst([](SP r, const Vector2D& offset, void* d) { *((int*)d) += 1; }, &no); return no; } void CWindow::clampWindowSize(const std::optional minSize, const std::optional maxSize) { - const Vector2D REALSIZE = m_vRealSize->goal(); + const Vector2D REALSIZE = m_realSize->goal(); const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), maxSize.value_or(Vector2D{INFINITY, INFINITY})); const Vector2D DELTA = REALSIZE - NEWSIZE; - *m_vRealPosition = m_vRealPosition->goal() + DELTA / 2.0; - *m_vRealSize = NEWSIZE; + *m_realPosition = m_realPosition->goal() + DELTA / 2.0; + *m_realSize = NEWSIZE; } bool CWindow::isFullscreen() { - return m_sFullscreenState.internal != FSMODE_NONE; + return m_fullscreenState.internal != FSMODE_NONE; } bool CWindow::isEffectiveInternalFSMode(const eFullscreenMode MODE) { - return (eFullscreenMode)std::bit_floor((uint8_t)m_sFullscreenState.internal) == MODE; + return (eFullscreenMode)std::bit_floor((uint8_t)m_fullscreenState.internal) == MODE; } WORKSPACEID CWindow::workspaceID() { - return m_pWorkspace ? m_pWorkspace->m_id : m_iLastWorkspace; + return m_workspace ? m_workspace->m_id : m_lastWorkspace; } MONITORID CWindow::monitorID() { - return m_pMonitor ? m_pMonitor->ID : MONITOR_INVALID; + return m_monitor ? m_monitor->ID : MONITOR_INVALID; } bool CWindow::onSpecialWorkspace() { - return m_pWorkspace ? m_pWorkspace->m_isSpecialWorkspace : g_pCompositor->isWorkspaceSpecial(m_iLastWorkspace); + return m_workspace ? m_workspace->m_isSpecialWorkspace : g_pCompositor->isWorkspaceSpecial(m_lastWorkspace); } std::unordered_map CWindow::getEnv() { @@ -1392,59 +1392,59 @@ std::unordered_map CWindow::getEnv() { } void CWindow::activate(bool force) { - if (g_pCompositor->m_lastWindow == m_pSelf) + if (g_pCompositor->m_lastWindow == m_self) return; static auto PFOCUSONACTIVATE = CConfigValue("misc:focus_on_activate"); - m_bIsUrgent = true; + m_isUrgent = true; g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)this)}); - EMIT_HOOK_EVENT("urgent", m_pSelf.lock()); + EMIT_HOOK_EVENT("urgent", m_self.lock()); - if (!force && (!m_sWindowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))) + if (!force && (!m_windowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_suppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_suppressedEvents & SUPPRESS_ACTIVATE))) return; - if (!m_bIsMapped) { + if (!m_isMapped) { Debug::log(LOG, "Ignoring CWindow::activate focus/warp, window is not mapped yet."); return; } - if (m_bIsFloating) - g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true); + if (m_isFloating) + g_pCompositor->changeWindowZOrder(m_self.lock(), true); - g_pCompositor->focusWindow(m_pSelf.lock()); + g_pCompositor->focusWindow(m_self.lock()); warpCursor(); } void CWindow::onUpdateState() { - std::optional requestsFS = m_pXDGSurface ? m_pXDGSurface->toplevel->state.requestsFullscreen : m_pXWaylandSurface->state.requestsFullscreen; - std::optional requestsID = m_pXDGSurface ? m_pXDGSurface->toplevel->state.requestsFullscreenMonitor : MONITOR_INVALID; - std::optional requestsMX = m_pXDGSurface ? m_pXDGSurface->toplevel->state.requestsMaximize : m_pXWaylandSurface->state.requestsMaximize; + std::optional requestsFS = m_xdgSurface ? m_xdgSurface->toplevel->state.requestsFullscreen : m_xwaylandSurface->state.requestsFullscreen; + std::optional requestsID = m_xdgSurface ? m_xdgSurface->toplevel->state.requestsFullscreenMonitor : MONITOR_INVALID; + std::optional requestsMX = m_xdgSurface ? m_xdgSurface->toplevel->state.requestsMaximize : m_xwaylandSurface->state.requestsMaximize; - if (requestsFS.has_value() && !(m_eSuppressedEvents & SUPPRESS_FULLSCREEN)) { - if (requestsID.has_value() && (requestsID.value() != MONITOR_INVALID) && !(m_eSuppressedEvents & SUPPRESS_FULLSCREEN_OUTPUT)) { - if (m_bIsMapped) { + if (requestsFS.has_value() && !(m_suppressedEvents & SUPPRESS_FULLSCREEN)) { + if (requestsID.has_value() && (requestsID.value() != MONITOR_INVALID) && !(m_suppressedEvents & SUPPRESS_FULLSCREEN_OUTPUT)) { + if (m_isMapped) { const auto monitor = g_pCompositor->getMonitorFromID(requestsID.value()); - g_pCompositor->moveWindowToWorkspaceSafe(m_pSelf.lock(), monitor->activeWorkspace); + g_pCompositor->moveWindowToWorkspaceSafe(m_self.lock(), monitor->activeWorkspace); g_pCompositor->setActiveMonitor(monitor); } - if (!m_bIsMapped) - m_iWantsInitialFullscreenMonitor = requestsID.value(); + if (!m_isMapped) + m_wantsInitialFullscreenMonitor = requestsID.value(); } bool fs = requestsFS.value(); - if (m_bIsMapped) - g_pCompositor->changeWindowFullscreenModeClient(m_pSelf.lock(), FSMODE_FULLSCREEN, requestsFS.value()); + if (m_isMapped) + g_pCompositor->changeWindowFullscreenModeClient(m_self.lock(), FSMODE_FULLSCREEN, requestsFS.value()); - if (!m_bIsMapped) - m_bWantsInitialFullscreen = fs; + if (!m_isMapped) + m_wantsInitialFullscreen = fs; } - if (requestsMX.has_value() && !(m_eSuppressedEvents & SUPPRESS_MAXIMIZE)) { - if (m_bIsMapped) - g_pCompositor->changeWindowFullscreenModeClient(m_pSelf.lock(), FSMODE_MAXIMIZED, requestsMX.value()); + if (requestsMX.has_value() && !(m_suppressedEvents & SUPPRESS_MAXIMIZE)) { + if (m_isMapped) + g_pCompositor->changeWindowFullscreenModeClient(m_self.lock(), FSMODE_MAXIMIZED, requestsMX.value()); } } @@ -1452,107 +1452,107 @@ void CWindow::onUpdateMeta() { const auto NEWTITLE = fetchTitle(); bool doUpdate = false; - if (m_szTitle != NEWTITLE) { - m_szTitle = NEWTITLE; + if (m_title != NEWTITLE) { + m_title = NEWTITLE; g_pEventManager->postEvent(SHyprIPCEvent{"windowtitle", std::format("{:x}", (uintptr_t)this)}); - g_pEventManager->postEvent(SHyprIPCEvent{"windowtitlev2", std::format("{:x},{}", (uintptr_t)this, m_szTitle)}); - EMIT_HOOK_EVENT("windowTitle", m_pSelf.lock()); + g_pEventManager->postEvent(SHyprIPCEvent{"windowtitlev2", std::format("{:x},{}", (uintptr_t)this, m_title)}); + EMIT_HOOK_EVENT("windowTitle", m_self.lock()); - if (m_pSelf == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others - g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_szClass + "," + m_szTitle}); + if (m_self == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_class + "," + m_title}); g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)this)}); - EMIT_HOOK_EVENT("activeWindow", m_pSelf.lock()); + EMIT_HOOK_EVENT("activeWindow", m_self.lock()); } - Debug::log(LOG, "Window {:x} set title to {}", (uintptr_t)this, m_szTitle); + Debug::log(LOG, "Window {:x} set title to {}", (uintptr_t)this, m_title); doUpdate = true; } const auto NEWCLASS = fetchClass(); - if (m_szClass != NEWCLASS) { - m_szClass = NEWCLASS; + if (m_class != NEWCLASS) { + m_class = NEWCLASS; - if (m_pSelf == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others - g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_szClass + "," + m_szTitle}); + if (m_self == g_pCompositor->m_lastWindow) { // if it's the active, let's post an event to update others + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", m_class + "," + m_title}); g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)this)}); - EMIT_HOOK_EVENT("activeWindow", m_pSelf.lock()); + EMIT_HOOK_EVENT("activeWindow", m_self.lock()); } - Debug::log(LOG, "Window {:x} set class to {}", (uintptr_t)this, m_szClass); + Debug::log(LOG, "Window {:x} set class to {}", (uintptr_t)this, m_class); doUpdate = true; } if (doUpdate) { updateDynamicRules(); - g_pCompositor->updateWindowAnimatedDecorationValues(m_pSelf.lock()); + g_pCompositor->updateWindowAnimatedDecorationValues(m_self.lock()); updateToplevel(); } } std::string CWindow::fetchTitle() { - if (!m_bIsX11) { - if (m_pXDGSurface && m_pXDGSurface->toplevel) - return m_pXDGSurface->toplevel->state.title; + if (!m_isX11) { + if (m_xdgSurface && m_xdgSurface->toplevel) + return m_xdgSurface->toplevel->state.title; } else { - if (m_pXWaylandSurface) - return m_pXWaylandSurface->state.title; + if (m_xwaylandSurface) + return m_xwaylandSurface->state.title; } return ""; } std::string CWindow::fetchClass() { - if (!m_bIsX11) { - if (m_pXDGSurface && m_pXDGSurface->toplevel) - return m_pXDGSurface->toplevel->state.appid; + if (!m_isX11) { + if (m_xdgSurface && m_xdgSurface->toplevel) + return m_xdgSurface->toplevel->state.appid; } else { - if (m_pXWaylandSurface) - return m_pXWaylandSurface->state.appid; + if (m_xwaylandSurface) + return m_xwaylandSurface->state.appid; } return ""; } void CWindow::onAck(uint32_t serial) { - const auto SERIAL = std::find_if(m_vPendingSizeAcks.rbegin(), m_vPendingSizeAcks.rend(), [serial](const auto& e) { return e.first == serial; }); + const auto SERIAL = std::find_if(m_pendingSizeAcks.rbegin(), m_pendingSizeAcks.rend(), [serial](const auto& e) { return e.first == serial; }); - if (SERIAL == m_vPendingSizeAcks.rend()) + if (SERIAL == m_pendingSizeAcks.rend()) return; - m_pPendingSizeAck = *SERIAL; - std::erase_if(m_vPendingSizeAcks, [&](const auto& el) { return el.first <= SERIAL->first; }); + m_pendingSizeAck = *SERIAL; + std::erase_if(m_pendingSizeAcks, [&](const auto& el) { return el.first <= SERIAL->first; }); } void CWindow::onResourceChangeX11() { - if (m_pXWaylandSurface->surface && !m_pWLSurface->resource()) - m_pWLSurface->assign(m_pXWaylandSurface->surface.lock(), m_pSelf.lock()); - else if (!m_pXWaylandSurface->surface && m_pWLSurface->resource()) - m_pWLSurface->unassign(); + if (m_xwaylandSurface->surface && !m_wlSurface->resource()) + m_wlSurface->assign(m_xwaylandSurface->surface.lock(), m_self.lock()); + else if (!m_xwaylandSurface->surface && m_wlSurface->resource()) + m_wlSurface->unassign(); // update metadata as well, // could be first assoc and we need to catch the class onUpdateMeta(); - Debug::log(LOG, "xwayland window {:x} -> association to {:x}", (uintptr_t)m_pXWaylandSurface.get(), (uintptr_t)m_pWLSurface->resource().get()); + Debug::log(LOG, "xwayland window {:x} -> association to {:x}", (uintptr_t)m_xwaylandSurface.get(), (uintptr_t)m_wlSurface->resource().get()); } void CWindow::onX11ConfigureRequest(CBox box) { - if (!m_pXWaylandSurface->surface || !m_pXWaylandSurface->mapped || !m_bIsMapped) { - m_pXWaylandSurface->configure(box); - m_vPendingReportedSize = box.size(); - m_vReportedSize = box.size(); - m_vReportedPosition = box.pos(); + if (!m_xwaylandSurface->surface || !m_xwaylandSurface->mapped || !m_isMapped) { + m_xwaylandSurface->configure(box); + m_pendingReportedSize = box.size(); + m_reportedSize = box.size(); + m_reportedPosition = box.pos(); updateX11SurfaceScale(); return; } - g_pHyprRenderer->damageWindow(m_pSelf.lock()); + g_pHyprRenderer->damageWindow(m_self.lock()); - if (!m_bIsFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_pSelf) { + if (!m_isFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_self) { sendWindowSize(true); g_pInputManager->refocus(); - g_pHyprRenderer->damageWindow(m_pSelf.lock()); + g_pHyprRenderer->damageWindow(m_self.lock()); return; } @@ -1561,41 +1561,41 @@ void CWindow::onX11ConfigureRequest(CBox box) { else setHidden(true); - m_vRealPosition->setValueAndWarp(xwaylandPositionToReal(box.pos())); - m_vRealSize->setValueAndWarp(xwaylandSizeToReal(box.size())); + m_realPosition->setValueAndWarp(xwaylandPositionToReal(box.pos())); + m_realSize->setValueAndWarp(xwaylandSizeToReal(box.size())); - m_vPosition = m_vRealPosition->goal(); - m_vSize = m_vRealSize->goal(); + m_position = m_realPosition->goal(); + m_size = m_realSize->goal(); - if (m_vPendingReportedSize != box.size() || m_vReportedPosition != box.pos()) { - m_pXWaylandSurface->configure(box); - m_vReportedSize = box.size(); - m_vPendingReportedSize = box.size(); - m_vReportedPosition = box.pos(); + if (m_pendingReportedSize != box.size() || m_reportedPosition != box.pos()) { + m_xwaylandSurface->configure(box); + m_reportedSize = box.size(); + m_pendingReportedSize = box.size(); + m_reportedPosition = box.pos(); } updateX11SurfaceScale(); updateWindowDecos(); - if (!m_pWorkspace || !m_pWorkspace->isVisible()) + if (!m_workspace || !m_workspace->isVisible()) return; // further things are only for visible windows - m_pWorkspace = g_pCompositor->getMonitorFromVector(m_vRealPosition->goal() + m_vRealSize->goal() / 2.f)->activeWorkspace; + m_workspace = g_pCompositor->getMonitorFromVector(m_realPosition->goal() + m_realSize->goal() / 2.f)->activeWorkspace; - g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true); + g_pCompositor->changeWindowZOrder(m_self.lock(), true); - m_bCreatedOverFullscreen = true; + m_createdOverFullscreen = true; - g_pHyprRenderer->damageWindow(m_pSelf.lock()); + g_pHyprRenderer->damageWindow(m_self.lock()); } void CWindow::warpCursor(bool force) { - static auto PERSISTENTWARPS = CConfigValue("cursor:persistent_warps"); - const auto coords = m_vRelativeCursorCoordsOnLastWarp; - m_vRelativeCursorCoordsOnLastWarp.x = -1; // reset m_vRelativeCursorCoordsOnLastWarp + static auto PERSISTENTWARPS = CConfigValue("cursor:persistent_warps"); + const auto coords = m_relativeCursorCoordsOnLastWarp; + m_relativeCursorCoordsOnLastWarp.x = -1; // reset m_vRelativeCursorCoordsOnLastWarp - if (*PERSISTENTWARPS && coords.x > 0 && coords.y > 0 && coords < m_vSize) // don't warp cursor outside the window - g_pCompositor->warpCursorTo(m_vPosition + coords, force); + if (*PERSISTENTWARPS && coords.x > 0 && coords.y > 0 && coords < m_size) // don't warp cursor outside the window + g_pCompositor->warpCursorTo(m_position + coords, force); else g_pCompositor->warpCursorTo(middle(), force); } @@ -1619,7 +1619,7 @@ PHLWINDOW CWindow::getSwallower() { break; for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || w->isHidden()) + if (!w->m_isMapped || w->isHidden()) continue; if (w->getPID() == currentPid) @@ -1628,13 +1628,13 @@ PHLWINDOW CWindow::getSwallower() { } if (!(*PSWALLOWREGEX).empty()) - std::erase_if(candidates, [&](const auto& other) { return !RE2::FullMatch(other->m_szClass, *PSWALLOWREGEX); }); + std::erase_if(candidates, [&](const auto& other) { return !RE2::FullMatch(other->m_class, *PSWALLOWREGEX); }); if (candidates.size() == 0) return nullptr; if (!(*PSWALLOWEXREGEX).empty()) - std::erase_if(candidates, [&](const auto& other) { return RE2::FullMatch(other->m_szTitle, *PSWALLOWEXREGEX); }); + std::erase_if(candidates, [&](const auto& other) { return RE2::FullMatch(other->m_title, *PSWALLOWEXREGEX); }); if (candidates.size() == 0) return nullptr; @@ -1657,29 +1657,29 @@ PHLWINDOW CWindow::getSwallower() { void CWindow::unsetWindowData(eOverridePriority priority) { for (auto const& element : NWindowProperties::boolWindowProperties) { - element.second(m_pSelf.lock())->unset(priority); + element.second(m_self.lock())->unset(priority); } for (auto const& element : NWindowProperties::intWindowProperties) { - element.second(m_pSelf.lock())->unset(priority); + element.second(m_self.lock())->unset(priority); } for (auto const& element : NWindowProperties::floatWindowProperties) { - element.second(m_pSelf.lock())->unset(priority); + element.second(m_self.lock())->unset(priority); } } bool CWindow::isX11OverrideRedirect() { - return m_pXWaylandSurface && m_pXWaylandSurface->overrideRedirect; + return m_xwaylandSurface && m_xwaylandSurface->overrideRedirect; } bool CWindow::isModal() { - return (m_pXWaylandSurface && m_pXWaylandSurface->modal); + return (m_xwaylandSurface && m_xwaylandSurface->modal); } Vector2D CWindow::requestedMinSize() { - if ((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && !m_pXDGSurface->toplevel)) + if ((m_isX11 && !m_xwaylandSurface->sizeHints) || (!m_isX11 && !m_xdgSurface->toplevel)) return Vector2D(1, 1); - Vector2D minSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->min_width, m_pXWaylandSurface->sizeHints->min_height) : m_pXDGSurface->toplevel->layoutMinSize(); + Vector2D minSize = m_isX11 ? Vector2D(m_xwaylandSurface->sizeHints->min_width, m_xwaylandSurface->sizeHints->min_height) : m_xdgSurface->toplevel->layoutMinSize(); minSize = minSize.clamp({1, 1}); @@ -1688,10 +1688,10 @@ Vector2D CWindow::requestedMinSize() { Vector2D CWindow::requestedMaxSize() { constexpr int NO_MAX_SIZE_LIMIT = 99999; - if (((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && (!m_pXDGSurface || !m_pXDGSurface->toplevel)) || m_sWindowData.noMaxSize.valueOrDefault())) + if (((m_isX11 && !m_xwaylandSurface->sizeHints) || (!m_isX11 && (!m_xdgSurface || !m_xdgSurface->toplevel)) || m_windowData.noMaxSize.valueOrDefault())) return Vector2D(NO_MAX_SIZE_LIMIT, NO_MAX_SIZE_LIMIT); - Vector2D maxSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->max_width, m_pXWaylandSurface->sizeHints->max_height) : m_pXDGSurface->toplevel->layoutMaxSize(); + Vector2D maxSize = m_isX11 ? Vector2D(m_xwaylandSurface->sizeHints->max_width, m_xwaylandSurface->sizeHints->max_height) : m_xdgSurface->toplevel->layoutMaxSize(); if (maxSize.x < 5) maxSize.x = NO_MAX_SIZE_LIMIT; @@ -1702,13 +1702,13 @@ Vector2D CWindow::requestedMaxSize() { } Vector2D CWindow::realToReportSize() { - if (!m_bIsX11) - return m_vRealSize->goal().clamp(Vector2D{0, 0}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); + if (!m_isX11) + return m_realSize->goal().clamp(Vector2D{0, 0}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); - const auto REPORTSIZE = m_vRealSize->goal().clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); - const auto PMONITOR = m_pMonitor.lock(); + const auto REPORTSIZE = m_realSize->goal().clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); + const auto PMONITOR = m_monitor.lock(); if (*PXWLFORCESCALEZERO && PMONITOR) return REPORTSIZE * PMONITOR->scale; @@ -1717,16 +1717,16 @@ Vector2D CWindow::realToReportSize() { } Vector2D CWindow::realToReportPosition() { - if (!m_bIsX11) - return m_vRealPosition->goal(); + if (!m_isX11) + return m_realPosition->goal(); - return g_pXWaylandManager->waylandToXWaylandCoords(m_vRealPosition->goal()); + return g_pXWaylandManager->waylandToXWaylandCoords(m_realPosition->goal()); } Vector2D CWindow::xwaylandSizeToReal(Vector2D size) { static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_monitor.lock(); const auto SIZE = size.clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); const auto SCALE = *PXWLFORCESCALEZERO ? PMONITOR->scale : 1.0f; @@ -1740,85 +1740,85 @@ Vector2D CWindow::xwaylandPositionToReal(Vector2D pos) { void CWindow::updateX11SurfaceScale() { static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); - m_fX11SurfaceScaledBy = 1.0f; - if (m_bIsX11 && *PXWLFORCESCALEZERO) { - if (const auto PMONITOR = m_pMonitor.lock(); PMONITOR) - m_fX11SurfaceScaledBy = PMONITOR->scale; + m_X11SurfaceScaledBy = 1.0f; + if (m_isX11 && *PXWLFORCESCALEZERO) { + if (const auto PMONITOR = m_monitor.lock(); PMONITOR) + m_X11SurfaceScaledBy = PMONITOR->scale; } } void CWindow::sendWindowSize(bool force) { - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_monitor.lock(); - Debug::log(TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", (uintptr_t)this, this->m_szTitle, m_vRealPosition->goal(), - m_vRealSize->goal(), force); + 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); // TODO: this should be decoupled from setWindowSize IMO const auto REPORTPOS = realToReportPosition(); const auto REPORTSIZE = realToReportSize(); - if (!force && m_vPendingReportedSize == REPORTSIZE && (m_vReportedPosition == REPORTPOS || !m_bIsX11)) + if (!force && m_pendingReportedSize == REPORTSIZE && (m_reportedPosition == REPORTPOS || !m_isX11)) return; - m_vReportedPosition = REPORTPOS; - m_vPendingReportedSize = REPORTSIZE; + m_reportedPosition = REPORTPOS; + m_pendingReportedSize = REPORTSIZE; updateX11SurfaceScale(); - if (m_bIsX11 && m_pXWaylandSurface) - m_pXWaylandSurface->configure({REPORTPOS, REPORTSIZE}); - else if (m_pXDGSurface && m_pXDGSurface->toplevel) - m_vPendingSizeAcks.emplace_back(m_pXDGSurface->toplevel->setSize(REPORTSIZE), REPORTPOS.floor()); + if (m_isX11 && m_xwaylandSurface) + m_xwaylandSurface->configure({REPORTPOS, REPORTSIZE}); + else if (m_xdgSurface && m_xdgSurface->toplevel) + m_pendingSizeAcks.emplace_back(m_xdgSurface->toplevel->setSize(REPORTSIZE), REPORTPOS.floor()); } NContentType::eContentType CWindow::getContentType() { - if (!m_pWLSurface || !m_pWLSurface->resource() || !m_pWLSurface->resource()->contentType.valid()) + if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->contentType.valid()) return CONTENT_TYPE_NONE; - return m_pWLSurface->resource()->contentType->value; + return m_wlSurface->resource()->contentType->value; } void CWindow::setContentType(NContentType::eContentType contentType) { - if (!m_pWLSurface->resource()->contentType.valid()) - m_pWLSurface->resource()->contentType = PROTO::contentType->getContentType(m_pWLSurface->resource()); + if (!m_wlSurface->resource()->contentType.valid()) + m_wlSurface->resource()->contentType = PROTO::contentType->getContentType(m_wlSurface->resource()); // else disallow content type change if proto is used? Debug::log(INFO, "ContentType for window {}", (int)contentType); - m_pWLSurface->resource()->contentType->value = contentType; + m_wlSurface->resource()->contentType->value = contentType; } void CWindow::deactivateGroupMembers() { auto curr = getGroupHead(); while (curr) { - if (curr != m_pSelf.lock()) { + if (curr != m_self.lock()) { // we dont want to deactivate unfocused xwayland windows // because X is weird, keep the behavior for wayland windows // also its not really needed for xwayland windows // ref: #9760 #9294 - if (!curr->m_bIsX11 && curr->m_pXDGSurface && curr->m_pXDGSurface->toplevel) - curr->m_pXDGSurface->toplevel->setActive(false); + if (!curr->m_isX11 && curr->m_xdgSurface && curr->m_xdgSurface->toplevel) + curr->m_xdgSurface->toplevel->setActive(false); } - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); if (curr == getGroupHead()) break; } } bool CWindow::isNotResponding() { - return g_pANRManager->isNotResponding(m_pSelf.lock()); + return g_pANRManager->isNotResponding(m_self.lock()); } std::optional CWindow::xdgTag() { - if (!m_pXDGSurface || !m_pXDGSurface->toplevel) + if (!m_xdgSurface || !m_xdgSurface->toplevel) return std::nullopt; - return m_pXDGSurface->toplevel->m_toplevelTag; + return m_xdgSurface->toplevel->m_toplevelTag; } std::optional CWindow::xdgDescription() { - if (!m_pXDGSurface || !m_pXDGSurface->toplevel) + if (!m_xdgSurface || !m_xdgSurface->toplevel) return std::nullopt; - return m_pXDGSurface->toplevel->m_toplevelDescription; + return m_xdgSurface->toplevel->m_toplevelDescription; } diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 9fbb7522..8a6590bd 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -67,14 +67,14 @@ enum eSuppressEvents : uint8_t { class IWindowTransformer; struct SAlphaValue { - float m_fAlpha; - bool m_bOverride; + float alpha; + bool override; float applyAlpha(float alpha) const { - if (m_bOverride) - return m_fAlpha; + if (override) + return alpha; else - return m_fAlpha * alpha; + return alpha * alpha; }; }; @@ -145,154 +145,151 @@ class CWindow { public: ~CWindow(); - SP m_pWLSurface; + SP m_wlSurface; struct { CSignal destroy; - } events; + } m_events; - WP m_pXDGSurface; - WP m_pXWaylandSurface; + WP m_xdgSurface; + WP m_xwaylandSurface; // this is the position and size of the "bounding box" - Vector2D m_vPosition = Vector2D(0, 0); - Vector2D m_vSize = Vector2D(0, 0); + Vector2D m_position = Vector2D(0, 0); + Vector2D m_size = Vector2D(0, 0); // this is the real position and size used to draw the thing - PHLANIMVAR m_vRealPosition; - PHLANIMVAR m_vRealSize; + PHLANIMVAR m_realPosition; + PHLANIMVAR m_realSize; // for not spamming the protocols - Vector2D m_vReportedPosition; - Vector2D m_vReportedSize; - Vector2D m_vPendingReportedSize; - std::optional> m_pPendingSizeAck; - std::vector> m_vPendingSizeAcks; + Vector2D m_reportedPosition; + Vector2D m_reportedSize; + Vector2D m_pendingReportedSize; + std::optional> m_pendingSizeAck; + std::vector> m_pendingSizeAcks; // for restoring floating statuses - Vector2D m_vLastFloatingSize; - Vector2D m_vLastFloatingPosition; + Vector2D m_lastFloatingSize; + Vector2D m_lastFloatingPosition; // for floating window offset in workspace animations - Vector2D m_vFloatingOffset = Vector2D(0, 0); + Vector2D m_floatingOffset = Vector2D(0, 0); // this is used for pseudotiling - bool m_bIsPseudotiled = false; - Vector2D m_vPseudoSize = Vector2D(1280, 720); + bool m_isPseudotiled = false; + Vector2D m_pseudoSize = Vector2D(1280, 720); // for recovering relative cursor position - Vector2D m_vRelativeCursorCoordsOnLastWarp = Vector2D(-1, -1); + Vector2D m_relativeCursorCoordsOnLastWarp = Vector2D(-1, -1); - bool m_bFirstMap = false; // for layouts - bool m_bIsFloating = false; - bool m_bDraggingTiled = false; // for dragging around tiled windows - bool m_bWasMaximized = false; - SFullscreenState m_sFullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE}; - std::string m_szTitle = ""; - std::string m_szClass = ""; - std::string m_szInitialTitle = ""; - std::string m_szInitialClass = ""; - PHLWORKSPACE m_pWorkspace; - PHLMONITORREF m_pMonitor; + bool m_firstMap = false; // for layouts + bool m_isFloating = false; + bool m_draggingTiled = false; // for dragging around tiled windows + SFullscreenState m_fullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE}; + std::string m_title = ""; + std::string m_class = ""; + std::string m_initialTitle = ""; + std::string m_initialClass = ""; + PHLWORKSPACE m_workspace; + PHLMONITORREF m_monitor; - bool m_bIsMapped = false; + bool m_isMapped = false; - bool m_bRequestsFloat = false; + bool m_requestsFloat = false; // This is for fullscreen apps - bool m_bCreatedOverFullscreen = false; + bool m_createdOverFullscreen = false; // XWayland stuff - bool m_bIsX11 = false; - PHLWINDOWREF m_pX11Parent; - bool m_bX11DoesntWantBorders = false; - bool m_bX11ShouldntFocus = false; - float m_fX11SurfaceScaledBy = 1.f; + bool m_isX11 = false; + bool m_X11DoesntWantBorders = false; + bool m_X11ShouldntFocus = false; + float m_X11SurfaceScaledBy = 1.f; // // For nofocus - bool m_bNoInitialFocus = false; + bool m_noInitialFocus = false; // Fullscreen and Maximize - bool m_bWantsInitialFullscreen = false; - MONITORID m_iWantsInitialFullscreenMonitor = MONITOR_INVALID; + bool m_wantsInitialFullscreen = false; + MONITORID m_wantsInitialFullscreenMonitor = MONITOR_INVALID; - // bitfield eSuppressEvents - uint64_t m_eSuppressedEvents = SUPPRESS_NONE; + // bitfield suppressEvents + uint64_t m_suppressedEvents = SUPPRESS_NONE; // desktop components - UP m_pSubsurfaceHead; - UP m_pPopupHead; + UP m_subsurfaceHead; + UP m_popupHead; // Animated border - CGradientValueData m_cRealBorderColor = {0}; - CGradientValueData m_cRealBorderColorPrevious = {0}; - PHLANIMVAR m_fBorderFadeAnimationProgress; - PHLANIMVAR m_fBorderAngleAnimationProgress; + CGradientValueData m_realBorderColor = {0}; + CGradientValueData m_realBorderColorPrevious = {0}; + PHLANIMVAR m_borderFadeAnimationProgress; + PHLANIMVAR m_borderAngleAnimationProgress; // Fade in-out - PHLANIMVAR m_fAlpha; - bool m_bFadingOut = false; - bool m_bReadyToDelete = false; - Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in - Vector2D m_vOriginalClosedSize; // drawing the closing animations - SBoxExtents m_eOriginalClosedExtents; - bool m_bAnimatingIn = false; + PHLANIMVAR m_alpha; + bool m_fadingOut = false; + bool m_readyToDelete = false; + Vector2D m_originalClosedPos; // these will be used for calculations later on in + Vector2D m_originalClosedSize; // drawing the closing animations + SBoxExtents m_originalClosedExtents; + bool m_animatingIn = false; // For pinned (sticky) windows - bool m_bPinned = false; + bool m_pinned = false; // For preserving pinned state when fullscreening a pinned window - bool m_bPinFullscreened = false; + bool m_pinFullscreened = false; // urgency hint - bool m_bIsUrgent = false; + bool m_isUrgent = false; // for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window. - PHLWINDOWREF m_pLastCycledWindow; + PHLWINDOWREF m_lastCycledWindow; // Window decorations // TODO: make this a SP. - std::vector> m_dWindowDecorations; - std::vector m_vDecosToRemove; + std::vector> m_windowDecorations; + std::vector m_decosToRemove; // Special render data, rules, etc - SWindowData m_sWindowData; + SWindowData m_windowData; // Transformers - std::vector> m_vTransformers; + std::vector> m_transformers; // for alpha - PHLANIMVAR m_fActiveInactiveAlpha; - PHLANIMVAR m_fMovingFromWorkspaceAlpha; + PHLANIMVAR m_activeInactiveAlpha; + PHLANIMVAR m_movingFromWorkspaceAlpha; // animated shadow color - PHLANIMVAR m_cRealShadowColor; + PHLANIMVAR m_realShadowColor; // animated tint - PHLANIMVAR m_fDimPercent; + PHLANIMVAR m_dimPercent; // animate moving to an invisible workspace - int m_iMonitorMovedFrom = -1; // -1 means not moving - PHLANIMVAR m_fMovingToWorkspaceAlpha; + int m_monitorMovedFrom = -1; // -1 means not moving + PHLANIMVAR m_movingToWorkspaceAlpha; // swallowing - PHLWINDOWREF m_pSwallowed; - bool m_bCurrentlySwallowed = false; - bool m_bGroupSwallowed = false; + PHLWINDOWREF m_swallowed; + bool m_currentlySwallowed = false; + bool m_groupSwallowed = false; // focus stuff - bool m_bStayFocused = false; + bool m_stayFocused = false; // for toplevel monitor events - MONITORID m_iLastToplevelMonitorID = -1; - MONITORID m_iLastSurfaceMonitorID = -1; + MONITORID m_lastSurfaceMonitorID = -1; // for idle inhibiting windows - eIdleInhibitMode m_eIdleInhibitMode = IDLEINHIBIT_NONE; + eIdleInhibitMode m_idleInhibitMode = IDLEINHIBIT_NONE; // initial token. Will be unregistered on workspace change or timeout of 2 minutes - std::string m_szInitialWorkspaceToken = ""; + std::string m_initialWorkspaceToken = ""; // for groups struct SGroupData { @@ -300,13 +297,13 @@ class CWindow { bool head = false; bool locked = false; // per group lock bool deny = false; // deny window from enter a group or made a group - } m_sGroupData; - uint16_t m_eGroupRules = GROUP_NONE; + } m_groupData; + uint16_t m_groupRules = GROUP_NONE; - bool m_bTearingHint = false; + bool m_tearingHint = false; // stores the currently matched window rules - std::vector> m_vMatchedRules; + std::vector> m_matchedRules; // window tags CTagKeeper m_tags; @@ -316,8 +313,8 @@ class CWindow { // For the list lookup bool operator==(const CWindow& rhs) const { - return m_pXDGSurface == rhs.m_pXDGSurface && m_pXWaylandSurface == rhs.m_pXWaylandSurface && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && - m_bFadingOut == rhs.m_bFadingOut; + return m_xdgSurface == rhs.m_xdgSurface && m_xwaylandSurface == rhs.m_xwaylandSurface && m_position == rhs.m_position && m_size == rhs.m_size && + m_fadingOut == rhs.m_fadingOut; } // methods @@ -411,7 +408,7 @@ class CWindow { std::optional xdgDescription(); CBox getWindowMainSurfaceBox() const { - return {m_vRealPosition->value().x, m_vRealPosition->value().y, m_vRealSize->value().x, m_vRealSize->value().y}; + return {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y}; } // listeners @@ -421,7 +418,7 @@ class CWindow { std::unordered_map getEnv(); // - PHLWINDOWREF m_pSelf; + PHLWINDOWREF m_self; // make private once we move listeners to inside CWindow struct { @@ -436,13 +433,13 @@ class CWindow { CHyprSignalListener updateState; CHyprSignalListener updateMetadata; CHyprSignalListener resourceChange; - } listeners; + } m_listeners; private: // For hidden windows and stuff - bool m_bHidden = false; - bool m_bSuspended = false; - WORKSPACEID m_iLastWorkspace = WORKSPACE_INVALID; + bool m_hidden = false; + bool m_suspended = false; + WORKSPACEID m_lastWorkspace = WORKSPACE_INVALID; }; inline bool valid(PHLWINDOW w) { @@ -456,49 +453,49 @@ inline bool valid(PHLWINDOWREF w) { inline bool validMapped(PHLWINDOW w) { if (!valid(w)) return false; - return w->m_bIsMapped; + return w->m_isMapped; } inline bool validMapped(PHLWINDOWREF w) { if (!valid(w)) return false; - return w->m_bIsMapped; + return w->m_isMapped; } namespace NWindowProperties { static const std::unordered_map*(const PHLWINDOW&)>> boolWindowProperties = { - {"allowsinput", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.allowsInput; }}, - {"dimaround", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.dimAround; }}, - {"decorate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.decorate; }}, - {"focusonactivate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }}, - {"keepaspectratio", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.keepAspectRatio; }}, - {"nearestneighbor", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.nearestNeighbor; }}, - {"noanim", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noAnim; }}, - {"noblur", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noBlur; }}, - {"noborder", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noBorder; }}, - {"nodim", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noDim; }}, - {"nofocus", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noFocus; }}, - {"nomaxsize", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noMaxSize; }}, - {"norounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noRounding; }}, - {"noshadow", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noShadow; }}, - {"noshortcutsinhibit", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }}, - {"opaque", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.opaque; }}, - {"forcergbx", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.RGBX; }}, - {"syncfullscreen", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.syncFullscreen; }}, - {"immediate", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.tearing; }}, - {"xray", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.xray; }}, - {"nofollowmouse", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.noFollowMouse; }}, + {"allowsinput", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.allowsInput; }}, + {"dimaround", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.dimAround; }}, + {"decorate", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.decorate; }}, + {"focusonactivate", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.focusOnActivate; }}, + {"keepaspectratio", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.keepAspectRatio; }}, + {"nearestneighbor", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.nearestNeighbor; }}, + {"noanim", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noAnim; }}, + {"noblur", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noBlur; }}, + {"noborder", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noBorder; }}, + {"nodim", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noDim; }}, + {"nofocus", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noFocus; }}, + {"nomaxsize", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noMaxSize; }}, + {"norounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noRounding; }}, + {"noshadow", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noShadow; }}, + {"noshortcutsinhibit", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noShortcutsInhibit; }}, + {"opaque", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.opaque; }}, + {"forcergbx", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.RGBX; }}, + {"syncfullscreen", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.syncFullscreen; }}, + {"immediate", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.tearing; }}, + {"xray", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.xray; }}, + {"nofollowmouse", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.noFollowMouse; }}, }; const std::unordered_map*(const PHLWINDOW&)>> intWindowProperties = { - {"rounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.rounding; }}, - {"bordersize", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.borderSize; }}, + {"rounding", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.rounding; }}, + {"bordersize", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.borderSize; }}, }; const std::unordered_map*(PHLWINDOW)>> floatWindowProperties = { - {"roundingpower", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.roundingPower; }}, - {"scrollmouse", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.scrollMouse; }}, - {"scrolltouchpad", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.scrollTouchpad; }}, + {"roundingpower", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.roundingPower; }}, + {"scrollmouse", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.scrollMouse; }}, + {"scrolltouchpad", [](const PHLWINDOW& pWindow) { return &pWindow->m_windowData.scrollTouchpad; }}, }; }; @@ -532,13 +529,13 @@ struct std::formatter : std::formatter { return std::format_to(out, "[Window nullptr]"); std::format_to(out, "["); - std::format_to(out, "Window {:x}: title: \"{}\"", (uintptr_t)w.get(), w->m_szTitle); + std::format_to(out, "Window {:x}: title: \"{}\"", (uintptr_t)w.get(), w->m_title); if (formatWorkspace) - std::format_to(out, ", workspace: {}", w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID); + std::format_to(out, ", workspace: {}", w->m_workspace ? w->workspaceID() : WORKSPACE_INVALID); if (formatMonitor) std::format_to(out, ", monitor: {}", w->monitorID()); if (formatClass) - std::format_to(out, ", class: {}", w->m_szClass); + std::format_to(out, ", class: {}", w->m_class); return std::format_to(out, "]"); } }; diff --git a/src/desktop/WindowRule.cpp b/src/desktop/WindowRule.cpp index 23269085..245d1583 100644 --- a/src/desktop/WindowRule.cpp +++ b/src/desktop/WindowRule.cpp @@ -13,7 +13,7 @@ static const auto RULES_PREFIX = std::unordered_set{ "size", "suppressevent", "tag", "workspace", "xray", }; -CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool isV2, bool isExecRule) : szValue(value), szRule(rule), v2(isV2), execRule(isExecRule) { +CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool isV2, bool isExecRule) : m_value(value), m_rule(rule), m_v2(isV2), m_execRule(isExecRule) { const auto VALS = CVarList(rule, 2, ' '); const bool VALID = RULES.contains(rule) || std::any_of(RULES_PREFIX.begin(), RULES_PREFIX.end(), [&rule](auto prefix) { return rule.starts_with(prefix); }) || (NWindowProperties::boolWindowProperties.find(VALS[0]) != NWindowProperties::boolWindowProperties.end()) || @@ -24,73 +24,73 @@ CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool return; if (rule == "float") - ruleType = RULE_FLOAT; + m_ruleType = RULE_FLOAT; else if (rule == "fullscreen") - ruleType = RULE_FULLSCREEN; + m_ruleType = RULE_FULLSCREEN; else if (rule == "maximize") - ruleType = RULE_MAXIMIZE; + m_ruleType = RULE_MAXIMIZE; else if (rule == "noinitialfocus") - ruleType = RULE_NOINITIALFOCUS; + m_ruleType = RULE_NOINITIALFOCUS; else if (rule == "pin") - ruleType = RULE_PIN; + m_ruleType = RULE_PIN; else if (rule == "stayfocused") - ruleType = RULE_STAYFOCUSED; + m_ruleType = RULE_STAYFOCUSED; else if (rule == "tile") - ruleType = RULE_TILE; + m_ruleType = RULE_TILE; else if (rule == "renderunfocused") - ruleType = RULE_RENDERUNFOCUSED; + m_ruleType = RULE_RENDERUNFOCUSED; else if (rule == "persistentsize") - ruleType = RULE_PERSISTENTSIZE; + m_ruleType = RULE_PERSISTENTSIZE; else if (rule.starts_with("animation")) - ruleType = RULE_ANIMATION; + m_ruleType = RULE_ANIMATION; else if (rule.starts_with("bordercolor")) - ruleType = RULE_BORDERCOLOR; + m_ruleType = RULE_BORDERCOLOR; else if (rule.starts_with("center")) - ruleType = RULE_CENTER; + m_ruleType = RULE_CENTER; else if (rule.starts_with("fullscreenstate")) - ruleType = RULE_FULLSCREENSTATE; + m_ruleType = RULE_FULLSCREENSTATE; else if (rule.starts_with("group")) - ruleType = RULE_GROUP; + m_ruleType = RULE_GROUP; else if (rule.starts_with("idleinhibit")) - ruleType = RULE_IDLEINHIBIT; + m_ruleType = RULE_IDLEINHIBIT; else if (rule.starts_with("maxsize")) - ruleType = RULE_MAXSIZE; + m_ruleType = RULE_MAXSIZE; else if (rule.starts_with("minsize")) - ruleType = RULE_MINSIZE; + m_ruleType = RULE_MINSIZE; else if (rule.starts_with("monitor")) - ruleType = RULE_MONITOR; + m_ruleType = RULE_MONITOR; else if (rule.starts_with("move")) - ruleType = RULE_MOVE; + m_ruleType = RULE_MOVE; else if (rule.starts_with("opacity")) - ruleType = RULE_OPACITY; + m_ruleType = RULE_OPACITY; else if (rule.starts_with("plugin:")) - ruleType = RULE_PLUGIN; + m_ruleType = RULE_PLUGIN; else if (rule.starts_with("pseudo")) - ruleType = RULE_PSEUDO; + m_ruleType = RULE_PSEUDO; else if (rule.starts_with("size")) - ruleType = RULE_SIZE; + m_ruleType = RULE_SIZE; else if (rule.starts_with("suppressevent")) - ruleType = RULE_SUPPRESSEVENT; + m_ruleType = RULE_SUPPRESSEVENT; else if (rule.starts_with("tag")) - ruleType = RULE_TAG; + m_ruleType = RULE_TAG; else if (rule.starts_with("workspace")) - ruleType = RULE_WORKSPACE; + m_ruleType = RULE_WORKSPACE; else if (rule.starts_with("prop")) - ruleType = RULE_PROP; + m_ruleType = RULE_PROP; else if (rule.starts_with("content")) - ruleType = RULE_CONTENT; + m_ruleType = RULE_CONTENT; else { // check if this is a prop. const CVarList VARS(rule, 0, 's', true); if (NWindowProperties::intWindowProperties.find(VARS[0]) != NWindowProperties::intWindowProperties.end() || NWindowProperties::boolWindowProperties.find(VARS[0]) != NWindowProperties::boolWindowProperties.end() || NWindowProperties::floatWindowProperties.find(VARS[0]) != NWindowProperties::floatWindowProperties.end()) { - *const_cast(&szRule) = "prop " + rule; - ruleType = RULE_PROP; - Debug::log(LOG, "CWindowRule: direct prop rule found, rewritten {} -> {}", rule, szRule); + *const_cast(&m_rule) = "prop " + rule; + m_ruleType = RULE_PROP; + Debug::log(LOG, "CWindowRule: direct prop rule found, rewritten {} -> {}", rule, m_rule); } else { Debug::log(ERR, "CWindowRule: didn't match a rule that was found valid?!"); - ruleType = RULE_INVALID; + m_ruleType = RULE_INVALID; } } } diff --git a/src/desktop/WindowRule.hpp b/src/desktop/WindowRule.hpp index 465ddbb1..084c67f9 100644 --- a/src/desktop/WindowRule.hpp +++ b/src/desktop/WindowRule.hpp @@ -40,33 +40,33 @@ class CWindowRule { RULE_PERSISTENTSIZE }; - eRuleType ruleType = RULE_INVALID; + eRuleType m_ruleType = RULE_INVALID; - const std::string szValue; - const std::string szRule; - const bool v2 = false; - const bool execRule = false; + const std::string m_value; + const std::string m_rule; + const bool m_v2 = false; + const bool m_execRule = false; - std::string szTitle; - std::string szClass; - std::string szInitialTitle; - std::string szInitialClass; - std::string szTag; - int bX11 = -1; // -1 means "ANY" - int bFloating = -1; - int bFullscreen = -1; - int bPinned = -1; - int bFocus = -1; - std::string szFullscreenState = ""; // empty means any - std::string szOnWorkspace = ""; // empty means any - std::string szWorkspace = ""; // empty means any - std::string szContentType = ""; // empty means any - std::string szXdgTag = ""; // empty means any + std::string m_title; + std::string m_class; + std::string m_initialTitle; + std::string m_initialClass; + std::string m_tag; + int m_X11 = -1; // -1 means "ANY" + int m_floating = -1; + int m_fullscreen = -1; + int m_pinned = -1; + int m_focus = -1; + std::string m_fullscreenState = ""; // empty means any + std::string m_onWorkspace = ""; // empty means any + std::string m_workspace = ""; // empty means any + std::string m_contentType = ""; // empty means any + std::string m_xdgTag = ""; // empty means any // precompiled regexes - CRuleRegexContainer rTitle; - CRuleRegexContainer rClass; - CRuleRegexContainer rInitialTitle; - CRuleRegexContainer rInitialClass; - CRuleRegexContainer rV1Regex; + CRuleRegexContainer m_titleRegex; + CRuleRegexContainer m_classRegex; + CRuleRegexContainer m_initialTitleRegex; + CRuleRegexContainer m_initialClassRegex; + CRuleRegexContainer m_v1Regex; }; \ No newline at end of file diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index 18322799..8bb7f7a0 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -525,7 +525,7 @@ MONITORID CWorkspace::monitorID() { PHLWINDOW CWorkspace::getFullscreenWindow() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == m_self && w->isFullscreen()) + if (w->m_workspace == m_self && w->isFullscreen()) return w; } @@ -547,11 +547,11 @@ bool CWorkspace::isVisibleNotCovered() { int CWorkspace::getWindows(std::optional onlyTiled, std::optional onlyPinned, std::optional onlyVisible) { int no = 0; for (auto const& w : g_pCompositor->m_windows) { - if (w->workspaceID() != m_id || !w->m_bIsMapped) + if (w->workspaceID() != m_id || !w->m_isMapped) continue; - if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value()) + if (onlyTiled.has_value() && w->m_isFloating == onlyTiled.value()) continue; - if (onlyPinned.has_value() && w->m_bPinned != onlyPinned.value()) + if (onlyPinned.has_value() && w->m_pinned != onlyPinned.value()) continue; if (onlyVisible.has_value() && w->isHidden() == onlyVisible.value()) continue; @@ -564,13 +564,13 @@ int CWorkspace::getWindows(std::optional onlyTiled, std::optional on int CWorkspace::getGroups(std::optional onlyTiled, std::optional onlyPinned, std::optional onlyVisible) { int no = 0; for (auto const& w : g_pCompositor->m_windows) { - if (w->workspaceID() != m_id || !w->m_bIsMapped) + if (w->workspaceID() != m_id || !w->m_isMapped) continue; - if (!w->m_sGroupData.head) + if (!w->m_groupData.head) continue; - if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value()) + if (onlyTiled.has_value() && w->m_isFloating == onlyTiled.value()) continue; - if (onlyPinned.has_value() && w->m_bPinned != onlyPinned.value()) + if (onlyPinned.has_value() && w->m_pinned != onlyPinned.value()) continue; if (onlyVisible.has_value() && w->isHidden() == onlyVisible.value()) continue; @@ -581,7 +581,7 @@ int CWorkspace::getGroups(std::optional onlyTiled, std::optional onl PHLWINDOW CWorkspace::getFirstWindow() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == m_self && w->m_bIsMapped && !w->isHidden()) + if (w->m_workspace == m_self && w->m_isMapped && !w->isHidden()) return w; } @@ -592,7 +592,7 @@ PHLWINDOW CWorkspace::getTopLeftWindow() { const auto PMONITOR = m_monitor.lock(); for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace != m_self || !w->m_bIsMapped || w->isHidden()) + if (w->m_workspace != m_self || !w->m_isMapped || w->isHidden()) continue; const auto WINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved(); @@ -605,7 +605,7 @@ PHLWINDOW CWorkspace::getTopLeftWindow() { bool CWorkspace::hasUrgentWindow() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == m_self && w->m_bIsMapped && w->m_bIsUrgent) + if (w->m_workspace == m_self && w->m_isMapped && w->m_isUrgent) return true; } @@ -614,7 +614,7 @@ bool CWorkspace::hasUrgentWindow() { void CWorkspace::updateWindowDecos() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace != m_self) + if (w->m_workspace != m_self) continue; w->updateWindowDecos(); @@ -625,7 +625,7 @@ void CWorkspace::updateWindowData() { const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_self.lock()); for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace != m_self) + if (w->m_workspace != m_self) continue; w->updateWindowData(WORKSPACERULE); @@ -634,7 +634,7 @@ void CWorkspace::updateWindowData() { void CWorkspace::forceReportSizesToWindows() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace != m_self || !w->m_bIsMapped || w->isHidden()) + if (w->m_workspace != m_self || !w->m_isMapped || w->isHidden()) continue; w->sendWindowSize(true); @@ -658,10 +658,10 @@ void CWorkspace::rename(const std::string& name) { } void CWorkspace::updateWindows() { - m_hasFullscreenWindow = std::ranges::any_of(g_pCompositor->m_windows, [this](const auto& w) { return w->m_bIsMapped && w->m_pWorkspace == m_self && w->isFullscreen(); }); + m_hasFullscreenWindow = std::ranges::any_of(g_pCompositor->m_windows, [this](const auto& w) { return w->m_isMapped && w->m_workspace == m_self && w->isFullscreen(); }); for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || w->m_pWorkspace != m_self) + if (!w->m_isMapped || w->m_workspace != m_self) continue; w->updateDynamicRules(); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 7b0fbd34..3cff2516 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -45,11 +45,11 @@ static void setVector2DAnimToMove(WP pav) { const auto PHLWINDOW = animvar->m_Context.pWindow.lock(); if (PHLWINDOW) - PHLWINDOW->m_bAnimatingIn = false; + PHLWINDOW->m_animatingIn = false; } void Events::listener_mapWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); static auto PINACTIVEALPHA = CConfigValue("decoration:inactive_opacity"); static auto PACTIVEALPHA = CConfigValue("decoration:active_opacity"); @@ -62,16 +62,16 @@ void Events::listener_mapWindow(void* owner, void* data) { g_pCompositor->setActiveMonitor(g_pCompositor->getMonitorFromVector({})); PMONITOR = g_pCompositor->m_lastMonitor.lock(); } - auto PWORKSPACE = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; - PWINDOW->m_pMonitor = PMONITOR; - PWINDOW->m_pWorkspace = PWORKSPACE; - PWINDOW->m_bIsMapped = true; - PWINDOW->m_bReadyToDelete = false; - PWINDOW->m_bFadingOut = false; - PWINDOW->m_szTitle = PWINDOW->fetchTitle(); - PWINDOW->m_bFirstMap = true; - PWINDOW->m_szInitialTitle = PWINDOW->m_szTitle; - PWINDOW->m_szInitialClass = PWINDOW->fetchClass(); + auto PWORKSPACE = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; + PWINDOW->m_monitor = PMONITOR; + PWINDOW->m_workspace = PWORKSPACE; + PWINDOW->m_isMapped = true; + PWINDOW->m_readyToDelete = false; + PWINDOW->m_fadingOut = false; + PWINDOW->m_title = PWINDOW->fetchTitle(); + PWINDOW->m_firstMap = true; + PWINDOW->m_initialTitle = PWINDOW->m_title; + PWINDOW->m_initialClass = PWINDOW->fetchClass(); // check for token std::string requestedWorkspace = ""; @@ -89,7 +89,7 @@ void Events::listener_mapWindow(void* owner, void* data) { Debug::log(LOG, "HL_INITIAL_WORKSPACE_TOKEN {} -> {}", SZTOKEN, WS.workspace); - if (g_pCompositor->getWorkspaceByString(WS.workspace) != PWINDOW->m_pWorkspace) { + if (g_pCompositor->getWorkspaceByString(WS.workspace) != PWINDOW->m_workspace) { requestedWorkspace = WS.workspace; workspaceSilent = true; } @@ -102,7 +102,7 @@ void Events::listener_mapWindow(void* owner, void* data) { TOKEN->m_data = WS; } - PWINDOW->m_szInitialWorkspaceToken = SZTOKEN; + PWINDOW->m_initialWorkspaceToken = SZTOKEN; } } } @@ -117,7 +117,7 @@ void Events::listener_mapWindow(void* owner, void* data) { // registers the animated vars and stuff PWINDOW->onMap(); - const auto PWINDOWSURFACE = PWINDOW->m_pWLSurface->resource(); + const auto PWINDOWSURFACE = PWINDOW->m_wlSurface->resource(); if (!PWINDOWSURFACE) { g_pCompositor->removeWindowFromVectorSafe(PWINDOW); @@ -125,39 +125,39 @@ void Events::listener_mapWindow(void* owner, void* data) { } if (g_pXWaylandManager->shouldBeFloated(PWINDOW)) { - PWINDOW->m_bIsFloating = true; - PWINDOW->m_bRequestsFloat = true; + PWINDOW->m_isFloating = true; + PWINDOW->m_requestsFloat = true; } - PWINDOW->m_bX11ShouldntFocus = PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->isX11OverrideRedirect() && !PWINDOW->m_pXWaylandSurface->wantsFocus()); + PWINDOW->m_X11ShouldntFocus = PWINDOW->m_X11ShouldntFocus || (PWINDOW->m_isX11 && PWINDOW->isX11OverrideRedirect() && !PWINDOW->m_xwaylandSurface->wantsFocus()); // window rules - PWINDOW->m_vMatchedRules = g_pConfigManager->getMatchingRules(PWINDOW, false); + PWINDOW->m_matchedRules = g_pConfigManager->getMatchingRules(PWINDOW, false); std::optional requestedInternalFSMode, requestedClientFSMode; std::optional requestedFSState; - if (PWINDOW->m_bWantsInitialFullscreen || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->fullscreen)) + if (PWINDOW->m_wantsInitialFullscreen || (PWINDOW->m_isX11 && PWINDOW->m_xwaylandSurface->fullscreen)) requestedClientFSMode = FSMODE_FULLSCREEN; - MONITORID requestedFSMonitor = PWINDOW->m_iWantsInitialFullscreenMonitor; + MONITORID requestedFSMonitor = PWINDOW->m_wantsInitialFullscreenMonitor; - for (auto const& r : PWINDOW->m_vMatchedRules) { - switch (r->ruleType) { + for (auto const& r : PWINDOW->m_matchedRules) { + switch (r->m_ruleType) { case CWindowRule::RULE_MONITOR: { try { - const auto MONITORSTR = trim(r->szRule.substr(r->szRule.find(' '))); + const auto MONITORSTR = trim(r->m_rule.substr(r->m_rule.find(' '))); if (MONITORSTR == "unset") { - PWINDOW->m_pMonitor = PMONITOR; + PWINDOW->m_monitor = PMONITOR; } else { if (isNumber(MONITORSTR)) { const MONITORID MONITOR = std::stoi(MONITORSTR); if (const auto PM = g_pCompositor->getMonitorFromID(MONITOR); PM) - PWINDOW->m_pMonitor = PM; + PWINDOW->m_monitor = PM; else - PWINDOW->m_pMonitor = g_pCompositor->m_monitors.at(0); + PWINDOW->m_monitor = g_pCompositor->m_monitors.at(0); } else { const auto PMONITOR = g_pCompositor->getMonitorFromName(MONITORSTR); if (PMONITOR) - PWINDOW->m_pMonitor = PMONITOR; + PWINDOW->m_monitor = PMONITOR; else { Debug::log(ERR, "No monitor in monitor {} rule", MONITORSTR); continue; @@ -165,23 +165,23 @@ void Events::listener_mapWindow(void* owner, void* data) { } } - const auto PMONITORFROMID = PWINDOW->m_pMonitor.lock(); + const auto PMONITORFROMID = PWINDOW->m_monitor.lock(); - if (PWINDOW->m_pMonitor != PMONITOR) { + if (PWINDOW->m_monitor != PMONITOR) { g_pKeybindManager->m_mDispatchers["focusmonitor"](std::to_string(PWINDOW->monitorID())); PMONITOR = PMONITORFROMID; } - PWINDOW->m_pWorkspace = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; - PWORKSPACE = PWINDOW->m_pWorkspace; + PWINDOW->m_workspace = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; + PWORKSPACE = PWINDOW->m_workspace; Debug::log(LOG, "Rule monitor, applying to {:mw}", PWINDOW); requestedFSMonitor = MONITOR_INVALID; - } catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: {} -> {} | err: {}", r->szRule, r->szValue, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "Rule monitor failed, rule: {} -> {} | err: {}", r->m_rule, r->m_value, e.what()); } break; } case CWindowRule::RULE_WORKSPACE: { // check if it isnt unset - const auto WORKSPACERQ = r->szRule.substr(r->szRule.find_first_of(' ') + 1); + const auto WORKSPACERQ = r->m_rule.substr(r->m_rule.find_first_of(' ') + 1); if (WORKSPACERQ == "unset") requestedWorkspace = ""; @@ -193,28 +193,28 @@ void Events::listener_mapWindow(void* owner, void* data) { if (JUSTWORKSPACE == PWORKSPACE->m_name || JUSTWORKSPACE == "name:" + PWORKSPACE->m_name) requestedWorkspace = ""; - Debug::log(LOG, "Rule workspace matched by {}, {} applied.", PWINDOW, r->szValue); + Debug::log(LOG, "Rule workspace matched by {}, {} applied.", PWINDOW, r->m_value); requestedFSMonitor = MONITOR_INVALID; break; } case CWindowRule::RULE_FLOAT: { - PWINDOW->m_bIsFloating = true; + PWINDOW->m_isFloating = true; break; } case CWindowRule::RULE_TILE: { - PWINDOW->m_bIsFloating = false; + PWINDOW->m_isFloating = false; break; } case CWindowRule::RULE_PSEUDO: { - PWINDOW->m_bIsPseudotiled = true; + PWINDOW->m_isPseudotiled = true; break; } case CWindowRule::RULE_NOINITIALFOCUS: { - PWINDOW->m_bNoInitialFocus = true; + PWINDOW->m_noInitialFocus = true; break; } case CWindowRule::RULE_FULLSCREENSTATE: { - const auto ARGS = CVarList(r->szRule.substr(r->szRule.find_first_of(' ') + 1), 2, ' '); + const auto ARGS = CVarList(r->m_rule.substr(r->m_rule.find_first_of(' ') + 1), 2, ' '); int internalMode, clientMode; try { internalMode = std::stoi(ARGS[0]); @@ -226,25 +226,25 @@ void Events::listener_mapWindow(void* owner, void* data) { break; } case CWindowRule::RULE_SUPPRESSEVENT: { - CVarList vars(r->szRule, 0, 's', true); + CVarList vars(r->m_rule, 0, 's', true); for (size_t i = 1; i < vars.size(); ++i) { if (vars[i] == "fullscreen") - PWINDOW->m_eSuppressedEvents |= SUPPRESS_FULLSCREEN; + PWINDOW->m_suppressedEvents |= SUPPRESS_FULLSCREEN; else if (vars[i] == "maximize") - PWINDOW->m_eSuppressedEvents |= SUPPRESS_MAXIMIZE; + PWINDOW->m_suppressedEvents |= SUPPRESS_MAXIMIZE; else if (vars[i] == "activate") - PWINDOW->m_eSuppressedEvents |= SUPPRESS_ACTIVATE; + PWINDOW->m_suppressedEvents |= SUPPRESS_ACTIVATE; else if (vars[i] == "activatefocus") - PWINDOW->m_eSuppressedEvents |= SUPPRESS_ACTIVATE_FOCUSONLY; + PWINDOW->m_suppressedEvents |= SUPPRESS_ACTIVATE_FOCUSONLY; else if (vars[i] == "fullscreenoutput") - PWINDOW->m_eSuppressedEvents |= SUPPRESS_FULLSCREEN_OUTPUT; + PWINDOW->m_suppressedEvents |= SUPPRESS_FULLSCREEN_OUTPUT; else Debug::log(ERR, "Error while parsing suppressevent windowrule: unknown event type {}", vars[i]); } break; } case CWindowRule::RULE_PIN: { - PWINDOW->m_bPinned = true; + PWINDOW->m_pinned = true; break; } case CWindowRule::RULE_FULLSCREEN: { @@ -256,20 +256,20 @@ void Events::listener_mapWindow(void* owner, void* data) { break; } case CWindowRule::RULE_STAYFOCUSED: { - PWINDOW->m_bStayFocused = true; + PWINDOW->m_stayFocused = true; break; } case CWindowRule::RULE_GROUP: { - if (PWINDOW->m_eGroupRules & GROUP_OVERRIDE) + if (PWINDOW->m_groupRules & GROUP_OVERRIDE) continue; // `group` is a shorthand of `group set` - if (trim(r->szRule) == "group") { - PWINDOW->m_eGroupRules |= GROUP_SET; + if (trim(r->m_rule) == "group") { + PWINDOW->m_groupRules |= GROUP_SET; continue; } - CVarList vars(r->szRule, 0, 's'); + CVarList vars(r->m_rule, 0, 's'); std::string vPrev = ""; for (auto const& v : vars) { @@ -277,30 +277,30 @@ void Events::listener_mapWindow(void* owner, void* data) { continue; if (v == "set") { - PWINDOW->m_eGroupRules |= GROUP_SET; + PWINDOW->m_groupRules |= GROUP_SET; } else if (v == "new") { // shorthand for `group barred set` - PWINDOW->m_eGroupRules |= (GROUP_SET | GROUP_BARRED); + PWINDOW->m_groupRules |= (GROUP_SET | GROUP_BARRED); } else if (v == "lock") { - PWINDOW->m_eGroupRules |= GROUP_LOCK; + PWINDOW->m_groupRules |= GROUP_LOCK; } else if (v == "invade") { - PWINDOW->m_eGroupRules |= GROUP_INVADE; + PWINDOW->m_groupRules |= GROUP_INVADE; } else if (v == "barred") { - PWINDOW->m_eGroupRules |= GROUP_BARRED; + PWINDOW->m_groupRules |= GROUP_BARRED; } else if (v == "deny") { - PWINDOW->m_sGroupData.deny = true; + PWINDOW->m_groupData.deny = true; } else if (v == "override") { // Clear existing rules - PWINDOW->m_eGroupRules = GROUP_OVERRIDE; + PWINDOW->m_groupRules = GROUP_OVERRIDE; } else if (v == "unset") { // Clear existing rules and stop processing - PWINDOW->m_eGroupRules = GROUP_OVERRIDE; + PWINDOW->m_groupRules = GROUP_OVERRIDE; break; } else if (v == "always") { if (vPrev == "set" || vPrev == "group") - PWINDOW->m_eGroupRules |= GROUP_SET_ALWAYS; + PWINDOW->m_groupRules |= GROUP_SET_ALWAYS; else if (vPrev == "lock") - PWINDOW->m_eGroupRules |= GROUP_LOCK_ALWAYS; + PWINDOW->m_groupRules |= GROUP_LOCK_ALWAYS; else Debug::log(ERR, "windowrule `group` does not support `{} always`", vPrev); } @@ -309,10 +309,10 @@ void Events::listener_mapWindow(void* owner, void* data) { break; } case CWindowRule::RULE_CONTENT: { - const CVarList VARS(r->szRule, 0, ' '); + const CVarList VARS(r->m_rule, 0, ' '); try { PWINDOW->setContentType(NContentType::fromString(VARS[1])); - } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->szRule, e.what()); } + } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r->m_rule, e.what()); } break; } default: break; @@ -322,8 +322,8 @@ void Events::listener_mapWindow(void* owner, void* data) { } // disallow tiled pinned - if (PWINDOW->m_bPinned && !PWINDOW->m_bIsFloating) - PWINDOW->m_bPinned = false; + if (PWINDOW->m_pinned && !PWINDOW->m_isFloating) + PWINDOW->m_pinned = false; const CVarList WORKSPACEARGS = CVarList(requestedWorkspace, 0, ' '); @@ -341,16 +341,16 @@ void Events::listener_mapWindow(void* owner, void* data) { PWORKSPACE = pWorkspace; - PWINDOW->m_pWorkspace = pWorkspace; - PWINDOW->m_pMonitor = pWorkspace->m_monitor; + PWINDOW->m_workspace = pWorkspace; + PWINDOW->m_monitor = pWorkspace->m_monitor; - if (PWINDOW->m_pMonitor.lock()->activeSpecialWorkspace && !pWorkspace->m_isSpecialWorkspace) + if (PWINDOW->m_monitor.lock()->activeSpecialWorkspace && !pWorkspace->m_isSpecialWorkspace) workspaceSilent = true; if (!workspaceSilent) { if (pWorkspace->m_isSpecialWorkspace) pWorkspace->m_monitor->setSpecialWorkspace(pWorkspace); - else if (PMONITOR->activeWorkspaceID() != REQUESTEDWORKSPACEID && !PWINDOW->m_bNoInitialFocus) + else if (PMONITOR->activeWorkspaceID() != REQUESTEDWORKSPACEID && !PWINDOW->m_noInitialFocus) g_pKeybindManager->m_mDispatchers["workspace"](requestedWorkspaceName); PMONITOR = g_pCompositor->m_lastMonitor.lock(); @@ -361,48 +361,48 @@ void Events::listener_mapWindow(void* owner, void* data) { workspaceSilent = false; } - if (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN_OUTPUT) + if (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN_OUTPUT) requestedFSMonitor = MONITOR_INVALID; else if (requestedFSMonitor != MONITOR_INVALID) { if (const auto PM = g_pCompositor->getMonitorFromID(requestedFSMonitor); PM) - PWINDOW->m_pMonitor = PM; + PWINDOW->m_monitor = PM; - const auto PMONITORFROMID = PWINDOW->m_pMonitor.lock(); + const auto PMONITORFROMID = PWINDOW->m_monitor.lock(); - if (PWINDOW->m_pMonitor != PMONITOR) { + if (PWINDOW->m_monitor != PMONITOR) { g_pKeybindManager->m_mDispatchers["focusmonitor"](std::to_string(PWINDOW->monitorID())); PMONITOR = PMONITORFROMID; } - PWINDOW->m_pWorkspace = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; - PWORKSPACE = PWINDOW->m_pWorkspace; + PWINDOW->m_workspace = PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace; + PWORKSPACE = PWINDOW->m_workspace; Debug::log(LOG, "Requested monitor, applying to {:mw}", PWINDOW); } if (PWORKSPACE->m_defaultFloating) - PWINDOW->m_bIsFloating = true; + PWINDOW->m_isFloating = true; if (PWORKSPACE->m_defaultPseudo) { - PWINDOW->m_bIsPseudotiled = true; - CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(PWINDOW); - PWINDOW->m_vPseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height); + PWINDOW->m_isPseudotiled = true; + CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(PWINDOW); + PWINDOW->m_pseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height); } PWINDOW->updateWindowData(); // Verify window swallowing. Get the swallower before calling onWindowCreated(PWINDOW) because getSwallower() wouldn't get it after if PWINDOW gets auto grouped. - const auto SWALLOWER = PWINDOW->getSwallower(); - PWINDOW->m_pSwallowed = SWALLOWER; - if (PWINDOW->m_pSwallowed) - PWINDOW->m_pSwallowed->m_bCurrentlySwallowed = true; + const auto SWALLOWER = PWINDOW->getSwallower(); + PWINDOW->m_swallowed = SWALLOWER; + if (PWINDOW->m_swallowed) + PWINDOW->m_swallowed->m_currentlySwallowed = true; - if (PWINDOW->m_bIsFloating) { + if (PWINDOW->m_isFloating) { g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW); - PWINDOW->m_bCreatedOverFullscreen = true; + PWINDOW->m_createdOverFullscreen = true; // size and move rules - for (auto const& r : PWINDOW->m_vMatchedRules) { - switch (r->ruleType) { + for (auto const& r : PWINDOW->m_matchedRules) { + switch (r->m_ruleType) { case CWindowRule::RULE_SIZE: { try { auto stringToFloatClamp = [](const std::string& VALUE, const float CURR, const float REL) { @@ -414,29 +414,29 @@ void Events::listener_mapWindow(void* owner, void* data) { return stringToPercentage(VALUE, REL); }; - const auto VALUE = r->szRule.substr(r->szRule.find(' ') + 1); + const auto VALUE = r->m_rule.substr(r->m_rule.find(' ') + 1); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); const auto MAXSIZE = PWINDOW->requestedMaxSize(); const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) : - stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize->goal().x, PMONITOR->vecSize.x); + stringToFloatClamp(SIZEXSTR, PWINDOW->m_realSize->goal().x, PMONITOR->vecSize.x); const float SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, MIN_WINDOW_SIZE, PMONITOR->vecSize.y) : - stringToFloatClamp(SIZEYSTR, PWINDOW->m_vRealSize->goal().y, PMONITOR->vecSize.y); + stringToFloatClamp(SIZEYSTR, PWINDOW->m_realSize->goal().y, PMONITOR->vecSize.y); Debug::log(LOG, "Rule size, applying to {}", PWINDOW); PWINDOW->clampWindowSize(Vector2D{SIZEXSTR.starts_with("<") ? 0 : SIZEX, SIZEYSTR.starts_with("<") ? 0 : SIZEY}, Vector2D{SIZEX, SIZEY}); PWINDOW->setHidden(false); - } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->szRule, r->szValue); } + } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->m_rule, r->m_value); } break; } case CWindowRule::RULE_MOVE: { try { - auto value = r->szRule.substr(r->szRule.find(' ') + 1); + auto value = r->m_rule.substr(r->m_rule.find(' ') + 1); const bool ONSCREEN = value.starts_with("onscreen"); @@ -461,7 +461,7 @@ void Events::listener_mapWindow(void* owner, void* data) { (!POSXRAW.contains('%') ? std::stoi(POSXRAW) : std::stof(POSXRAW.substr(0, POSXRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.x); if (subtractWindow) - posX -= PWINDOW->m_vRealSize->goal().x; + posX -= PWINDOW->m_realSize->goal().x; if (CURSOR) Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!"); @@ -473,7 +473,7 @@ void Events::listener_mapWindow(void* owner, void* data) { posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x; } else { posX = g_pInputManager->getMouseCoordsInternal().x - PMONITOR->vecPosition.x + - (!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stof(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize->goal().x); + (!POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stof(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PWINDOW->m_realSize->goal().x); } } @@ -484,7 +484,7 @@ void Events::listener_mapWindow(void* owner, void* data) { (!POSYRAW.contains('%') ? std::stoi(POSYRAW) : std::stof(POSYRAW.substr(0, POSYRAW.length() - 1)) * 0.01 * PMONITOR->vecSize.y); if (subtractWindow) - posY -= PWINDOW->m_vRealSize->goal().y; + posY -= PWINDOW->m_realSize->goal().y; if (CURSOR) Debug::log(ERR, "Cursor is not compatible with 100%-, ignoring cursor!"); @@ -496,7 +496,7 @@ void Events::listener_mapWindow(void* owner, void* data) { posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y; } else { posY = g_pInputManager->getMouseCoordsInternal().y - PMONITOR->vecPosition.y + - (!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stof(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_vRealSize->goal().y); + (!POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stof(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PWINDOW->m_realSize->goal().y); } } @@ -504,27 +504,27 @@ void Events::listener_mapWindow(void* owner, void* data) { int borderSize = PWINDOW->getRealBorderSize(); posX = std::clamp(posX, (int)(PMONITOR->vecReservedTopLeft.x + borderSize), - (int)(PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PWINDOW->m_vRealSize->goal().x - borderSize)); + (int)(PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PWINDOW->m_realSize->goal().x - borderSize)); posY = std::clamp(posY, (int)(PMONITOR->vecReservedTopLeft.y + borderSize), - (int)(PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PWINDOW->m_vRealSize->goal().y - borderSize)); + (int)(PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PWINDOW->m_realSize->goal().y - borderSize)); } Debug::log(LOG, "Rule move, applying to {}", PWINDOW); - *PWINDOW->m_vRealPosition = Vector2D(posX, posY) + PMONITOR->vecPosition; + *PWINDOW->m_realPosition = Vector2D(posX, posY) + PMONITOR->vecPosition; PWINDOW->setHidden(false); - } catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r->szRule, r->szValue); } + } catch (...) { Debug::log(LOG, "Rule move failed, rule: {} -> {}", r->m_rule, r->m_value); } break; } case CWindowRule::RULE_CENTER: { auto RESERVEDOFFSET = Vector2D(); - const auto ARGS = CVarList(r->szRule, 2, ' '); + const auto ARGS = CVarList(r->m_rule, 2, ' '); if (ARGS[1] == "1") RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f; - *PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize->goal() / 2.f + RESERVEDOFFSET; + *PWINDOW->m_realPosition = PMONITOR->middle() - PWINDOW->m_realSize->goal() / 2.f + RESERVEDOFFSET; break; } @@ -534,7 +534,7 @@ void Events::listener_mapWindow(void* owner, void* data) { // set the pseudo size to the GOAL of our current size // because the windows are animated on RealSize - PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize->goal(); + PWINDOW->m_pseudoSize = PWINDOW->m_realSize->goal(); g_pCompositor->changeWindowZOrder(PWINDOW, true); } else { @@ -542,12 +542,12 @@ void Events::listener_mapWindow(void* owner, void* data) { bool setPseudo = false; - for (auto const& r : PWINDOW->m_vMatchedRules) { - if (r->ruleType != CWindowRule::RULE_SIZE) + for (auto const& r : PWINDOW->m_matchedRules) { + if (r->m_ruleType != CWindowRule::RULE_SIZE) continue; try { - const auto VALUE = r->szRule.substr(r->szRule.find(' ') + 1); + const auto VALUE = r->m_rule.substr(r->m_rule.find(' ') + 1); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); @@ -559,67 +559,67 @@ void Events::listener_mapWindow(void* owner, void* data) { Debug::log(LOG, "Rule size (tiled), applying to {}", PWINDOW); - setPseudo = true; - PWINDOW->m_vPseudoSize = Vector2D(SIZEX, SIZEY); + setPseudo = true; + PWINDOW->m_pseudoSize = Vector2D(SIZEX, SIZEY); PWINDOW->setHidden(false); - } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->szRule, r->szValue); } + } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->m_rule, r->m_value); } } if (!setPseudo) - PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize->goal() - Vector2D(10, 10); + PWINDOW->m_pseudoSize = PWINDOW->m_realSize->goal() - Vector2D(10, 10); } const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_lastWindow.lock(); - if (PWINDOW->m_sWindowData.allowsInput.valueOrDefault()) { // if default value wasn't set to false getPriority() would throw an exception - PWINDOW->m_sWindowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_sWindowData.allowsInput.getPriority()); - PWINDOW->m_bNoInitialFocus = false; - PWINDOW->m_bX11ShouldntFocus = false; + if (PWINDOW->m_windowData.allowsInput.valueOrDefault()) { // if default value wasn't set to false getPriority() would throw an exception + PWINDOW->m_windowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_windowData.allowsInput.getPriority()); + PWINDOW->m_noInitialFocus = false; + PWINDOW->m_X11ShouldntFocus = false; } // check LS focus grab const auto PFORCEFOCUS = g_pCompositor->getForceFocus(); const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); if (PLSFROMFOCUS && PLSFROMFOCUS->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) - PWINDOW->m_bNoInitialFocus = true; + PWINDOW->m_noInitialFocus = true; - if (PWINDOW->m_pWorkspace->m_hasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_bIsFloating) { + if (PWINDOW->m_workspace->m_hasFullscreenWindow && !requestedInternalFSMode.has_value() && !requestedClientFSMode.has_value() && !PWINDOW->m_isFloating) { if (*PNEWTAKESOVERFS == 0) - PWINDOW->m_bNoInitialFocus = true; + PWINDOW->m_noInitialFocus = true; else if (*PNEWTAKESOVERFS == 1) - requestedInternalFSMode = PWINDOW->m_pWorkspace->m_fullscreenMode; + requestedInternalFSMode = PWINDOW->m_workspace->m_fullscreenMode; else if (*PNEWTAKESOVERFS == 2) - g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_pWorkspace->getFullscreenWindow(), FSMODE_NONE); + g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_workspace->getFullscreenWindow(), FSMODE_NONE); } - if (!PWINDOW->m_sWindowData.noFocus.valueOrDefault() && !PWINDOW->m_bNoInitialFocus && - (!PWINDOW->isX11OverrideRedirect() || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) && + if (!PWINDOW->m_windowData.noFocus.valueOrDefault() && !PWINDOW->m_noInitialFocus && + (!PWINDOW->isX11OverrideRedirect() || (PWINDOW->m_isX11 && PWINDOW->m_xwaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) && !g_pInputManager->isConstrained()) { g_pCompositor->focusWindow(PWINDOW); - PWINDOW->m_fActiveInactiveAlpha->setValueAndWarp(*PACTIVEALPHA); - PWINDOW->m_fDimPercent->setValueAndWarp(PWINDOW->m_sWindowData.noDim.valueOrDefault() ? 0.f : *PDIMSTRENGTH); + PWINDOW->m_activeInactiveAlpha->setValueAndWarp(*PACTIVEALPHA); + PWINDOW->m_dimPercent->setValueAndWarp(PWINDOW->m_windowData.noDim.valueOrDefault() ? 0.f : *PDIMSTRENGTH); } else { - PWINDOW->m_fActiveInactiveAlpha->setValueAndWarp(*PINACTIVEALPHA); - PWINDOW->m_fDimPercent->setValueAndWarp(0); + PWINDOW->m_activeInactiveAlpha->setValueAndWarp(*PINACTIVEALPHA); + PWINDOW->m_dimPercent->setValueAndWarp(0); } - if (requestedClientFSMode.has_value() && (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN)) + if (requestedClientFSMode.has_value() && (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN)) requestedClientFSMode = (eFullscreenMode)((uint8_t)requestedClientFSMode.value_or(FSMODE_NONE) & ~(uint8_t)FSMODE_FULLSCREEN); - if (requestedClientFSMode.has_value() && (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)) + if (requestedClientFSMode.has_value() && (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE)) requestedClientFSMode = (eFullscreenMode)((uint8_t)requestedClientFSMode.value_or(FSMODE_NONE) & ~(uint8_t)FSMODE_MAXIMIZED); - if (!PWINDOW->m_bNoInitialFocus && (requestedInternalFSMode.has_value() || requestedClientFSMode.has_value() || requestedFSState.has_value())) { + if (!PWINDOW->m_noInitialFocus && (requestedInternalFSMode.has_value() || requestedClientFSMode.has_value() || requestedFSState.has_value())) { // fix fullscreen on requested (basically do a switcheroo) - if (PWINDOW->m_pWorkspace->m_hasFullscreenWindow) - g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_pWorkspace->getFullscreenWindow(), FSMODE_NONE); + if (PWINDOW->m_workspace->m_hasFullscreenWindow) + g_pCompositor->setWindowFullscreenInternal(PWINDOW->m_workspace->getFullscreenWindow(), FSMODE_NONE); - PWINDOW->m_vRealPosition->warp(); - PWINDOW->m_vRealSize->warp(); + PWINDOW->m_realPosition->warp(); + PWINDOW->m_realSize->warp(); if (requestedFSState.has_value()) { - PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_WINDOW_RULE); + PWINDOW->m_windowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_WINDOW_RULE); g_pCompositor->setWindowFullscreenState(PWINDOW, requestedFSState.value()); - } else if (requestedInternalFSMode.has_value() && requestedClientFSMode.has_value() && !PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault()) + } else if (requestedInternalFSMode.has_value() && requestedClientFSMode.has_value() && !PWINDOW->m_windowData.syncFullscreen.valueOrDefault()) g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = requestedInternalFSMode.value(), .client = requestedClientFSMode.value()}); else if (requestedInternalFSMode.has_value()) g_pCompositor->setWindowFullscreenInternal(PWINDOW, requestedInternalFSMode.value()); @@ -648,12 +648,12 @@ void Events::listener_mapWindow(void* owner, void* data) { g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->monitorID()); } - PWINDOW->m_bFirstMap = false; + PWINDOW->m_firstMap = false; - Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->szName, PWINDOW->m_vRealPosition->goal(), PWINDOW->m_vRealSize->goal()); + Debug::log(LOG, "Map request dispatched, monitor {}, window pos: {:5j}, window size: {:5j}", PMONITOR->szName, PWINDOW->m_realPosition->goal(), PWINDOW->m_realSize->goal()); auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_name; - g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", PWINDOW, workspaceID, PWINDOW->m_szClass, PWINDOW->m_szTitle)}); + g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", PWINDOW, workspaceID, PWINDOW->m_class, PWINDOW->m_title)}); EMIT_HOOK_EVENT("openWindow", PWINDOW); // apply data from default decos. Borders, shadows. @@ -663,65 +663,65 @@ void Events::listener_mapWindow(void* owner, void* data) { // do animations g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false); - PWINDOW->m_fAlpha->setValueAndWarp(0.f); - *PWINDOW->m_fAlpha = 1.f; + PWINDOW->m_alpha->setValueAndWarp(0.f); + *PWINDOW->m_alpha = 1.f; - PWINDOW->m_vRealPosition->setCallbackOnEnd(setVector2DAnimToMove); - PWINDOW->m_vRealSize->setCallbackOnEnd(setVector2DAnimToMove); + PWINDOW->m_realPosition->setCallbackOnEnd(setVector2DAnimToMove); + PWINDOW->m_realSize->setCallbackOnEnd(setVector2DAnimToMove); // recalc the values for this window g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); // avoid this window being visible - if (PWORKSPACE->m_hasFullscreenWindow && !PWINDOW->isFullscreen() && !PWINDOW->m_bIsFloating) - PWINDOW->m_fAlpha->setValueAndWarp(0.f); + if (PWORKSPACE->m_hasFullscreenWindow && !PWINDOW->isFullscreen() && !PWINDOW->m_isFloating) + PWINDOW->m_alpha->setValueAndWarp(0.f); - g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_pWLSurface->resource(), PMONITOR->scale); - g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_pWLSurface->resource(), PMONITOR->transform); + g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->scale); + g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_wlSurface->resource(), PMONITOR->transform); if (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained()) g_pInputManager->sendMotionEventsToFocused(); // fix some xwayland apps that don't behave nicely - PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; + PWINDOW->m_reportedSize = PWINDOW->m_pendingReportedSize; - if (PWINDOW->m_pWorkspace) - PWINDOW->m_pWorkspace->updateWindows(); + if (PWINDOW->m_workspace) + PWINDOW->m_workspace->updateWindows(); if (PMONITOR && PWINDOW->isX11OverrideRedirect()) - PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale; + PWINDOW->m_X11SurfaceScaledBy = PMONITOR->scale; } void Events::listener_unmapWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); Debug::log(LOG, "{:c} unmapped", PWINDOW); static auto PEXITRETAINSFS = CConfigValue("misc:exit_window_retains_fullscreen"); const auto CURRENTWINDOWFSSTATE = PWINDOW->isFullscreen(); - const auto CURRENTFSMODE = PWINDOW->m_sFullscreenState.internal; + const auto CURRENTFSMODE = PWINDOW->m_fullscreenState.internal; - if (!PWINDOW->m_pWLSurface->exists() || !PWINDOW->m_bIsMapped) { + if (!PWINDOW->m_wlSurface->exists() || !PWINDOW->m_isMapped) { Debug::log(WARN, "{} unmapped without being mapped??", PWINDOW); - PWINDOW->m_bFadingOut = false; + PWINDOW->m_fadingOut = false; return; } - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); if (PMONITOR) { - PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition->value() - PMONITOR->vecPosition; - PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize->value(); - PWINDOW->m_eOriginalClosedExtents = PWINDOW->getFullWindowExtents(); + PWINDOW->m_originalClosedPos = PWINDOW->m_realPosition->value() - PMONITOR->vecPosition; + PWINDOW->m_originalClosedSize = PWINDOW->m_realSize->value(); + PWINDOW->m_originalClosedExtents = PWINDOW->getFullWindowExtents(); } g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", std::format("{:x}", PWINDOW)}); EMIT_HOOK_EVENT("closeWindow", PWINDOW); - if (PWINDOW->m_bIsFloating && !PWINDOW->m_bIsX11 && - std::any_of(PWINDOW->m_vMatchedRules.begin(), PWINDOW->m_vMatchedRules.end(), [](const auto& r) { return r->ruleType == CWindowRule::RULE_PERSISTENTSIZE; })) { - Debug::log(LOG, "storing floating size {}x{} for window {}::{} on close", PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealSize->value().y, PWINDOW->m_szClass, - PWINDOW->m_szTitle); - g_pConfigManager->storeFloatingSize(PWINDOW, PWINDOW->m_vRealSize->value()); + if (PWINDOW->m_isFloating && !PWINDOW->m_isX11 && + std::any_of(PWINDOW->m_matchedRules.begin(), PWINDOW->m_matchedRules.end(), [](const auto& r) { return r->m_ruleType == CWindowRule::RULE_PERSISTENTSIZE; })) { + Debug::log(LOG, "storing floating size {}x{} for window {}::{} on close", PWINDOW->m_realSize->value().x, PWINDOW->m_realSize->value().y, PWINDOW->m_class, + PWINDOW->m_title); + g_pConfigManager->storeFloatingSize(PWINDOW, PWINDOW->m_realSize->value()); } PROTO::toplevelExport->onWindowUnmap(PWINDOW); @@ -733,19 +733,19 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pHyprRenderer->makeWindowSnapshot(PWINDOW); // swallowing - if (valid(PWINDOW->m_pSwallowed)) { - if (PWINDOW->m_pSwallowed->m_bCurrentlySwallowed) { - PWINDOW->m_pSwallowed->m_bCurrentlySwallowed = false; - PWINDOW->m_pSwallowed->setHidden(false); + if (valid(PWINDOW->m_swallowed)) { + if (PWINDOW->m_swallowed->m_currentlySwallowed) { + PWINDOW->m_swallowed->m_currentlySwallowed = false; + PWINDOW->m_swallowed->setHidden(false); - if (PWINDOW->m_sGroupData.pNextWindow.lock()) - PWINDOW->m_pSwallowed->m_bGroupSwallowed = true; // flag for the swallowed window to be created into the group where it belongs when auto_group = false. + if (PWINDOW->m_groupData.pNextWindow.lock()) + PWINDOW->m_swallowed->m_groupSwallowed = true; // flag for the swallowed window to be created into the group where it belongs when auto_group = false. - g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_pSwallowed.lock()); + g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_swallowed.lock()); } - PWINDOW->m_pSwallowed->m_bGroupSwallowed = false; - PWINDOW->m_pSwallowed.reset(); + PWINDOW->m_swallowed->m_groupSwallowed = false; + PWINDOW->m_swallowed.reset(); } bool wasLastWindow = false; @@ -762,7 +762,7 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pKeybindManager->changeMouseBindMode(MBIND_INVALID); // remove the fullscreen window status from workspace if we closed it - const auto PWORKSPACE = PWINDOW->m_pWorkspace; + const auto PWORKSPACE = PWINDOW->m_workspace; if (PWORKSPACE->m_hasFullscreenWindow && PWINDOW->isFullscreen()) PWORKSPACE->m_hasFullscreenWindow = false; @@ -772,7 +772,7 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pHyprRenderer->damageWindow(PWINDOW); // do this after onWindowRemoved because otherwise it'll think the window is invalid - PWINDOW->m_bIsMapped = false; + PWINDOW->m_isMapped = false; // refocus on a new window if needed if (wasLastWindow) { @@ -791,7 +791,7 @@ void Events::listener_unmapWindow(void* owner, void* data) { g_pCompositor->setWindowFullscreenInternal(PWINDOWCANDIDATE, CURRENTFSMODE); } - if (!PWINDOWCANDIDATE && PWINDOW->m_pWorkspace && PWINDOW->m_pWorkspace->getWindows() == 0) + if (!PWINDOWCANDIDATE && PWINDOW->m_workspace && PWINDOW->m_workspace->getWindows() == 0) g_pInputManager->refocus(); g_pInputManager->sendMotionEventsToFocused(); @@ -806,57 +806,57 @@ void Events::listener_unmapWindow(void* owner, void* data) { Debug::log(LOG, "Unmapped was not focused, ignoring a refocus."); } - PWINDOW->m_bFadingOut = true; + PWINDOW->m_fadingOut = true; g_pCompositor->addToFadingOutSafe(PWINDOW); - if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in. - *PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition->value() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it + if (!PWINDOW->m_X11DoesntWantBorders) // don't animate out if they weren't animated in. + *PWINDOW->m_realPosition = PWINDOW->m_realPosition->value() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it // anims g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true); - *PWINDOW->m_fAlpha = 0.f; + *PWINDOW->m_alpha = 0.f; // recheck idle inhibitors g_pInputManager->recheckIdleInhibitorStatus(); // force report all sizes (QT sometimes has an issue with this) - if (PWINDOW->m_pWorkspace) - PWINDOW->m_pWorkspace->forceReportSizesToWindows(); + if (PWINDOW->m_workspace) + PWINDOW->m_workspace->forceReportSizesToWindows(); // update lastwindow after focus PWINDOW->onUnmap(); } void Events::listener_commitWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); - if (!PWINDOW->m_bIsX11 && PWINDOW->m_pXDGSurface->initialCommit) { + if (!PWINDOW->m_isX11 && PWINDOW->m_xdgSurface->initialCommit) { Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(PWINDOW); Debug::log(LOG, "Layout predicts size {} for {}", predSize, PWINDOW); - PWINDOW->m_pXDGSurface->toplevel->setSize(predSize); + PWINDOW->m_xdgSurface->toplevel->setSize(predSize); return; } - if (!PWINDOW->m_bIsMapped || PWINDOW->isHidden()) + if (!PWINDOW->m_isMapped || PWINDOW->isHidden()) return; - PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; // apply pending size. We pinged, the window ponged. + PWINDOW->m_reportedSize = PWINDOW->m_pendingReportedSize; // apply pending size. We pinged, the window ponged. - if (!PWINDOW->m_bIsX11 && !PWINDOW->isFullscreen() && PWINDOW->m_bIsFloating) { - const auto MINSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMinSize(); - const auto MAXSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMaxSize(); + if (!PWINDOW->m_isX11 && !PWINDOW->isFullscreen() && PWINDOW->m_isFloating) { + const auto MINSIZE = PWINDOW->m_xdgSurface->toplevel->layoutMinSize(); + const auto MAXSIZE = PWINDOW->m_xdgSurface->toplevel->layoutMaxSize(); PWINDOW->clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional{MAXSIZE} : std::nullopt); g_pHyprRenderer->damageWindow(PWINDOW); } - if (!PWINDOW->m_pWorkspace->m_visible) + if (!PWINDOW->m_workspace->m_visible) return; - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); if (PMONITOR) PMONITOR->debugLastPresentation(g_pSeatManager->isPointerFrameCommit ? "listener_commitWindow skip" : "listener_commitWindow"); @@ -865,8 +865,8 @@ void Events::listener_commitWindow(void* owner, void* data) { g_pSeatManager->isPointerFrameSkipped = false; g_pSeatManager->isPointerFrameCommit = false; } else - g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface->resource(), PWINDOW->m_vRealPosition->goal().x, PWINDOW->m_vRealPosition->goal().y, - PWINDOW->m_bIsX11 ? 1.0 / PWINDOW->m_fX11SurfaceScaledBy : 1.0); + g_pHyprRenderer->damageSurface(PWINDOW->m_wlSurface->resource(), PWINDOW->m_realPosition->goal().x, PWINDOW->m_realPosition->goal().y, + PWINDOW->m_isX11 ? 1.0 / PWINDOW->m_X11SurfaceScaledBy : 1.0); if (g_pSeatManager->isPointerFrameSkipped) { g_pPointerManager->sendStoredMovement(); @@ -874,14 +874,14 @@ void Events::listener_commitWindow(void* owner, void* data) { g_pSeatManager->isPointerFrameCommit = true; } - if (!PWINDOW->m_bIsX11) { - PWINDOW->m_pSubsurfaceHead->recheckDamageForSubsurfaces(); - PWINDOW->m_pPopupHead->recheckTree(); + if (!PWINDOW->m_isX11) { + PWINDOW->m_subsurfaceHead->recheckDamageForSubsurfaces(); + PWINDOW->m_popupHead->recheckTree(); } // tearing: if solitary, redraw it. This still might be a single surface window - if (PMONITOR && PMONITOR->solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->tearingState.canTear && PWINDOW->m_pWLSurface->resource()->current.texture) { - CRegion damageBox{PWINDOW->m_pWLSurface->resource()->current.accumulateBufferDamage()}; + if (PMONITOR && PMONITOR->solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->tearingState.canTear && PWINDOW->m_wlSurface->resource()->current.texture) { + CRegion damageBox{PWINDOW->m_wlSurface->resource()->current.accumulateBufferDamage()}; if (!damageBox.empty()) { if (PMONITOR->tearingState.busy) { @@ -895,7 +895,7 @@ void Events::listener_commitWindow(void* owner, void* data) { } void Events::listener_destroyWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW); @@ -904,29 +904,29 @@ void Events::listener_destroyWindow(void* owner, void* data) { g_pCompositor->m_lastFocus.reset(); } - PWINDOW->m_pWLSurface->unassign(); + PWINDOW->m_wlSurface->unassign(); - PWINDOW->listeners = {}; + PWINDOW->m_listeners = {}; g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); - PWINDOW->m_bReadyToDelete = true; + PWINDOW->m_readyToDelete = true; - PWINDOW->m_pXDGSurface.reset(); + PWINDOW->m_xdgSurface.reset(); - if (!PWINDOW->m_bFadingOut) { + if (!PWINDOW->m_fadingOut) { Debug::log(LOG, "Unmapped {} removed instantly", PWINDOW); g_pCompositor->removeWindowFromVectorSafe(PWINDOW); // most likely X11 unmanaged or sumn } - PWINDOW->listeners.unmap.reset(); - PWINDOW->listeners.destroy.reset(); - PWINDOW->listeners.map.reset(); - PWINDOW->listeners.commit.reset(); + PWINDOW->m_listeners.unmap.reset(); + PWINDOW->m_listeners.destroy.reset(); + PWINDOW->m_listeners.map.reset(); + PWINDOW->m_listeners.commit.reset(); } void Events::listener_activateX11(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); Debug::log(LOG, "X11 Activate request for window {}", PWINDOW); @@ -937,34 +937,34 @@ void Events::listener_activateX11(void* owner, void* data) { if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->getPID() != PWINDOW->getPID()) return; - if (!PWINDOW->m_pXWaylandSurface->wantsFocus()) + if (!PWINDOW->m_xwaylandSurface->wantsFocus()) return; g_pCompositor->focusWindow(PWINDOW); return; } - if (PWINDOW == g_pCompositor->m_lastWindow.lock() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE)) + if (PWINDOW == g_pCompositor->m_lastWindow.lock() || (PWINDOW->m_suppressedEvents & SUPPRESS_ACTIVATE)) return; PWINDOW->activate(); } void Events::listener_unmanagedSetGeometry(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_self.lock(); - if (!PWINDOW->m_bIsMapped || !PWINDOW->m_pXWaylandSurface || !PWINDOW->m_pXWaylandSurface->overrideRedirect) + if (!PWINDOW->m_isMapped || !PWINDOW->m_xwaylandSurface || !PWINDOW->m_xwaylandSurface->overrideRedirect) return; - const auto POS = PWINDOW->m_vRealPosition->goal(); - const auto SIZ = PWINDOW->m_vRealSize->goal(); + const auto POS = PWINDOW->m_realPosition->goal(); + const auto SIZ = PWINDOW->m_realSize->goal(); - if (PWINDOW->m_pXWaylandSurface->geometry.size() > Vector2D{1, 1}) + if (PWINDOW->m_xwaylandSurface->geometry.size() > Vector2D{1, 1}) PWINDOW->setHidden(false); else PWINDOW->setHidden(true); - if (PWINDOW->isFullscreen() || !PWINDOW->m_bIsFloating) { + if (PWINDOW->isFullscreen() || !PWINDOW->m_isFloating) { PWINDOW->sendWindowSize(true); g_pHyprRenderer->damageWindow(PWINDOW); return; @@ -972,34 +972,34 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) { static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); - const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords(PWINDOW->m_pXWaylandSurface->geometry.pos()); + const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords(PWINDOW->m_xwaylandSurface->geometry.pos()); - if (abs(std::floor(POS.x) - LOGICALPOS.x) > 2 || abs(std::floor(POS.y) - LOGICALPOS.y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_pXWaylandSurface->geometry.width) > 2 || - abs(std::floor(SIZ.y) - PWINDOW->m_pXWaylandSurface->geometry.height) > 2) { - Debug::log(LOG, "Unmanaged window {} requests geometry update to {:j} {:j}", PWINDOW, LOGICALPOS, PWINDOW->m_pXWaylandSurface->geometry.size()); + if (abs(std::floor(POS.x) - LOGICALPOS.x) > 2 || abs(std::floor(POS.y) - LOGICALPOS.y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_xwaylandSurface->geometry.width) > 2 || + abs(std::floor(SIZ.y) - PWINDOW->m_xwaylandSurface->geometry.height) > 2) { + Debug::log(LOG, "Unmanaged window {} requests geometry update to {:j} {:j}", PWINDOW, LOGICALPOS, PWINDOW->m_xwaylandSurface->geometry.size()); g_pHyprRenderer->damageWindow(PWINDOW); - PWINDOW->m_vRealPosition->setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y)); + PWINDOW->m_realPosition->setValueAndWarp(Vector2D(LOGICALPOS.x, LOGICALPOS.y)); - if (abs(std::floor(SIZ.x) - PWINDOW->m_pXWaylandSurface->geometry.w) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_pXWaylandSurface->geometry.h) > 2) - PWINDOW->m_vRealSize->setValueAndWarp(PWINDOW->m_pXWaylandSurface->geometry.size()); + if (abs(std::floor(SIZ.x) - PWINDOW->m_xwaylandSurface->geometry.w) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_xwaylandSurface->geometry.h) > 2) + PWINDOW->m_realSize->setValueAndWarp(PWINDOW->m_xwaylandSurface->geometry.size()); if (*PXWLFORCESCALEZERO) { - if (const auto PMONITOR = PWINDOW->m_pMonitor.lock(); PMONITOR) { - PWINDOW->m_vRealSize->setValueAndWarp(PWINDOW->m_vRealSize->goal() / PMONITOR->scale); + if (const auto PMONITOR = PWINDOW->m_monitor.lock(); PMONITOR) { + PWINDOW->m_realSize->setValueAndWarp(PWINDOW->m_realSize->goal() / PMONITOR->scale); } } - PWINDOW->m_vPosition = PWINDOW->m_vRealPosition->goal(); - PWINDOW->m_vSize = PWINDOW->m_vRealSize->goal(); + PWINDOW->m_position = PWINDOW->m_realPosition->goal(); + PWINDOW->m_size = PWINDOW->m_realSize->goal(); - PWINDOW->m_pWorkspace = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition->value() + PWINDOW->m_vRealSize->value() / 2.f)->activeWorkspace; + PWINDOW->m_workspace = g_pCompositor->getMonitorFromVector(PWINDOW->m_realPosition->value() + PWINDOW->m_realSize->value() / 2.f)->activeWorkspace; g_pCompositor->changeWindowZOrder(PWINDOW, true); PWINDOW->updateWindowDecos(); g_pHyprRenderer->damageWindow(PWINDOW); - PWINDOW->m_vReportedPosition = PWINDOW->m_vRealPosition->goal(); - PWINDOW->m_vPendingReportedSize = PWINDOW->m_vRealSize->goal(); + PWINDOW->m_reportedPosition = PWINDOW->m_realPosition->goal(); + PWINDOW->m_pendingReportedSize = PWINDOW->m_realSize->goal(); } } diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index d5c4e2d1..cd394c19 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -1127,12 +1127,12 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo // move pinned windows for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == POLDWORKSPACE && w->m_bPinned) + if (w->m_workspace == POLDWORKSPACE && w->m_pinned) w->moveToWorkspace(pWorkspace); } if (!noFocus && !g_pCompositor->m_lastMonitor->activeSpecialWorkspace && - !(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) { + !(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pinned && g_pCompositor->m_lastWindow->m_monitor == self)) { static auto PFOLLOWMOUSE = CConfigValue("input:follow_mouse"); auto pWindow = pWorkspace->m_hasFullscreenWindow ? pWorkspace->getFullscreenWindow() : pWorkspace->getLastFocusedWindow(); @@ -1194,7 +1194,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID); - if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) { + if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pinned && g_pCompositor->m_lastWindow->m_monitor == self)) { if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST) g_pCompositor->focusWindow(PLAST); else @@ -1238,32 +1238,32 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { pWorkspace->startAnim(true, true); for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == pWorkspace) { - w->m_pMonitor = self; + if (w->m_workspace == pWorkspace) { + w->m_monitor = self; w->updateSurfaceScaleTransformDetails(); w->setAnimationsToMove(); const auto MIDDLE = w->middle(); - if (w->m_bIsFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && !w->isX11OverrideRedirect()) { + if (w->m_isFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && !w->isX11OverrideRedirect()) { // if it's floating and the middle isnt on the current mon, move it to the center const auto PMONFROMMIDDLE = g_pCompositor->getMonitorFromVector(MIDDLE); - Vector2D pos = w->m_vRealPosition->goal(); + Vector2D pos = w->m_realPosition->goal(); if (!VECINRECT(MIDDLE, PMONFROMMIDDLE->vecPosition.x, PMONFROMMIDDLE->vecPosition.y, PMONFROMMIDDLE->vecPosition.x + PMONFROMMIDDLE->vecSize.x, PMONFROMMIDDLE->vecPosition.y + PMONFROMMIDDLE->vecSize.y)) { // not on any monitor, center - pos = middle() / 2.f - w->m_vRealSize->goal() / 2.f; + pos = middle() / 2.f - w->m_realSize->goal() / 2.f; } else pos = pos - PMONFROMMIDDLE->vecPosition + vecPosition; - *w->m_vRealPosition = pos; - w->m_vPosition = pos; + *w->m_realPosition = pos; + w->m_position = pos; } } } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID); - if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bPinned && g_pCompositor->m_lastWindow->m_pMonitor == self)) { + if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pinned && g_pCompositor->m_lastWindow->m_monitor == self)) { if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST) g_pCompositor->focusWindow(PLAST); else @@ -1447,7 +1447,7 @@ bool CMonitor::attemptDirectScanout() { if (lastScanout.expired()) { lastScanout = PCANDIDATE; - Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle); + Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_title); } scanoutNeedsCursorUpdate = false; diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 0c9f0803..5ebd14ce 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -147,13 +147,13 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for CBox nodeBox = pNode->box; nodeBox.round(); - PWINDOW->m_vSize = nodeBox.size(); - PWINDOW->m_vPosition = nodeBox.pos(); + PWINDOW->m_size = nodeBox.size(); + PWINDOW->m_position = nodeBox.pos(); PWINDOW->updateWindowDecos(); - auto calcPos = PWINDOW->m_vPosition; - auto calcSize = PWINDOW->m_vSize; + 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)); @@ -162,27 +162,27 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for calcPos = calcPos + OFFSETTOPLEFT; calcSize = calcSize - OFFSETTOPLEFT - OFFSETBOTTOMRIGHT; - if (PWINDOW->m_bIsPseudotiled) { + if (PWINDOW->m_isPseudotiled) { // Calculate pseudo float scale = 1; // adjust if doesnt fit - if (PWINDOW->m_vPseudoSize.x > calcSize.x || PWINDOW->m_vPseudoSize.y > calcSize.y) { - if (PWINDOW->m_vPseudoSize.x > calcSize.x) { - scale = calcSize.x / PWINDOW->m_vPseudoSize.x; + if (PWINDOW->m_pseudoSize.x > calcSize.x || PWINDOW->m_pseudoSize.y > calcSize.y) { + if (PWINDOW->m_pseudoSize.x > calcSize.x) { + scale = calcSize.x / PWINDOW->m_pseudoSize.x; } - if (PWINDOW->m_vPseudoSize.y * scale > calcSize.y) { - scale = calcSize.y / PWINDOW->m_vPseudoSize.y; + if (PWINDOW->m_pseudoSize.y * scale > calcSize.y) { + scale = calcSize.y / PWINDOW->m_pseudoSize.y; } - auto DELTA = calcSize - PWINDOW->m_vPseudoSize * scale; - calcSize = PWINDOW->m_vPseudoSize * scale; + auto DELTA = calcSize - PWINDOW->m_pseudoSize * scale; + calcSize = PWINDOW->m_pseudoSize * scale; calcPos = calcPos + DELTA / 2.f; // center } else { - auto DELTA = calcSize - PWINDOW->m_vPseudoSize; + auto DELTA = calcSize - PWINDOW->m_pseudoSize; calcPos = calcPos + DELTA / 2.f; // center - calcSize = PWINDOW->m_vPseudoSize; + calcSize = PWINDOW->m_pseudoSize; } } @@ -197,21 +197,21 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealPosition = wb.pos(); - *PWINDOW->m_vRealSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); } else { CBox wb = {calcPos, calcSize}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealSize = wb.size(); - *PWINDOW->m_vRealPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); } if (force) { g_pHyprRenderer->damageWindow(PWINDOW); - PWINDOW->m_vRealPosition->warp(); - PWINDOW->m_vRealSize->warp(); + PWINDOW->m_realPosition->warp(); + PWINDOW->m_realSize->warp(); g_pHyprRenderer->damageWindow(PWINDOW); } @@ -220,13 +220,13 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for } void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) { - if (pWindow->m_bIsFloating) + if (pWindow->m_isFloating) return; m_lDwindleNodesData.emplace_back(); const auto PNODE = &m_lDwindleNodesData.back(); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); static auto PUSEACTIVE = CConfigValue("dwindle:use_active_for_splits"); static auto PDEFAULTSPLIT = CConfigValue("dwindle:default_split_ratio"); @@ -253,8 +253,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS); } else if (*PUSEACTIVE) { - if (g_pCompositor->m_lastWindow.lock() && !g_pCompositor->m_lastWindow->m_bIsFloating && g_pCompositor->m_lastWindow.lock() != pWindow && - g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace && g_pCompositor->m_lastWindow->m_bIsMapped) { + if (g_pCompositor->m_lastWindow.lock() && !g_pCompositor->m_lastWindow->m_isFloating && g_pCompositor->m_lastWindow.lock() != pWindow && + g_pCompositor->m_lastWindow->m_workspace == pWindow->m_workspace && g_pCompositor->m_lastWindow->m_isMapped) { OPENINGON = getNodeFromWindow(g_pCompositor->m_lastWindow.lock()); } else { OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS)); @@ -277,7 +277,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir const auto PREDSIZEMAX = OPENINGON ? Vector2D(OPENINGON->box.w, OPENINGON->box.h) : PMONITOR->vecSize; if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PREDSIZEMAX.x || MAXSIZE.y < PREDSIZEMAX.y) { // we can't continue. make it floating. - pWindow->m_bIsFloating = true; + pWindow->m_isFloating = true; m_lDwindleNodesData.remove(*PNODE); g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(pWindow); return; @@ -379,7 +379,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir NEWPARENT->children[1] = OPENINGON; } } - } else if (*PFORCESPLIT == 0 || !pWindow->m_bFirstMap) { + } else if (*PFORCESPLIT == 0 || !pWindow->m_firstMap) { if ((SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->box.x, NEWPARENT->box.y / *PWIDTHMULTIPLIER, NEWPARENT->box.x + NEWPARENT->box.w / 2.f, NEWPARENT->box.y + NEWPARENT->box.h)) || (!SIDEBYSIDE && @@ -509,15 +509,15 @@ void CHyprDwindleLayout::calculateWorkspace(const PHLWORKSPACE& pWorkspace) { const auto PFULLWINDOW = pWorkspace->getFullscreenWindow(); if (pWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN) { - *PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition; - *PFULLWINDOW->m_vRealSize = PMONITOR->vecSize; + *PFULLWINDOW->m_realPosition = PMONITOR->vecPosition; + *PFULLWINDOW->m_realSize = PMONITOR->vecSize; } else if (pWorkspace->m_fullscreenMode == FSMODE_MAXIMIZED) { SDwindleNodeData fakeNode; - fakeNode.pWindow = PFULLWINDOW; - fakeNode.box = {PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight}; - fakeNode.workspaceID = pWorkspace->m_id; - PFULLWINDOW->m_vPosition = fakeNode.box.pos(); - PFULLWINDOW->m_vSize = fakeNode.box.size(); + fakeNode.pWindow = PFULLWINDOW; + fakeNode.box = {PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight}; + fakeNode.workspaceID = pWorkspace->m_id; + PFULLWINDOW->m_position = fakeNode.box.pos(); + PFULLWINDOW->m_size = fakeNode.box.size(); fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -555,9 +555,9 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn const auto PNODE = getNodeFromWindow(PWINDOW); if (!PNODE) { - *PWINDOW->m_vRealSize = - (PWINDOW->m_vRealSize->goal() + pixResize) - .clamp(PWINDOW->m_sWindowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_sWindowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); + *PWINDOW->m_realSize = + (PWINDOW->m_realSize->goal() + pixResize) + .clamp(PWINDOW->m_windowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_windowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); PWINDOW->updateWindowDecos(); return; } @@ -566,17 +566,17 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn static auto PSMARTRESIZING = CConfigValue("dwindle:smart_resizing"); // get some data about our window - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); - const bool DISPLAYLEFT = STICKS(PWINDOW->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); - const bool DISPLAYRIGHT = STICKS(PWINDOW->m_vPosition.x + PWINDOW->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); - const bool DISPLAYTOP = STICKS(PWINDOW->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); - const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); + const auto PMONITOR = PWINDOW->m_monitor.lock(); + const bool DISPLAYLEFT = STICKS(PWINDOW->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); + const bool DISPLAYRIGHT = STICKS(PWINDOW->m_position.x + PWINDOW->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); + const bool DISPLAYTOP = STICKS(PWINDOW->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); + const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_position.y + PWINDOW->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); - if (PWINDOW->m_bIsPseudotiled) { + if (PWINDOW->m_isPseudotiled) { if (!m_PseudoDragFlags.started) { m_PseudoDragFlags.started = true; - const auto pseudoSize = PWINDOW->m_vRealSize->goal(); + const auto pseudoSize = PWINDOW->m_realSize->goal(); const auto mouseOffset = g_pInputManager->getMouseCoordsInternal() - (PNODE->box.pos() + ((PNODE->box.size() / 2) - (pseudoSize / 2))); if (mouseOffset.x > 0 && mouseOffset.x < pseudoSize.x && mouseOffset.y > 0 && mouseOffset.y < pseudoSize.y) { @@ -584,7 +584,7 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn m_PseudoDragFlags.xExtent = mouseOffset.x > pseudoSize.x / 2; m_PseudoDragFlags.yExtent = mouseOffset.y > pseudoSize.y / 2; - PWINDOW->m_vPseudoSize = pseudoSize; + PWINDOW->m_pseudoSize = pseudoSize; } else { m_PseudoDragFlags.pseudo = false; } @@ -592,20 +592,20 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn if (m_PseudoDragFlags.pseudo) { if (m_PseudoDragFlags.xExtent) - PWINDOW->m_vPseudoSize.x += pixResize.x * 2; + PWINDOW->m_pseudoSize.x += pixResize.x * 2; else - PWINDOW->m_vPseudoSize.x -= pixResize.x * 2; + PWINDOW->m_pseudoSize.x -= pixResize.x * 2; if (m_PseudoDragFlags.yExtent) - PWINDOW->m_vPseudoSize.y += pixResize.y * 2; + PWINDOW->m_pseudoSize.y += pixResize.y * 2; else - PWINDOW->m_vPseudoSize.y -= pixResize.y * 2; + PWINDOW->m_pseudoSize.y -= pixResize.y * 2; CBox wbox = PNODE->box; wbox.round(); - PWINDOW->m_vPseudoSize = {std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, wbox.h)}; + PWINDOW->m_pseudoSize = {std::clamp(PWINDOW->m_pseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_pseudoSize.y, 30.0, wbox.h)}; - PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize; + PWINDOW->m_lastFloatingSize = PWINDOW->m_pseudoSize; PNODE->recalcSizePosRecursive(*PANIMATE == 0); return; @@ -739,15 +739,15 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn } void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFullscreenMode CURRENT_EFFECTIVE_MODE, const eFullscreenMode EFFECTIVE_MODE) { - const auto PMONITOR = pWindow->m_pMonitor.lock(); - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PMONITOR = pWindow->m_monitor.lock(); + const auto PWORKSPACE = pWindow->m_workspace; // save position and size if floating - if (pWindow->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { - pWindow->m_vLastFloatingSize = pWindow->m_vRealSize->goal(); - pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vSize = pWindow->m_vRealSize->goal(); + if (pWindow->m_isFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { + pWindow->m_lastFloatingSize = pWindow->m_realSize->goal(); + pWindow->m_lastFloatingPosition = pWindow->m_realPosition->goal(); + pWindow->m_position = pWindow->m_realPosition->goal(); + pWindow->m_size = pWindow->m_realSize->goal(); } if (EFFECTIVE_MODE == FSMODE_NONE) { @@ -757,8 +757,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu applyNodeDataToWindow(PNODE); else { // get back its' dimensions from position and size - *pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; - *pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; + *pWindow->m_realPosition = pWindow->m_lastFloatingPosition; + *pWindow->m_realSize = pWindow->m_lastFloatingSize; pWindow->unsetWindowData(PRIORITY_LAYOUT); pWindow->updateWindowData(); @@ -766,8 +766,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu } else { // apply new pos and size being monitors' box if (EFFECTIVE_MODE == FSMODE_FULLSCREEN) { - *pWindow->m_vRealPosition = PMONITOR->vecPosition; - *pWindow->m_vRealSize = PMONITOR->vecSize; + *pWindow->m_realPosition = PMONITOR->vecPosition; + *pWindow->m_realSize = PMONITOR->vecSize; } else { // This is a massive hack. // We make a fake "only" node and apply @@ -777,8 +777,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFu fakeNode.pWindow = pWindow; fakeNode.box = {PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight}; fakeNode.workspaceID = pWindow->workspaceID(); - pWindow->m_vPosition = fakeNode.box.pos(); - pWindow->m_vSize = fakeNode.box.size(); + pWindow->m_position = fakeNode.box.pos(); + pWindow->m_size = fakeNode.box.size(); fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -816,12 +816,12 @@ void CHyprDwindleLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, const auto originalWorkspaceID = pWindow->workspaceID(); const Vector2D originalPos = pWindow->middle(); - if (!PNODE || !pWindow->m_pMonitor) + if (!PNODE || !pWindow->m_monitor) return; Vector2D focalPoint; - const auto WINDOWIDEALBB = pWindow->isFullscreen() ? CBox{pWindow->m_pMonitor->vecPosition, pWindow->m_pMonitor->vecSize} : pWindow->getWindowIdealBoundingBoxIgnoreReserved(); + const auto WINDOWIDEALBB = pWindow->isFullscreen() ? CBox{pWindow->m_monitor->vecPosition, pWindow->m_monitor->vecSize} : pWindow->getWindowIdealBoundingBoxIgnoreReserved(); switch (dir[0]) { case 't': @@ -841,17 +841,17 @@ void CHyprDwindleLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, const auto PMONITORFOCAL = g_pCompositor->getMonitorFromVector(focalPoint); - if (PMONITORFOCAL != pWindow->m_pMonitor) { + if (PMONITORFOCAL != pWindow->m_monitor) { pWindow->moveToWorkspace(PMONITORFOCAL->activeWorkspace); - pWindow->m_pMonitor = PMONITORFOCAL; + pWindow->m_monitor = PMONITORFOCAL; } pWindow->updateGroupOutputs(); - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); + if (!pWindow->m_groupData.pNextWindow.expired()) { + PHLWINDOW next = pWindow->m_groupData.pNextWindow.lock(); while (next != pWindow) { next->updateToplevel(); - next = next->m_sGroupData.pNextWindow.lock(); + next = next->m_groupData.pNextWindow.lock(); } } @@ -876,8 +876,8 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { if (!PNODE2 || !PNODE) return; - const eFullscreenMode MODE1 = pWindow->m_sFullscreenState.internal; - const eFullscreenMode MODE2 = pWindow2->m_sFullscreenState.internal; + const eFullscreenMode MODE1 = pWindow->m_fullscreenState.internal; + const eFullscreenMode MODE2 = pWindow2->m_fullscreenState.internal; g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE); g_pCompositor->setWindowFullscreenInternal(pWindow2, FSMODE_NONE); @@ -890,8 +890,8 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { PNODE->pWindow = pWindow2; if (PNODE->workspaceID != PNODE2->workspaceID) { - std::swap(pWindow2->m_pMonitor, pWindow->m_pMonitor); - std::swap(pWindow2->m_pWorkspace, pWindow->m_pWorkspace); + std::swap(pWindow2->m_monitor, pWindow->m_monitor); + std::swap(pWindow2->m_workspace, pWindow->m_workspace); } pWindow->setAnimationsToMove(); @@ -904,15 +904,15 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive(); if (ACTIVE1) { - ACTIVE1->box = PNODE->box; - ACTIVE1->pWindow->m_vPosition = ACTIVE1->box.pos(); - ACTIVE1->pWindow->m_vSize = ACTIVE1->box.size(); + ACTIVE1->box = PNODE->box; + ACTIVE1->pWindow->m_position = ACTIVE1->box.pos(); + ACTIVE1->pWindow->m_size = ACTIVE1->box.size(); } if (ACTIVE2) { - ACTIVE2->box = PNODE2->box; - ACTIVE2->pWindow->m_vPosition = ACTIVE2->box.pos(); - ACTIVE2->pWindow->m_vSize = ACTIVE2->box.size(); + ACTIVE2->box = PNODE2->box; + ACTIVE2->pWindow->m_position = ACTIVE2->box.pos(); + ACTIVE2->pWindow->m_size = ACTIVE2->box.size(); } g_pHyprRenderer->damageWindow(pWindow); @@ -1047,7 +1047,7 @@ void CHyprDwindleLayout::moveToRoot(PHLWINDOW pWindow, bool stable) { std::swap(pRoot->children[0], pRoot->children[1]); // if the workspace is visible, recalculate layout - if (pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible()) + if (pWindow->m_workspace && pWindow->m_workspace->isVisible()) pRoot->recalcSizePosRecursive(); } @@ -1068,7 +1068,7 @@ std::string CHyprDwindleLayout::getLayoutName() { void CHyprDwindleLayout::onEnable() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden()) + if (w->m_isFloating || !w->m_isMapped || w->isHidden()) continue; onWindowCreatedTiling(w); diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index cf036131..ac04157b 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -18,26 +18,26 @@ void IHyprLayout::onWindowCreated(PHLWINDOW pWindow, eDirection direction) { CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(pWindow); const bool HASPERSISTENTSIZE = - std::any_of(pWindow->m_vMatchedRules.begin(), pWindow->m_vMatchedRules.end(), [](const auto& rule) { return rule->ruleType == CWindowRule::RULE_PERSISTENTSIZE; }); + std::any_of(pWindow->m_matchedRules.begin(), pWindow->m_matchedRules.end(), [](const auto& rule) { return rule->m_ruleType == CWindowRule::RULE_PERSISTENTSIZE; }); const auto STOREDSIZE = HASPERSISTENTSIZE ? g_pConfigManager->getStoredFloatingSize(pWindow) : std::nullopt; if (STOREDSIZE.has_value()) { - Debug::log(LOG, "using stored size {}x{} for new window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_szClass, pWindow->m_szTitle); - pWindow->m_vLastFloatingSize = STOREDSIZE.value(); + Debug::log(LOG, "using stored size {}x{} for new window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title); + pWindow->m_lastFloatingSize = STOREDSIZE.value(); } else if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) { - const auto PMONITOR = pWindow->m_pMonitor.lock(); - pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f; + const auto PMONITOR = pWindow->m_monitor.lock(); + pWindow->m_lastFloatingSize = PMONITOR->vecSize / 2.f; } else - pWindow->m_vLastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height); + pWindow->m_lastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height); - pWindow->m_vPseudoSize = pWindow->m_vLastFloatingSize; + pWindow->m_pseudoSize = pWindow->m_lastFloatingSize; bool autoGrouped = IHyprLayout::onWindowCreatedAutoGroup(pWindow); if (autoGrouped) return; - if (pWindow->m_bIsFloating) + if (pWindow->m_isFloating) onWindowCreatedFloating(pWindow); else onWindowCreatedTiling(pWindow, direction); @@ -50,24 +50,24 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) { if (pWindow->isFullscreen()) g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE); - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow) - pWindow->m_sGroupData.pNextWindow.reset(); + if (!pWindow->m_groupData.pNextWindow.expired()) { + if (pWindow->m_groupData.pNextWindow.lock() == pWindow) + pWindow->m_groupData.pNextWindow.reset(); else { // find last window and update PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious(); const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow; if (WINDOWISVISIBLE) - PWINDOWPREV->setGroupCurrent(pWindow->m_sGroupData.head ? pWindow->m_sGroupData.pNextWindow.lock() : PWINDOWPREV); + PWINDOWPREV->setGroupCurrent(pWindow->m_groupData.head ? pWindow->m_groupData.pNextWindow.lock() : PWINDOWPREV); - PWINDOWPREV->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow; + PWINDOWPREV->m_groupData.pNextWindow = pWindow->m_groupData.pNextWindow; - pWindow->m_sGroupData.pNextWindow.reset(); + pWindow->m_groupData.pNextWindow.reset(); - if (pWindow->m_sGroupData.head) { - std::swap(PWINDOWPREV->m_sGroupData.pNextWindow->m_sGroupData.head, pWindow->m_sGroupData.head); - std::swap(PWINDOWPREV->m_sGroupData.pNextWindow->m_sGroupData.locked, pWindow->m_sGroupData.locked); + if (pWindow->m_groupData.head) { + std::swap(PWINDOWPREV->m_groupData.pNextWindow->m_groupData.head, pWindow->m_groupData.head); + std::swap(PWINDOWPREV->m_groupData.pNextWindow->m_groupData.locked, pWindow->m_groupData.locked); } if (pWindow == m_pLastTiledWindow) @@ -83,7 +83,7 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) { } } - if (pWindow->m_bIsFloating) { + if (pWindow->m_isFloating) { onWindowRemovedFloating(pWindow); } else { onWindowRemovedTiling(pWindow); @@ -100,9 +100,9 @@ void IHyprLayout::onWindowRemovedFloating(PHLWINDOW pWindow) { void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) { CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(pWindow); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); - if (pWindow->m_bIsX11) { + if (pWindow->m_isX11) { Vector2D xy = {desiredGeometry.x, desiredGeometry.y}; xy = g_pXWaylandManager->xwaylandToWaylandCoords(xy); desiredGeometry.x = xy.x; @@ -117,39 +117,39 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) { } if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) { - const auto PWINDOWSURFACE = pWindow->m_pWLSurface->resource(); - *pWindow->m_vRealSize = PWINDOWSURFACE->current.size; + const auto PWINDOWSURFACE = pWindow->m_wlSurface->resource(); + *pWindow->m_realSize = PWINDOWSURFACE->current.size; - if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 && + if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 && pWindow->isX11OverrideRedirect()) { // XDG windows should be fine. TODO: check for weird atoms? pWindow->setHidden(true); return; } // reject any windows with size <= 5x5 - if (pWindow->m_vRealSize->goal().x <= 5 || pWindow->m_vRealSize->goal().y <= 5) - *pWindow->m_vRealSize = PMONITOR->vecSize / 2.f; + if (pWindow->m_realSize->goal().x <= 5 || pWindow->m_realSize->goal().y <= 5) + *pWindow->m_realSize = PMONITOR->vecSize / 2.f; - if (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect()) { + if (pWindow->m_isX11 && pWindow->isX11OverrideRedirect()) { - if (pWindow->m_pXWaylandSurface->geometry.x != 0 && pWindow->m_pXWaylandSurface->geometry.y != 0) - *pWindow->m_vRealPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_pXWaylandSurface->geometry.pos()); + if (pWindow->m_xwaylandSurface->geometry.x != 0 && pWindow->m_xwaylandSurface->geometry.y != 0) + *pWindow->m_realPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_xwaylandSurface->geometry.pos()); else - *pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize->goal().x) / 2.f, - PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize->goal().y) / 2.f); + *pWindow->m_realPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_realSize->goal().x) / 2.f, + PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_realSize->goal().y) / 2.f); } else { - *pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize->goal().x) / 2.f, - PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize->goal().y) / 2.f); + *pWindow->m_realPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_realSize->goal().x) / 2.f, + PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_realSize->goal().y) / 2.f); } } else { // we respect the size. - *pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height); + *pWindow->m_realSize = Vector2D(desiredGeometry.width, desiredGeometry.height); // check if it's on the correct monitor! Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f; // check if it's visible on any monitor (only for XDG) - bool visible = pWindow->m_bIsX11; + bool visible = pWindow->m_isX11; if (!visible) { visible = g_pCompositor->isPointOnAnyMonitor(Vector2D(desiredGeometry.x, desiredGeometry.y)) && @@ -159,57 +159,57 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) { } // TODO: detect a popup in a more consistent way. - if ((desiredGeometry.x == 0 && desiredGeometry.y == 0) || !visible || !pWindow->m_bIsX11) { + if ((desiredGeometry.x == 0 && desiredGeometry.y == 0) || !visible || !pWindow->m_isX11) { // if the pos isn't set, fall back to the center placement if it's not a child, otherwise middle of parent if available - if (!pWindow->m_bIsX11 && pWindow->m_pXDGSurface->toplevel->parent && validMapped(pWindow->m_pXDGSurface->toplevel->parent->window)) - *pWindow->m_vRealPosition = pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealPosition->goal() + - pWindow->m_pXDGSurface->toplevel->parent->window->m_vRealSize->goal() / 2.F - desiredGeometry.size() / 2.F; + if (!pWindow->m_isX11 && pWindow->m_xdgSurface->toplevel->parent && validMapped(pWindow->m_xdgSurface->toplevel->parent->window)) + *pWindow->m_realPosition = pWindow->m_xdgSurface->toplevel->parent->window->m_realPosition->goal() + + pWindow->m_xdgSurface->toplevel->parent->window->m_realSize->goal() / 2.F - desiredGeometry.size() / 2.F; else - *pWindow->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.F - desiredGeometry.size() / 2.F; + *pWindow->m_realPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.F - desiredGeometry.size() / 2.F; } else { // if it is, we respect where it wants to put itself, but apply monitor offset if outside // most of these are popups if (const auto POPENMON = g_pCompositor->getMonitorFromVector(middlePoint); POPENMON->ID != PMONITOR->ID) - *pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition; + *pWindow->m_realPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition; else - *pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y); + *pWindow->m_realPosition = Vector2D(desiredGeometry.x, desiredGeometry.y); } } - if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11) - *pWindow->m_vRealSize = pWindow->m_vRealSize->goal() / PMONITOR->scale; + if (*PXWLFORCESCALEZERO && pWindow->m_isX11) + *pWindow->m_realSize = pWindow->m_realSize->goal() / PMONITOR->scale; - if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect())) { - pWindow->m_vRealPosition->warp(); - pWindow->m_vRealSize->warp(); + if (pWindow->m_X11DoesntWantBorders || (pWindow->m_isX11 && pWindow->isX11OverrideRedirect())) { + pWindow->m_realPosition->warp(); + pWindow->m_realSize->warp(); } if (!pWindow->isX11OverrideRedirect()) g_pCompositor->changeWindowZOrder(pWindow, true); else { - pWindow->m_vPendingReportedSize = pWindow->m_vRealSize->goal(); - pWindow->m_vReportedSize = pWindow->m_vPendingReportedSize; + pWindow->m_pendingReportedSize = pWindow->m_realSize->goal(); + pWindow->m_reportedSize = pWindow->m_pendingReportedSize; } } bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) { static auto PAUTOGROUP = CConfigValue("group:auto_group"); - const PHLWINDOW OPENINGON = g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace ? + const PHLWINDOW OPENINGON = g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_workspace == pWindow->m_workspace ? g_pCompositor->m_lastWindow.lock() : - (pWindow->m_pWorkspace ? pWindow->m_pWorkspace->getFirstWindow() : nullptr); - const bool FLOATEDINTOTILED = pWindow->m_bIsFloating && !OPENINGON->m_bIsFloating; - const bool SWALLOWING = pWindow->m_pSwallowed || pWindow->m_bGroupSwallowed; + (pWindow->m_workspace ? pWindow->m_workspace->getFirstWindow() : nullptr); + const bool FLOATEDINTOTILED = pWindow->m_isFloating && !OPENINGON->m_isFloating; + const bool SWALLOWING = pWindow->m_swallowed || pWindow->m_groupSwallowed; if ((*PAUTOGROUP || SWALLOWING) // continue if auto_group is enabled or if dealing with window swallowing. && OPENINGON // this shouldn't be 0, but honestly, better safe than sorry. && OPENINGON != pWindow // prevent freeze when the "group set" window rule makes the new window to be already a group. - && OPENINGON->m_sGroupData.pNextWindow.lock() // check if OPENINGON is a group. + && OPENINGON->m_groupData.pNextWindow.lock() // check if OPENINGON is a group. && pWindow->canBeGroupedInto(OPENINGON) // check if the new window can be grouped into OPENINGON. && !g_pXWaylandManager->shouldBeFloated(pWindow) // don't group child windows. Fix for floated groups. Tiled groups don't need this because we check if !FLOATEDINTOTILED. && !FLOATEDINTOTILED) { // don't group a new floated window into a tiled group (for convenience). - pWindow->m_bIsFloating = OPENINGON->m_bIsFloating; // match the floating state. Needed to autogroup a new tiled window into a floated group. + pWindow->m_isFloating = OPENINGON->m_isFloating; // match the floating state. Needed to autogroup a new tiled window into a floated group. static auto USECURRPOS = CConfigValue("group:insert_after_current"); (*USECURRPOS ? OPENINGON : OPENINGON->getGroupTail())->insertWindowToGroup(pWindow); @@ -250,7 +250,7 @@ void IHyprLayout::onBeginDragWindow() { // get the grab corner static auto RESIZECORNER = CConfigValue("general:resize_corner"); - if (*RESIZECORNER != 0 && *RESIZECORNER <= 4 && DRAGGINGWINDOW->m_bIsFloating) { + if (*RESIZECORNER != 0 && *RESIZECORNER <= 4 && DRAGGINGWINDOW->m_isFloating) { switch (*RESIZECORNER) { case 1: m_eGrabbedCorner = CORNER_TOPLEFT; @@ -324,24 +324,24 @@ void IHyprLayout::onEndDragWindow() { if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW)) return; - const bool FLOATEDINTOTILED = !pWindow->m_bIsFloating && !DRAGGINGWINDOW->m_bDraggingTiled; + const bool FLOATEDINTOTILED = !pWindow->m_isFloating && !DRAGGINGWINDOW->m_draggingTiled; static auto PDRAGINTOGROUP = CConfigValue("group:drag_into_group"); - if (pWindow->m_sGroupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow) && *PDRAGINTOGROUP == 1 && !FLOATEDINTOTILED) { + if (pWindow->m_groupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow) && *PDRAGINTOGROUP == 1 && !FLOATEDINTOTILED) { - if (DRAGGINGWINDOW->m_sGroupData.pNextWindow) { - PHLWINDOW next = DRAGGINGWINDOW->m_sGroupData.pNextWindow.lock(); + if (DRAGGINGWINDOW->m_groupData.pNextWindow) { + PHLWINDOW next = DRAGGINGWINDOW->m_groupData.pNextWindow.lock(); while (next != DRAGGINGWINDOW) { - next->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of group members - *next->m_vRealSize = pWindow->m_vRealSize->goal(); // match the size of group members - *next->m_vRealPosition = pWindow->m_vRealPosition->goal(); // match the position of group members - next = next->m_sGroupData.pNextWindow.lock(); + next->m_isFloating = pWindow->m_isFloating; // match the floating state of group members + *next->m_realSize = pWindow->m_realSize->goal(); // match the size of group members + *next->m_realPosition = pWindow->m_realPosition->goal(); // match the position of group members + next = next->m_groupData.pNextWindow.lock(); } } - DRAGGINGWINDOW->m_bIsFloating = pWindow->m_bIsFloating; // match the floating state of the window - DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize; - DRAGGINGWINDOW->m_bDraggingTiled = false; + DRAGGINGWINDOW->m_isFloating = pWindow->m_isFloating; // match the floating state of the window + DRAGGINGWINDOW->m_lastFloatingSize = m_vDraggingWindowOriginalFloatSize; + DRAGGINGWINDOW->m_draggingTiled = false; static auto USECURRPOS = CConfigValue("group:insert_after_current"); (*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW); @@ -355,11 +355,11 @@ void IHyprLayout::onEndDragWindow() { } } - if (DRAGGINGWINDOW->m_bDraggingTiled) { - DRAGGINGWINDOW->m_bIsFloating = false; + if (DRAGGINGWINDOW->m_draggingTiled) { + DRAGGINGWINDOW->m_isFloating = false; g_pInputManager->refocus(); changeWindowFloatingMode(DRAGGINGWINDOW); - DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize; + DRAGGINGWINDOW->m_lastFloatingSize = m_vDraggingWindowOriginalFloatSize; } g_pHyprRenderer->damageWindow(DRAGGINGWINDOW); @@ -404,10 +404,10 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA if (*SNAPWINDOWGAP) { const double GAPSIZE = *SNAPWINDOWGAP; const auto WSID = DRAGGINGWINDOW->workspaceID(); - const bool HASFULLSCREEN = DRAGGINGWINDOW->m_pWorkspace && DRAGGINGWINDOW->m_pWorkspace->m_hasFullscreenWindow; + const bool HASFULLSCREEN = DRAGGINGWINDOW->m_workspace && DRAGGINGWINDOW->m_workspace->m_hasFullscreenWindow; for (auto& other : g_pCompositor->m_windows) { - if ((HASFULLSCREEN && !other->m_bCreatedOverFullscreen) || other == DRAGGINGWINDOW || other->workspaceID() != WSID || !other->m_bIsMapped || other->m_bFadingOut || + if ((HASFULLSCREEN && !other->m_createdOverFullscreen) || other == DRAGGINGWINDOW || other->workspaceID() != WSID || !other->m_isMapped || other->m_fadingOut || other->isX11OverrideRedirect()) continue; @@ -466,7 +466,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA if (*SNAPMONITORGAP) { const double GAPSIZE = *SNAPMONITORGAP; const double BORDERDIFF = OVERLAP ? DRAGGINGBORDERSIZE : 0; - const auto MON = DRAGGINGWINDOW->m_pMonitor.lock(); + const auto MON = DRAGGINGWINDOW->m_monitor.lock(); SRange monX = {MON->vecPosition.x + MON->vecReservedTopLeft.x + DRAGGINGBORDERSIZE, MON->vecPosition.x + MON->vecSize.x - MON->vecReservedBottomRight.x - DRAGGINGBORDERSIZE}; @@ -584,30 +584,30 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { if (g_pInputManager->dragMode == MBIND_MOVE) { Vector2D newPos = m_vBeginDragPositionXY + DELTA; - Vector2D newSize = DRAGGINGWINDOW->m_vRealSize->goal(); + Vector2D newSize = DRAGGINGWINDOW->m_realSize->goal(); - if (*SNAPENABLED && !DRAGGINGWINDOW->m_bDraggingTiled) + if (*SNAPENABLED && !DRAGGINGWINDOW->m_draggingTiled) performSnap(newPos, newSize, DRAGGINGWINDOW, MBIND_MOVE, -1, m_vBeginDragSizeXY); CBox wb = {newPos, newSize}; wb.round(); if (*PANIMATEMOUSE) - *DRAGGINGWINDOW->m_vRealPosition = wb.pos(); + *DRAGGINGWINDOW->m_realPosition = wb.pos(); else { - DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos()); + DRAGGINGWINDOW->m_realPosition->setValueAndWarp(wb.pos()); DRAGGINGWINDOW->sendWindowSize(); } - DRAGGINGWINDOW->m_vPosition = wb.pos(); + DRAGGINGWINDOW->m_position = wb.pos(); } else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) { - if (DRAGGINGWINDOW->m_bIsFloating) { + if (DRAGGINGWINDOW->m_isFloating) { - Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(MIN_WINDOW_SIZE, MIN_WINDOW_SIZE))); + Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_windowData.minSize.valueOr(Vector2D(MIN_WINDOW_SIZE, MIN_WINDOW_SIZE))); Vector2D MAXSIZE; - if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue()) - MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value()); + if (DRAGGINGWINDOW->m_windowData.maxSize.hasValue()) + MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, DRAGGINGWINDOW->m_windowData.maxSize.value()); else MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, Vector2D(std::numeric_limits::max(), std::numeric_limits::max())); @@ -624,7 +624,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { newSize = newSize + Vector2D(-DELTA.x, DELTA.y); eMouseBindMode mode = g_pInputManager->dragMode; - if (DRAGGINGWINDOW->m_sWindowData.keepAspectRatio.valueOrDefault() && mode != MBIND_RESIZE_BLOCK_RATIO) + if (DRAGGINGWINDOW->m_windowData.keepAspectRatio.valueOrDefault() && mode != MBIND_RESIZE_BLOCK_RATIO) mode = MBIND_RESIZE_FORCE_RATIO; if (m_vBeginDragSizeXY.x >= 1 && m_vBeginDragSizeXY.y >= 1 && mode == MBIND_RESIZE_FORCE_RATIO) { @@ -665,29 +665,29 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { wb.round(); if (*PANIMATE) { - *DRAGGINGWINDOW->m_vRealSize = wb.size(); - *DRAGGINGWINDOW->m_vRealPosition = wb.pos(); + *DRAGGINGWINDOW->m_realSize = wb.size(); + *DRAGGINGWINDOW->m_realPosition = wb.pos(); } else { - DRAGGINGWINDOW->m_vRealSize->setValueAndWarp(wb.size()); - DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos()); + DRAGGINGWINDOW->m_realSize->setValueAndWarp(wb.size()); + DRAGGINGWINDOW->m_realPosition->setValueAndWarp(wb.pos()); DRAGGINGWINDOW->sendWindowSize(); } - DRAGGINGWINDOW->m_vPosition = wb.pos(); - DRAGGINGWINDOW->m_vSize = wb.size(); + DRAGGINGWINDOW->m_position = wb.pos(); + DRAGGINGWINDOW->m_size = wb.size(); } else { resizeActiveWindow(TICKDELTA, m_eGrabbedCorner, DRAGGINGWINDOW); } } // get middle point - Vector2D middle = DRAGGINGWINDOW->m_vRealPosition->value() + DRAGGINGWINDOW->m_vRealSize->value() / 2.f; + Vector2D middle = DRAGGINGWINDOW->m_realPosition->value() + DRAGGINGWINDOW->m_realSize->value() / 2.f; // and check its monitor const auto PMONITOR = g_pCompositor->getMonitorFromVector(middle); if (PMONITOR && !SPECIAL) { - DRAGGINGWINDOW->m_pMonitor = PMONITOR; + DRAGGINGWINDOW->m_monitor = PMONITOR; DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace); DRAGGINGWINDOW->updateGroupOutputs(); @@ -706,7 +706,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { g_pCompositor->setWindowFullscreenInternal(pWindow, FSMODE_NONE); } - pWindow->m_bPinned = false; + pWindow->m_pinned = false; g_pHyprRenderer->damageWindow(pWindow, true); @@ -717,8 +717,8 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { EMIT_HOOK_EVENT("changeFloatingMode", pWindow); if (!TILED) { - const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition->value() + pWindow->m_vRealSize->value() / 2.f); - pWindow->m_pMonitor = PNEWMON; + const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_realPosition->value() + pWindow->m_realSize->value() / 2.f); + pWindow->m_monitor = PNEWMON; pWindow->moveToWorkspace(PNEWMON->activeSpecialWorkspace ? PNEWMON->activeSpecialWorkspace : PNEWMON->activeWorkspace); pWindow->updateGroupOutputs(); @@ -728,25 +728,25 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { g_pCompositor->setWindowFullscreenInternal(PWORKSPACE->getFullscreenWindow(), FSMODE_NONE); // save real pos cuz the func applies the default 5,5 mid - const auto PSAVEDPOS = pWindow->m_vRealPosition->goal(); - const auto PSAVEDSIZE = pWindow->m_vRealSize->goal(); + const auto PSAVEDPOS = pWindow->m_realPosition->goal(); + const auto PSAVEDSIZE = pWindow->m_realSize->goal(); // if the window is pseudo, update its size - if (!pWindow->m_bDraggingTiled) - pWindow->m_vPseudoSize = pWindow->m_vRealSize->goal(); + if (!pWindow->m_draggingTiled) + pWindow->m_pseudoSize = pWindow->m_realSize->goal(); - pWindow->m_vLastFloatingSize = PSAVEDSIZE; + pWindow->m_lastFloatingSize = PSAVEDSIZE; // move to narnia because we don't wanna find our own node. onWindowCreatedTiling should apply the coords back. - pWindow->m_vPosition = Vector2D(-999999, -999999); + pWindow->m_position = Vector2D(-999999, -999999); onWindowCreatedTiling(pWindow); - pWindow->m_vRealPosition->setValue(PSAVEDPOS); - pWindow->m_vRealSize->setValue(PSAVEDSIZE); + pWindow->m_realPosition->setValue(PSAVEDPOS); + pWindow->m_realSize->setValue(PSAVEDSIZE); // fix pseudo leaving artifacts - g_pHyprRenderer->damageMonitor(pWindow->m_pMonitor.lock()); + g_pHyprRenderer->damageMonitor(pWindow->m_monitor.lock()); if (pWindow == g_pCompositor->m_lastWindow) m_pLastTiledWindow = pWindow; @@ -755,21 +755,21 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { g_pCompositor->changeWindowZOrder(pWindow, true); - CBox wb = {pWindow->m_vRealPosition->goal() + (pWindow->m_vRealSize->goal() - pWindow->m_vLastFloatingSize) / 2.f, pWindow->m_vLastFloatingSize}; + CBox wb = {pWindow->m_realPosition->goal() + (pWindow->m_realSize->goal() - pWindow->m_lastFloatingSize) / 2.f, pWindow->m_lastFloatingSize}; wb.round(); - if (!(pWindow->m_bIsFloating && pWindow->m_bIsPseudotiled) && DELTALESSTHAN(pWindow->m_vRealSize->value().x, pWindow->m_vLastFloatingSize.x, 10) && - DELTALESSTHAN(pWindow->m_vRealSize->value().y, pWindow->m_vLastFloatingSize.y, 10)) { + if (!(pWindow->m_isFloating && pWindow->m_isPseudotiled) && DELTALESSTHAN(pWindow->m_realSize->value().x, pWindow->m_lastFloatingSize.x, 10) && + DELTALESSTHAN(pWindow->m_realSize->value().y, pWindow->m_lastFloatingSize.y, 10)) { wb = {wb.pos() + Vector2D{10, 10}, wb.size() - Vector2D{20, 20}}; } - *pWindow->m_vRealPosition = wb.pos(); - *pWindow->m_vRealSize = wb.size(); + *pWindow->m_realPosition = wb.pos(); + *pWindow->m_realSize = wb.size(); - pWindow->m_vSize = wb.size(); - pWindow->m_vPosition = wb.pos(); + pWindow->m_size = wb.size(); + pWindow->m_position = wb.pos(); - g_pHyprRenderer->damageMonitor(pWindow->m_pMonitor.lock()); + g_pHyprRenderer->damageMonitor(pWindow->m_monitor.lock()); pWindow->unsetWindowData(PRIORITY_LAYOUT); pWindow->updateWindowData(); @@ -789,21 +789,21 @@ void IHyprLayout::moveActiveWindow(const Vector2D& delta, PHLWINDOW pWindow) { if (!validMapped(PWINDOW)) return; - if (!PWINDOW->m_bIsFloating) { + if (!PWINDOW->m_isFloating) { Debug::log(LOG, "Dwindle cannot move a tiled window in moveActiveWindow!"); return; } PWINDOW->setAnimationsToMove(); - PWINDOW->m_vPosition += delta; - *PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition->goal() + delta; + PWINDOW->m_position += delta; + *PWINDOW->m_realPosition = PWINDOW->m_realPosition->goal() + delta; g_pHyprRenderer->damageWindow(PWINDOW); } void IHyprLayout::onWindowFocusChange(PHLWINDOW pNewFocus) { - m_pLastTiledWindow = pNewFocus && !pNewFocus->m_bIsFloating ? pNewFocus : m_pLastTiledWindow; + m_pLastTiledWindow = pNewFocus && !pNewFocus->m_isFloating ? pNewFocus : m_pLastTiledWindow; } PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { @@ -811,27 +811,26 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { if (!pWindow) return nullptr; - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PWORKSPACE = pWindow->m_workspace; // first of all, if this is a fullscreen workspace, if (PWORKSPACE->m_hasFullscreenWindow) return PWORKSPACE->getFullscreenWindow(); - if (pWindow->m_bIsFloating) { + if (pWindow->m_isFloating) { // find whether there is a floating window below this one for (auto const& w : g_pCompositor->m_windows) { - if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus && - !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) { - if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x, - w->m_vPosition.y + w->m_vSize.y)) { + if (w->m_isMapped && !w->isHidden() && w->m_isFloating && !w->isX11OverrideRedirect() && w->m_workspace == pWindow->m_workspace && !w->m_X11ShouldntFocus && + !w->m_windowData.noFocus.valueOrDefault() && w != pWindow) { + if (VECINRECT((pWindow->m_size / 2.f + pWindow->m_position), w->m_position.x, w->m_position.y, w->m_position.x + w->m_size.x, w->m_position.y + w->m_size.y)) { return w; } } } // let's try the last tiled window. - if (m_pLastTiledWindow.lock() && m_pLastTiledWindow->m_pWorkspace == pWindow->m_pWorkspace) + if (m_pLastTiledWindow.lock() && m_pLastTiledWindow->m_workspace == pWindow->m_workspace) return m_pLastTiledWindow.lock(); // if we don't, let's try to find any window that is in the middle @@ -841,8 +840,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { // if not, floating window for (auto const& w : g_pCompositor->m_windows) { - if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus && - !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) + if (w->m_isMapped && !w->isHidden() && w->m_isFloating && !w->isX11OverrideRedirect() && w->m_workspace == pWindow->m_workspace && !w->m_X11ShouldntFocus && + !w->m_windowData.noFocus.valueOrDefault() && w != pWindow) return w; } @@ -859,22 +858,22 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { if (!pWindowCandidate) pWindowCandidate = PWORKSPACE->getFirstWindow(); - if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_bIsMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_bX11ShouldntFocus || - pWindowCandidate->isX11OverrideRedirect() || pWindowCandidate->m_pMonitor != g_pCompositor->m_lastMonitor) + if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_isMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_X11ShouldntFocus || + pWindowCandidate->isX11OverrideRedirect() || pWindowCandidate->m_monitor != g_pCompositor->m_lastMonitor) return nullptr; return pWindowCandidate; } bool IHyprLayout::isWindowReachable(PHLWINDOW pWindow) { - return pWindow && (!pWindow->isHidden() || pWindow->m_sGroupData.pNextWindow); + return pWindow && (!pWindow->isHidden() || pWindow->m_groupData.pNextWindow); } void IHyprLayout::bringWindowToTop(PHLWINDOW pWindow) { if (pWindow == nullptr) return; - if (pWindow->isHidden() && pWindow->m_sGroupData.pNextWindow) { + if (pWindow->isHidden() && pWindow->m_groupData.pNextWindow) { // grouped, change the current to this window pWindow->setGroupCurrent(pWindow); } @@ -890,11 +889,11 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge Vector2D sizeOverride = {}; if (g_pCompositor->m_lastMonitor) { for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) { - if (r->ruleType != CWindowRule::RULE_SIZE) + if (r->m_ruleType != CWindowRule::RULE_SIZE) continue; try { - const auto VALUE = r->szRule.substr(r->szRule.find(' ') + 1); + const auto VALUE = r->m_rule.substr(r->m_rule.find(' ') + 1); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); @@ -908,7 +907,7 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge sizeOverride = {SIZEX, SIZEY}; - } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->szRule, r->szValue); } + } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r->m_rule, r->m_value); } break; } } @@ -921,7 +920,7 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) { if (!shouldBeFloated) { for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) { - if (r->ruleType != CWindowRule::RULE_FLOAT) + if (r->m_ruleType != CWindowRule::RULE_FLOAT) continue; shouldBeFloated = true; @@ -936,7 +935,7 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) { else sizePredicted = predictSizeForNewWindowFloating(pWindow); - Vector2D maxSize = pWindow->m_pXDGSurface->toplevel->pending.maxSize; + Vector2D maxSize = pWindow->m_xdgSurface->toplevel->pending.maxSize; if ((maxSize.x > 0 && maxSize.x < sizePredicted.x) || (maxSize.y > 0 && maxSize.y < sizePredicted.y)) sizePredicted = {}; @@ -954,35 +953,35 @@ bool IHyprLayout::updateDragWindow() { g_pCompositor->setWindowFullscreenInternal(DRAGGINGWINDOW, FSMODE_NONE); } - const auto PWORKSPACE = DRAGGINGWINDOW->m_pWorkspace; + const auto PWORKSPACE = DRAGGINGWINDOW->m_workspace; - if (PWORKSPACE->m_hasFullscreenWindow && (!DRAGGINGWINDOW->m_bCreatedOverFullscreen || !DRAGGINGWINDOW->m_bIsFloating)) { + if (PWORKSPACE->m_hasFullscreenWindow && (!DRAGGINGWINDOW->m_createdOverFullscreen || !DRAGGINGWINDOW->m_isFloating)) { Debug::log(LOG, "Rejecting drag on a fullscreen workspace. (window under fullscreen)"); g_pKeybindManager->changeMouseBindMode(MBIND_INVALID); return true; } } - DRAGGINGWINDOW->m_bDraggingTiled = false; - m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize; + DRAGGINGWINDOW->m_draggingTiled = false; + m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_lastFloatingSize; - if (WAS_FULLSCREEN && DRAGGINGWINDOW->m_bIsFloating) { - const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); - *DRAGGINGWINDOW->m_vRealPosition = MOUSECOORDS - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f; - } else if (!DRAGGINGWINDOW->m_bIsFloating && g_pInputManager->dragMode == MBIND_MOVE) { - Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(MIN_WINDOW_SIZE, MIN_WINDOW_SIZE))); - DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize->goal() * 0.8489).clamp(MINSIZE, Vector2D{}).floor(); - *DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f; + if (WAS_FULLSCREEN && DRAGGINGWINDOW->m_isFloating) { + const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); + *DRAGGINGWINDOW->m_realPosition = MOUSECOORDS - DRAGGINGWINDOW->m_realSize->goal() / 2.f; + } else if (!DRAGGINGWINDOW->m_isFloating && g_pInputManager->dragMode == MBIND_MOVE) { + Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_windowData.minSize.valueOr(Vector2D(MIN_WINDOW_SIZE, MIN_WINDOW_SIZE))); + DRAGGINGWINDOW->m_lastFloatingSize = (DRAGGINGWINDOW->m_realSize->goal() * 0.8489).clamp(MINSIZE, Vector2D{}).floor(); + *DRAGGINGWINDOW->m_realPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_realSize->goal() / 2.f; if (g_pInputManager->m_bDragThresholdReached) { changeWindowFloatingMode(DRAGGINGWINDOW); - DRAGGINGWINDOW->m_bIsFloating = true; - DRAGGINGWINDOW->m_bDraggingTiled = true; + DRAGGINGWINDOW->m_isFloating = true; + DRAGGINGWINDOW->m_draggingTiled = true; } } m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal(); - m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition->goal(); - m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize->goal(); + m_vBeginDragPositionXY = DRAGGINGWINDOW->m_realPosition->goal(); + m_vBeginDragSizeXY = DRAGGINGWINDOW->m_realSize->goal(); m_vLastDragXY = m_vBeginDragXY; return false; diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 052a6ed9..6c7f6d1a 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -78,14 +78,14 @@ SMasterNodeData* CHyprMasterLayout::getMasterNodeOnWorkspace(const WORKSPACEID& } void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) { - if (pWindow->m_bIsFloating) + if (pWindow->m_isFloating) return; static auto PNEWONACTIVE = CConfigValue("master:new_on_active"); static auto PNEWONTOP = CConfigValue("master:new_on_top"); static auto PNEWSTATUS = CConfigValue("master:new_status"); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); const bool BNEWBEFOREACTIVE = *PNEWONACTIVE == "before"; const bool BNEWISMASTER = *PNEWSTATUS == "master"; @@ -110,13 +110,13 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire static auto PMFACT = CConfigValue("master:mfact"); float lastSplitPercent = *PMFACT; - auto OPENINGON = isWindowTiled(g_pCompositor->m_lastWindow.lock()) && g_pCompositor->m_lastWindow->m_pWorkspace == pWindow->m_pWorkspace ? + auto OPENINGON = isWindowTiled(g_pCompositor->m_lastWindow.lock()) && g_pCompositor->m_lastWindow->m_workspace == pWindow->m_workspace ? getNodeFromWindow(g_pCompositor->m_lastWindow.lock()) : getMasterNodeOnWorkspace(pWindow->workspaceID()); const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); static auto PDROPATCURSOR = CConfigValue("master:drop_at_cursor"); - eOrientation orientation = getDynamicOrientation(pWindow->m_pWorkspace); + eOrientation orientation = getDynamicOrientation(pWindow->m_workspace); const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE); bool forceDropAsMaster = false; @@ -177,10 +177,10 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire } } - if ((BNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) // - || WINDOWSONWORKSPACE == 1 // - || (WINDOWSONWORKSPACE > 2 && !pWindow->m_bFirstMap && OPENINGON->isMaster) // - || forceDropAsMaster // + if ((BNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) // + || WINDOWSONWORKSPACE == 1 // + || (WINDOWSONWORKSPACE > 2 && !pWindow->m_firstMap && OPENINGON->isMaster) // + || forceDropAsMaster // || (*PNEWSTATUS == "inherit" && OPENINGON && OPENINGON->isMaster && g_pInputManager->dragMode != MBIND_MOVE)) { if (BNEWBEFOREACTIVE) { @@ -207,7 +207,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire // first, check if it isn't too big. if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) { // we can't continue. make it floating. - pWindow->m_bIsFloating = true; + pWindow->m_isFloating = true; m_lMasterNodesData.remove(*PNODE); g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(pWindow); return; @@ -220,7 +220,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) { // we can't continue. make it floating. - pWindow->m_bIsFloating = true; + pWindow->m_isFloating = true; m_lMasterNodesData.remove(*PNODE); g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(pWindow); return; @@ -306,16 +306,16 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) { const auto PFULLWINDOW = pWorkspace->getFullscreenWindow(); if (pWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN) { - *PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition; - *PFULLWINDOW->m_vRealSize = PMONITOR->vecSize; + *PFULLWINDOW->m_realPosition = PMONITOR->vecPosition; + *PFULLWINDOW->m_realSize = PMONITOR->vecSize; } else if (pWorkspace->m_fullscreenMode == FSMODE_MAXIMIZED) { SMasterNodeData fakeNode; fakeNode.pWindow = PFULLWINDOW; fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; fakeNode.workspaceID = pWorkspace->m_id; - PFULLWINDOW->m_vPosition = fakeNode.position; - PFULLWINDOW->m_vSize = fakeNode.size; + PFULLWINDOW->m_position = fakeNode.position; + PFULLWINDOW->m_size = fakeNode.size; fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -644,7 +644,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { const auto PWINDOW = pNode->pWindow.lock(); // get specific gaps and rules for this workspace, // if user specified them in config - const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_pWorkspace); + const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_workspace); if (PWINDOW->isFullscreen() && !pNode->ignoreFullscreenChecks) return; @@ -666,13 +666,13 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { return; } - PWINDOW->m_vSize = pNode->size; - PWINDOW->m_vPosition = pNode->position; + PWINDOW->m_size = pNode->size; + PWINDOW->m_position = pNode->position; PWINDOW->updateWindowDecos(); - auto calcPos = PWINDOW->m_vPosition; - auto calcSize = PWINDOW->m_vSize; + 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)); @@ -691,21 +691,21 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealPosition = wb.pos(); - *PWINDOW->m_vRealSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); } else { CBox wb = {calcPos, calcSize}; wb.round(); // avoid rounding mess - *PWINDOW->m_vRealPosition = wb.pos(); - *PWINDOW->m_vRealSize = wb.size(); + *PWINDOW->m_realPosition = wb.pos(); + *PWINDOW->m_realSize = wb.size(); } if (m_bForceWarps && !*PANIMATE) { g_pHyprRenderer->damageWindow(PWINDOW); - PWINDOW->m_vRealPosition->warp(); - PWINDOW->m_vRealSize->warp(); + PWINDOW->m_realPosition->warp(); + PWINDOW->m_realSize->warp(); g_pHyprRenderer->damageWindow(PWINDOW); } @@ -726,21 +726,21 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne const auto PNODE = getNodeFromWindow(PWINDOW); if (!PNODE) { - *PWINDOW->m_vRealSize = - (PWINDOW->m_vRealSize->goal() + pixResize) - .clamp(PWINDOW->m_sWindowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_sWindowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); + *PWINDOW->m_realSize = + (PWINDOW->m_realSize->goal() + pixResize) + .clamp(PWINDOW->m_windowData.minSize.valueOr(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), PWINDOW->m_windowData.maxSize.valueOr(Vector2D{INFINITY, INFINITY})); PWINDOW->updateWindowDecos(); return; } - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); static auto SLAVECOUNTFORCENTER = CConfigValue("master:slave_count_for_center_master"); static auto PSMARTRESIZING = CConfigValue("master:smart_resizing"); - const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); - const bool DISPLAYRIGHT = STICKS(PWINDOW->m_vPosition.x + PWINDOW->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); - const bool DISPLAYTOP = STICKS(PWINDOW->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); - const bool DISPLAYLEFT = STICKS(PWINDOW->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); + const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_position.y + PWINDOW->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); + const bool DISPLAYRIGHT = STICKS(PWINDOW->m_position.x + PWINDOW->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); + const bool DISPLAYTOP = STICKS(PWINDOW->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); + const bool DISPLAYLEFT = STICKS(PWINDOW->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); const bool LEFT = corner == CORNER_TOPLEFT || corner == CORNER_BOTTOMLEFT; const bool TOP = corner == CORNER_TOPLEFT || corner == CORNER_TOPRIGHT; @@ -750,7 +750,7 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne const auto WINDOWS = getNodesOnWorkspace(PNODE->workspaceID); const auto STACKWINDOWS = WINDOWS - MASTERS; - eOrientation orientation = getDynamicOrientation(PWINDOW->m_pWorkspace); + eOrientation orientation = getDynamicOrientation(PWINDOW->m_workspace); bool centered = orientation == ORIENTATION_CENTER && (STACKWINDOWS >= *SLAVECOUNTFORCENTER); double delta = 0; @@ -862,15 +862,15 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne } void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFullscreenMode CURRENT_EFFECTIVE_MODE, const eFullscreenMode EFFECTIVE_MODE) { - const auto PMONITOR = pWindow->m_pMonitor.lock(); - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PMONITOR = pWindow->m_monitor.lock(); + const auto PWORKSPACE = pWindow->m_workspace; // save position and size if floating - if (pWindow->m_bIsFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { - pWindow->m_vLastFloatingSize = pWindow->m_vRealSize->goal(); - pWindow->m_vLastFloatingPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vPosition = pWindow->m_vRealPosition->goal(); - pWindow->m_vSize = pWindow->m_vRealSize->goal(); + if (pWindow->m_isFloating && CURRENT_EFFECTIVE_MODE == FSMODE_NONE) { + pWindow->m_lastFloatingSize = pWindow->m_realSize->goal(); + pWindow->m_lastFloatingPosition = pWindow->m_realPosition->goal(); + pWindow->m_position = pWindow->m_realPosition->goal(); + pWindow->m_size = pWindow->m_realSize->goal(); } if (EFFECTIVE_MODE == FSMODE_NONE) { @@ -880,8 +880,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul applyNodeDataToWindow(PNODE); else { // get back its' dimensions from position and size - *pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; - *pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; + *pWindow->m_realPosition = pWindow->m_lastFloatingPosition; + *pWindow->m_realSize = pWindow->m_lastFloatingSize; pWindow->unsetWindowData(PRIORITY_LAYOUT); pWindow->updateWindowData(); @@ -889,8 +889,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul } else { // apply new pos and size being monitors' box if (EFFECTIVE_MODE == FSMODE_FULLSCREEN) { - *pWindow->m_vRealPosition = PMONITOR->vecPosition; - *pWindow->m_vRealSize = PMONITOR->vecSize; + *pWindow->m_realPosition = PMONITOR->vecPosition; + *pWindow->m_realSize = PMONITOR->vecSize; } else { // This is a massive hack. // We make a fake "only" node and apply @@ -901,8 +901,8 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFul fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; fakeNode.workspaceID = pWindow->workspaceID(); - pWindow->m_vPosition = fakeNode.position; - pWindow->m_vSize = fakeNode.size; + pWindow->m_position = fakeNode.position; + pWindow->m_size = fakeNode.size; fakeNode.ignoreFullscreenChecks = true; applyNodeDataToWindow(&fakeNode); @@ -940,13 +940,13 @@ void CHyprMasterLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, pWindow->setAnimationsToMove(); - if (pWindow->m_pWorkspace != PWINDOW2->m_pWorkspace) { + if (pWindow->m_workspace != PWINDOW2->m_workspace) { // if different monitors, send to monitor onWindowRemovedTiling(pWindow); - pWindow->moveToWorkspace(PWINDOW2->m_pWorkspace); - pWindow->m_pMonitor = PWINDOW2->m_pMonitor; + pWindow->moveToWorkspace(PWINDOW2->m_workspace); + pWindow->m_monitor = PWINDOW2->m_monitor; if (!silent) { - const auto pMonitor = pWindow->m_pMonitor.lock(); + const auto pMonitor = pWindow->m_monitor.lock(); g_pCompositor->setActiveMonitor(pMonitor); } onWindowCreatedTiling(pWindow); @@ -958,11 +958,11 @@ void CHyprMasterLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, } pWindow->updateGroupOutputs(); - if (!pWindow->m_sGroupData.pNextWindow.expired()) { - PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); + if (!pWindow->m_groupData.pNextWindow.expired()) { + PHLWINDOW next = pWindow->m_groupData.pNextWindow.lock(); while (next != pWindow) { next->updateToplevel(); - next = next->m_sGroupData.pNextWindow.lock(); + next = next->m_groupData.pNextWindow.lock(); } } } @@ -977,8 +977,8 @@ void CHyprMasterLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { return; if (PNODE->workspaceID != PNODE2->workspaceID) { - std::swap(pWindow2->m_pMonitor, pWindow->m_pMonitor); - std::swap(pWindow2->m_pWorkspace, pWindow->m_pWorkspace); + std::swap(pWindow2->m_monitor, pWindow->m_monitor); + std::swap(pWindow2->m_workspace, pWindow->m_workspace); } // massive hack: just swap window pointers, lol @@ -1047,8 +1047,8 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri return; if (header.pWindow->isFullscreen()) { - const auto PWORKSPACE = header.pWindow->m_pWorkspace; - const auto FSMODE = header.pWindow->m_sFullscreenState.internal; + const auto PWORKSPACE = header.pWindow->m_workspace; + const auto FSMODE = header.pWindow->m_fullscreenState.internal; static auto INHERITFULLSCREEN = CConfigValue("master:inherit_fullscreen"); g_pCompositor->setWindowFullscreenInternal(header.pWindow, FSMODE_NONE); g_pCompositor->focusWindow(PWINDOWTOCHANGETO); @@ -1167,7 +1167,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) { + if (header.pWindow->m_isFloating) { g_pKeybindManager->m_mDispatchers["swapnext"](""); return 0; } @@ -1184,7 +1184,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) { + if (header.pWindow->m_isFloating) { g_pKeybindManager->m_mDispatchers["swapnext"]("prev"); return 0; } @@ -1201,7 +1201,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) + if (header.pWindow->m_isFloating) return 0; const auto PNODE = getNodeFromWindow(header.pWindow); @@ -1234,7 +1234,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri if (!validMapped(header.pWindow)) return 0; - if (header.pWindow->m_bIsFloating) + if (header.pWindow->m_isFloating) return 0; const auto PNODE = getNodeFromWindow(header.pWindow); @@ -1469,7 +1469,7 @@ Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() { void CHyprMasterLayout::onEnable() { for (auto const& w : g_pCompositor->m_windows) { - if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden()) + if (w->m_isFloating || !w->m_isMapped || w->isHidden()) continue; onWindowCreatedTiling(w); diff --git a/src/managers/ANRManager.cpp b/src/managers/ANRManager.cpp index 48b9a6db..84261c45 100644 --- a/src/managers/ANRManager.cpp +++ b/src/managers/ANRManager.cpp @@ -51,7 +51,7 @@ void CANRManager::onTick() { PHLWINDOW firstWindow; int count = 0; for (const auto& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped) + if (!w->m_isMapped) continue; if (!data->fitsWindow(w)) @@ -67,10 +67,10 @@ void CANRManager::onTick() { if (data->missedResponses >= *PANRTHRESHOLD) { if (!data->isRunning() && !data->dialogSaidWait) { - data->runDialog("Application Not Responding", firstWindow->m_szTitle, firstWindow->m_szClass, data->getPid()); + data->runDialog("Application Not Responding", firstWindow->m_title, firstWindow->m_class, data->getPid()); for (const auto& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped) + if (!w->m_isMapped) continue; if (!data->fitsWindow(w)) @@ -133,10 +133,10 @@ bool CANRManager::isNotResponding(SP data) { SP CANRManager::dataFor(PHLWINDOW pWindow) { auto it = m_data.end(); - if (pWindow->m_pXWaylandSurface) - it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xwaylandSurface && data->xwaylandSurface == pWindow->m_pXWaylandSurface; }); - else if (pWindow->m_pXDGSurface) - it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xdgBase && data->xdgBase == pWindow->m_pXDGSurface->owner; }); + if (pWindow->m_xwaylandSurface) + it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xwaylandSurface && data->xwaylandSurface == pWindow->m_xwaylandSurface; }); + else if (pWindow->m_xdgSurface) + it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xdgBase && data->xdgBase == pWindow->m_xdgSurface->owner; }); return it == m_data.end() ? nullptr : *it; } @@ -150,8 +150,7 @@ SP CANRManager::dataFor(SP pXwaylandSur return it == m_data.end() ? nullptr : *it; } -CANRManager::SANRData::SANRData(PHLWINDOW pWindow) : - xwaylandSurface(pWindow->m_pXWaylandSurface), xdgBase(pWindow->m_pXDGSurface ? pWindow->m_pXDGSurface->owner : WP{}) { +CANRManager::SANRData::SANRData(PHLWINDOW pWindow) : xwaylandSurface(pWindow->m_xwaylandSurface), xdgBase(pWindow->m_xdgSurface ? pWindow->m_xdgSurface->owner : WP{}) { ; } @@ -199,10 +198,10 @@ void CANRManager::SANRData::killDialog() { } bool CANRManager::SANRData::fitsWindow(PHLWINDOW pWindow) const { - if (pWindow->m_pXWaylandSurface) - return pWindow->m_pXWaylandSurface == xwaylandSurface; - else if (pWindow->m_pXDGSurface) - return pWindow->m_pXDGSurface->owner == xdgBase && xdgBase; + if (pWindow->m_xwaylandSurface) + return pWindow->m_xwaylandSurface == xwaylandSurface; + else if (pWindow->m_xdgSurface) + return pWindow->m_xdgSurface->owner == xdgBase && xdgBase; return false; } diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 0db60e58..c9b270e2 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -94,11 +94,11 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { PDECO->damageEntire(); } - PMONITOR = PWINDOW->m_pMonitor.lock(); + PMONITOR = PWINDOW->m_monitor.lock(); if (!PMONITOR) return; - animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled); + animationsDisabled = PWINDOW->m_windowData.noAnim.valueOr(animationsDisabled); } else if (PWORKSPACE) { PMONITOR = PWORKSPACE->m_monitor.lock(); if (!PMONITOR) @@ -110,10 +110,10 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { // TODO: just make this into a damn callback already vax... for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE) + if (!w->m_isMapped || w->isHidden() || w->m_workspace != PWORKSPACE) continue; - if (w->m_bIsFloating && !w->m_bPinned) { + if (w->m_isFloating && !w->m_pinned) { // still doing the full damage hack for floating because sometimes when the window // goes through multiple monitors the last rendered frame is missing damage somehow?? const CBox windowBoxNoOffset = w->getFullWindowBoundingBox(); @@ -128,7 +128,7 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { // damage any workspace window that is on any monitor for (auto const& w : g_pCompositor->m_windows) { - if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned) + if (!validMapped(w) || w->m_workspace != PWORKSPACE || w->m_pinned) continue; g_pHyprRenderer->damageWindow(w); @@ -164,13 +164,13 @@ static void handleUpdate(CAnimatedVariable& av, bool warp) { g_pHyprRenderer->damageWindow(PWINDOW); } else if (PWORKSPACE) { for (auto const& w : g_pCompositor->m_windows) { - if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE) + if (!validMapped(w) || w->m_workspace != PWORKSPACE) continue; w->updateWindowDecos(); // damage any workspace window that is on any monitor - if (!w->m_bPinned) + if (!w->m_pinned) g_pHyprRenderer->damageWindow(w); } } else if (PLAYER) { @@ -281,25 +281,25 @@ void CHyprAnimationManager::onTicked() { // void CHyprAnimationManager::animationPopin(PHLWINDOW pWindow, bool close, float minPerc) { - const auto GOALPOS = pWindow->m_vRealPosition->goal(); - const auto GOALSIZE = pWindow->m_vRealSize->goal(); + const auto GOALPOS = pWindow->m_realPosition->goal(); + const auto GOALSIZE = pWindow->m_realSize->goal(); if (!close) { - pWindow->m_vRealSize->setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y})); - pWindow->m_vRealPosition->setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->value() / 2.f); + pWindow->m_realSize->setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y})); + pWindow->m_realPosition->setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_realSize->value() / 2.f); } else { - *pWindow->m_vRealSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}); - *pWindow->m_vRealPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->goal() / 2.f; + *pWindow->m_realSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}); + *pWindow->m_realPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_realSize->goal() / 2.f; } } void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, bool close) { - pWindow->m_vRealSize->warp(false); // size we preserve in slide + pWindow->m_realSize->warp(false); // size we preserve in slide - const auto GOALPOS = pWindow->m_vRealPosition->goal(); - const auto GOALSIZE = pWindow->m_vRealSize->goal(); + const auto GOALPOS = pWindow->m_realPosition->goal(); + const auto GOALSIZE = pWindow->m_realSize->goal(); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); if (!PMONITOR) return; // unsafe state most likely @@ -317,9 +317,9 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y); if (!close) - pWindow->m_vRealPosition->setValue(posOffset); + pWindow->m_realPosition->setValue(posOffset); else - *pWindow->m_vRealPosition = posOffset; + *pWindow->m_realPosition = posOffset; return; } @@ -327,10 +327,10 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, const auto MIDPOINT = GOALPOS + GOALSIZE / 2.f; // check sides it touches - const bool DISPLAYLEFT = STICKS(pWindow->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); - const bool DISPLAYRIGHT = STICKS(pWindow->m_vPosition.x + pWindow->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); - const bool DISPLAYTOP = STICKS(pWindow->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); - const bool DISPLAYBOTTOM = STICKS(pWindow->m_vPosition.y + pWindow->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); + const bool DISPLAYLEFT = STICKS(pWindow->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); + const bool DISPLAYRIGHT = STICKS(pWindow->m_position.x + pWindow->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); + const bool DISPLAYTOP = STICKS(pWindow->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); + const bool DISPLAYBOTTOM = STICKS(pWindow->m_position.y + pWindow->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); if (DISPLAYBOTTOM && DISPLAYTOP) { if (DISPLAYLEFT && DISPLAYRIGHT) { @@ -352,52 +352,52 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, } if (!close) - pWindow->m_vRealPosition->setValue(posOffset); + pWindow->m_realPosition->setValue(posOffset); else - *pWindow->m_vRealPosition = posOffset; + *pWindow->m_realPosition = posOffset; } void CHyprAnimationManager::animationGnomed(PHLWINDOW pWindow, bool close) { - const auto GOALPOS = pWindow->m_vRealPosition->goal(); - const auto GOALSIZE = pWindow->m_vRealSize->goal(); + const auto GOALPOS = pWindow->m_realPosition->goal(); + const auto GOALSIZE = pWindow->m_realSize->goal(); if (close) { - *pWindow->m_vRealPosition = GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F}; - *pWindow->m_vRealSize = Vector2D{GOALSIZE.x, 0.F}; + *pWindow->m_realPosition = GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F}; + *pWindow->m_realSize = Vector2D{GOALSIZE.x, 0.F}; } else { - pWindow->m_vRealPosition->setValueAndWarp(GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F}); - pWindow->m_vRealSize->setValueAndWarp(Vector2D{GOALSIZE.x, 0.F}); - *pWindow->m_vRealPosition = GOALPOS; - *pWindow->m_vRealSize = GOALSIZE; + pWindow->m_realPosition->setValueAndWarp(GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F}); + pWindow->m_realSize->setValueAndWarp(Vector2D{GOALSIZE.x, 0.F}); + *pWindow->m_realPosition = GOALPOS; + *pWindow->m_realSize = GOALSIZE; } } void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) { if (!close) { - pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn")); - pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn")); - pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn")); + pWindow->m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn")); + pWindow->m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn")); + pWindow->m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn")); } else { - pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut")); - pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut")); - pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut")); + pWindow->m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut")); + pWindow->m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut")); + pWindow->m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut")); } - std::string ANIMSTYLE = pWindow->m_vRealPosition->getStyle(); + std::string ANIMSTYLE = pWindow->m_realPosition->getStyle(); transform(ANIMSTYLE.begin(), ANIMSTYLE.end(), ANIMSTYLE.begin(), ::tolower); CVarList animList(ANIMSTYLE, 0, 's'); // if the window is not being animated, that means the layout set a fixed size for it, don't animate. - if (!pWindow->m_vRealPosition->isBeingAnimated() && !pWindow->m_vRealSize->isBeingAnimated()) + if (!pWindow->m_realPosition->isBeingAnimated() && !pWindow->m_realSize->isBeingAnimated()) return; // if the animation is disabled and we are leaving, ignore the anim to prevent the snapshot being fucked - if (!pWindow->m_vRealPosition->enabled()) + if (!pWindow->m_realPosition->enabled()) return; - if (pWindow->m_sWindowData.animationStyle.hasValue()) { - const auto STYLE = pWindow->m_sWindowData.animationStyle.value(); + if (pWindow->m_windowData.animationStyle.hasValue()) { + const auto STYLE = pWindow->m_windowData.animationStyle.value(); // the window has config'd special anim if (STYLE.starts_with("slide")) { CVarList animList2(STYLE, 0, 's'); diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 44d90748..f30f65a1 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -331,7 +331,7 @@ static void updateRelativeCursorCoords() { return; if (g_pCompositor->m_lastWindow) - g_pCompositor->m_lastWindow->m_vRelativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_lastWindow->m_vPosition; + g_pCompositor->m_lastWindow->m_relativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_lastWindow->m_position; } bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) { @@ -389,21 +389,21 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF // remove constraints g_pInputManager->unconstrainMouse(); - if (PLASTWINDOW && PLASTWINDOW->m_pWorkspace == PWINDOWTOCHANGETO->m_pWorkspace && PLASTWINDOW->isFullscreen()) { - const auto PWORKSPACE = PLASTWINDOW->m_pWorkspace; + if (PLASTWINDOW && PLASTWINDOW->m_workspace == PWINDOWTOCHANGETO->m_workspace && PLASTWINDOW->isFullscreen()) { + const auto PWORKSPACE = PLASTWINDOW->m_workspace; const auto MODE = PWORKSPACE->m_fullscreenMode; - if (!PWINDOWTOCHANGETO->m_bPinned) + if (!PWINDOWTOCHANGETO->m_pinned) g_pCompositor->setWindowFullscreenInternal(PLASTWINDOW, FSMODE_NONE); g_pCompositor->focusWindow(PWINDOWTOCHANGETO, nullptr, preserveFocusHistory); - if (!PWINDOWTOCHANGETO->m_bPinned) + if (!PWINDOWTOCHANGETO->m_pinned) g_pCompositor->setWindowFullscreenInternal(PWINDOWTOCHANGETO, MODE); // warp the position + size animation, otherwise it looks weird. - PWINDOWTOCHANGETO->m_vRealPosition->warp(); - PWINDOWTOCHANGETO->m_vRealSize->warp(); + PWINDOWTOCHANGETO->m_realPosition->warp(); + PWINDOWTOCHANGETO->m_realSize->warp(); } else { updateRelativeCursorCoords(); g_pCompositor->focusWindow(PWINDOWTOCHANGETO, nullptr, preserveFocusHistory); @@ -416,9 +416,9 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF g_pInputManager->m_pForcedFocus.reset(); } - if (PLASTWINDOW && PLASTWINDOW->m_pMonitor != PWINDOWTOCHANGETO->m_pMonitor) { + if (PLASTWINDOW && PLASTWINDOW->m_monitor != PWINDOWTOCHANGETO->m_monitor) { // event - const auto PNEWMON = PWINDOWTOCHANGETO->m_pMonitor.lock(); + const auto PNEWMON = PWINDOWTOCHANGETO->m_monitor.lock(); g_pCompositor->setActiveMonitor(PNEWMON); } @@ -1133,33 +1133,33 @@ static SDispatchResult toggleActiveFloatingCore(std::string args, std::optional< if (!PWINDOW) return {.success = false, .error = "Window not found"}; - if (floatState.has_value() && floatState == PWINDOW->m_bIsFloating) + if (floatState.has_value() && floatState == PWINDOW->m_isFloating) return {}; // remove drag status if (!g_pInputManager->currentlyDraggedWindow.expired()) g_pKeybindManager->changeMouseBindMode(MBIND_INVALID); - if (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->m_sGroupData.pNextWindow.lock() != PWINDOW) { + if (PWINDOW->m_groupData.pNextWindow.lock() && PWINDOW->m_groupData.pNextWindow.lock() != PWINDOW) { const auto PCURRENT = PWINDOW->getGroupCurrent(); - PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating; + PCURRENT->m_isFloating = !PCURRENT->m_isFloating; g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT); - PHLWINDOW curr = PCURRENT->m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = PCURRENT->m_groupData.pNextWindow.lock(); while (curr != PCURRENT) { - curr->m_bIsFloating = PCURRENT->m_bIsFloating; - curr = curr->m_sGroupData.pNextWindow.lock(); + curr->m_isFloating = PCURRENT->m_isFloating; + curr = curr->m_groupData.pNextWindow.lock(); } } else { - PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating; + PWINDOW->m_isFloating = !PWINDOW->m_isFloating; g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW); } - if (PWINDOW->m_pWorkspace) { - PWINDOW->m_pWorkspace->updateWindows(); - PWINDOW->m_pWorkspace->updateWindowData(); + if (PWINDOW->m_workspace) { + PWINDOW->m_workspace->updateWindows(); + PWINDOW->m_workspace->updateWindowData(); } g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->monitorID()); @@ -1183,17 +1183,17 @@ SDispatchResult CKeybindManager::setActiveTiled(std::string args) { SDispatchResult CKeybindManager::centerWindow(std::string args) { const auto PWINDOW = g_pCompositor->m_lastWindow.lock(); - if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->isFullscreen()) + if (!PWINDOW || !PWINDOW->m_isFloating || PWINDOW->isFullscreen()) return {.success = false, .error = "No floating window found"}; - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); auto RESERVEDOFFSET = Vector2D(); if (args == "1") RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f; - *PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize->goal() / 2.f + RESERVEDOFFSET; - PWINDOW->m_vPosition = PWINDOW->m_vRealPosition->goal(); + *PWINDOW->m_realPosition = PMONITOR->middle() - PWINDOW->m_realSize->goal() / 2.f + RESERVEDOFFSET; + PWINDOW->m_position = PWINDOW->m_realPosition->goal(); return {}; } @@ -1209,7 +1209,7 @@ SDispatchResult CKeybindManager::toggleActivePseudo(std::string args) { if (!PWINDOW) return {.success = false, .error = "Window not found"}; - PWINDOW->m_bIsPseudotiled = !PWINDOW->m_bIsPseudotiled; + PWINDOW->m_isPseudotiled = !PWINDOW->m_isPseudotiled; if (!PWINDOW->isFullscreen()) g_pLayoutManager->getCurrentLayout()->recalculateWindow(PWINDOW); @@ -1362,7 +1362,7 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) { if (!PWINDOW) return {.success = false, .error = "Window not found"}; - PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP); + PWINDOW->m_windowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP); int internalMode, clientMode; try { @@ -1372,19 +1372,19 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) { clientMode = std::stoi(ARGS[1]); } catch (std::exception& e) { clientMode = -1; } - const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal), - .client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_sFullscreenState.client)}; + const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_fullscreenState.internal), + .client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_fullscreenState.client)}; - if (internalMode != -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client) + if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client) g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE}); - else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal) - g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client}); - else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client) - g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE}); + else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_fullscreenState.internal == STATE.internal) + g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client}); + else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_fullscreenState.client == STATE.client) + g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE}); else g_pCompositor->setWindowFullscreenState(PWINDOW, STATE); - PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_sFullscreenState.internal == PWINDOW->m_sFullscreenState.client, PRIORITY_SET_PROP); + PWINDOW->m_windowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_fullscreenState.internal == PWINDOW->m_fullscreenState.client, PRIORITY_SET_PROP); return {}; } @@ -1416,7 +1416,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) { auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID); PHLMONITOR pMonitor = nullptr; - const auto POLDWS = PWINDOW->m_pWorkspace; + const auto POLDWS = PWINDOW->m_workspace; static auto PALLOWWORKSPACECYCLES = CConfigValue("binds:allow_workspace_cycles"); updateRelativeCursorCoords(); @@ -1519,7 +1519,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); // Prioritize focus change within groups if the window is a part of it. - if (*PGROUPCYCLE && PLASTWINDOW->m_sGroupData.pNextWindow) { + if (*PGROUPCYCLE && PLASTWINDOW->m_groupData.pNextWindow) { auto isTheOnlyGroupOnWs = !PWINDOWTOCHANGETO && g_pCompositor->m_monitors.size() == 1; if (arg == 'l' && (PLASTWINDOW != PLASTWINDOW->getGroupHead() || isTheOnlyGroupOnWs)) { PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious()); @@ -1527,7 +1527,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { } else if (arg == 'r' && (PLASTWINDOW != PLASTWINDOW->getGroupTail() || isTheOnlyGroupOnWs)) { - PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_sGroupData.pNextWindow.lock()); + PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_groupData.pNextWindow.lock()); return {}; } } @@ -1549,15 +1549,15 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { Debug::log(LOG, "No monitor found in direction {}, getting the inverse edge", arg); - const auto PMONITOR = PLASTWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PLASTWINDOW->m_monitor.lock(); if (!PMONITOR) return {.success = false, .error = "last window has no monitor?"}; if (arg == 'l' || arg == 'r') { - if (STICKS(PLASTWINDOW->m_vPosition.x, PMONITOR->vecPosition.x) && STICKS(PLASTWINDOW->m_vSize.x, PMONITOR->vecSize.x)) + if (STICKS(PLASTWINDOW->m_position.x, PMONITOR->vecPosition.x) && STICKS(PLASTWINDOW->m_size.x, PMONITOR->vecSize.x)) return {.success = false, .error = "move does not make sense, would return back"}; - } else if (STICKS(PLASTWINDOW->m_vPosition.y, PMONITOR->vecPosition.y) && STICKS(PLASTWINDOW->m_vSize.y, PMONITOR->vecSize.y)) + } else if (STICKS(PLASTWINDOW->m_position.y, PMONITOR->vecPosition.y) && STICKS(PLASTWINDOW->m_size.y, PMONITOR->vecSize.y)) return {.success = false, .error = "move does not make sense, would return back"}; CBox box = PMONITOR->logicalBox(); @@ -1583,7 +1583,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { } const auto PWINDOWCANDIDATE = g_pCompositor->getWindowInDirection(box, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace, arg, - PLASTWINDOW, PLASTWINDOW->m_bIsFloating); + PLASTWINDOW, PLASTWINDOW->m_isFloating); if (PWINDOWCANDIDATE) switchToWindow(PWINDOWCANDIDATE); @@ -1675,21 +1675,21 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) { if (PLASTWINDOW->isFullscreen()) return {.success = false, .error = "Can't move fullscreen window"}; - if (PLASTWINDOW->m_bIsFloating) { + if (PLASTWINDOW->m_isFloating) { std::optional vPosx, vPosy; - const auto PMONITOR = PLASTWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PLASTWINDOW->m_monitor.lock(); const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize(); switch (arg) { case 'l': vPosx = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break; - case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break; + case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_realSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break; case 't': case 'u': vPosy = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break; case 'b': - case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break; + case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_realSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break; } - *PLASTWINDOW->m_vRealPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_vRealPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_vRealPosition->goal().y)); + *PLASTWINDOW->m_realPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_realPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_realPosition->goal().y)); return {}; } @@ -1732,7 +1732,7 @@ SDispatchResult CKeybindManager::toggleGroup(std::string args) { if (PWINDOW->isFullscreen()) g_pCompositor->setWindowFullscreenInternal(PWINDOW, FSMODE_NONE); - if (PWINDOW->m_sGroupData.pNextWindow.expired()) + if (PWINDOW->m_groupData.pNextWindow.expired()) PWINDOW->createGroup(); else PWINDOW->destroyGroup(); @@ -1746,10 +1746,10 @@ SDispatchResult CKeybindManager::changeGroupActive(std::string args) { if (!PWINDOW) return {.success = false, .error = "Window not found"}; - if (PWINDOW->m_sGroupData.pNextWindow.expired()) + if (PWINDOW->m_groupData.pNextWindow.expired()) return {.success = false, .error = "No next window in group"}; - if (PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW) + if (PWINDOW->m_groupData.pNextWindow.lock() == PWINDOW) return {.success = false, .error = "Only one window in group"}; if (isNumber(args, false)) { @@ -1765,7 +1765,7 @@ SDispatchResult CKeybindManager::changeGroupActive(std::string args) { } if (args != "b" && args != "prev") { - PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow.lock()); + PWINDOW->setGroupCurrent(PWINDOW->m_groupData.pNextWindow.lock()); } else { PWINDOW->setGroupCurrent(PWINDOW->getGroupPrevious()); } @@ -1780,7 +1780,7 @@ SDispatchResult CKeybindManager::toggleSplit(std::string args) { if (!header.pWindow) return {.success = false, .error = "Window not found"}; - const auto PWORKSPACE = header.pWindow->m_pWorkspace; + const auto PWORKSPACE = header.pWindow->m_workspace; if (PWORKSPACE->m_hasFullscreenWindow) return {.success = false, .error = "Can't split windows that already split"}; @@ -1797,7 +1797,7 @@ SDispatchResult CKeybindManager::swapSplit(std::string args) { if (!header.pWindow) return {.success = false, .error = "Window not found"}; - const auto PWORKSPACE = header.pWindow->m_pWorkspace; + const auto PWORKSPACE = header.pWindow->m_workspace; if (PWORKSPACE->m_hasFullscreenWindow) return {.success = false, .error = "Can't split windows that already split"}; @@ -1860,20 +1860,20 @@ SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) { switch (CORNER) { case 0: // bottom left - g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true); + g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y + PWINDOW->m_realSize->value().y}, true); break; case 1: // bottom right - g_pCompositor->warpCursorTo( - {PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true); + g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x + PWINDOW->m_realSize->value().x, PWINDOW->m_realPosition->value().y + PWINDOW->m_realSize->value().y}, + true); break; case 2: // top right - g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y}, true); + g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x + PWINDOW->m_realSize->value().x, PWINDOW->m_realPosition->value().y}, true); break; case 3: // top left - g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y}, true); + g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y}, true); break; } @@ -1923,10 +1923,10 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { // apply for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE) + if (!w->m_isMapped || w->m_workspace != PWORKSPACE) continue; - w->m_bIsPseudotiled = PWORKSPACE->m_defaultPseudo; + w->m_isPseudotiled = PWORKSPACE->m_defaultPseudo; } } else if (args == "allfloat") { PWORKSPACE->m_defaultFloating = !PWORKSPACE->m_defaultFloating; @@ -1936,21 +1936,21 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { std::vector ptrs(g_pCompositor->m_windows.begin(), g_pCompositor->m_windows.end()); for (auto const& w : ptrs) { - if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden()) + if (!w->m_isMapped || w->m_workspace != PWORKSPACE || w->isHidden()) continue; - if (!w->m_bRequestsFloat && w->m_bIsFloating != PWORKSPACE->m_defaultFloating) { - const auto SAVEDPOS = w->m_vRealPosition->goal(); - const auto SAVEDSIZE = w->m_vRealSize->goal(); + if (!w->m_requestsFloat && w->m_isFloating != PWORKSPACE->m_defaultFloating) { + const auto SAVEDPOS = w->m_realPosition->goal(); + const auto SAVEDSIZE = w->m_realSize->goal(); - w->m_bIsFloating = PWORKSPACE->m_defaultFloating; + w->m_isFloating = PWORKSPACE->m_defaultFloating; g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(w); if (PWORKSPACE->m_defaultFloating) { - w->m_vRealPosition->setValueAndWarp(SAVEDPOS); - w->m_vRealSize->setValueAndWarp(SAVEDSIZE); - *w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4); - *w->m_vRealPosition = w->m_vRealPosition->value() - Vector2D(2, 2); + w->m_realPosition->setValueAndWarp(SAVEDPOS); + w->m_realSize->setValueAndWarp(SAVEDSIZE); + *w->m_realSize = w->m_realSize->value() + Vector2D(4, 4); + *w->m_realPosition = w->m_realPosition->value() - Vector2D(2, 2); } } } @@ -2186,14 +2186,14 @@ SDispatchResult CKeybindManager::resizeActive(std::string args) { if (PLASTWINDOW->isFullscreen()) return {.success = false, .error = "Window is fullscreen"}; - const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealSize->goal()); + const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_realSize->goal()); if (SIZ.x < 1 || SIZ.y < 1) return {.success = false, .error = "Invalid size provided"}; - g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_vRealSize->goal()); + g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_realSize->goal()); - if (PLASTWINDOW->m_vRealSize->goal().x > 1 && PLASTWINDOW->m_vRealSize->goal().y > 1) + if (PLASTWINDOW->m_realSize->goal().x > 1 && PLASTWINDOW->m_realSize->goal().y > 1) PLASTWINDOW->setHidden(false); return {}; @@ -2208,9 +2208,9 @@ SDispatchResult CKeybindManager::moveActive(std::string args) { if (PLASTWINDOW->isFullscreen()) return {.success = false, .error = "Window is fullscreen"}; - const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealPosition->goal()); + const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_realPosition->goal()); - g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_vRealPosition->goal()); + g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_realPosition->goal()); return {}; } @@ -2230,9 +2230,9 @@ SDispatchResult CKeybindManager::moveWindow(std::string args) { if (PWINDOW->isFullscreen()) return {.success = false, .error = "Window is fullscreen"}; - const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealPosition->goal()); + const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_realPosition->goal()); - g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_vRealPosition->goal(), PWINDOW); + g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_realPosition->goal(), PWINDOW); return {}; } @@ -2252,14 +2252,14 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) { if (PWINDOW->isFullscreen()) return {.success = false, .error = "Window is fullscreen"}; - const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealSize->goal()); + const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_realSize->goal()); if (SIZ.x < 1 || SIZ.y < 1) return {.success = false, .error = "Invalid size provided"}; - g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_vRealSize->goal(), CORNER_NONE, PWINDOW); + g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_realSize->goal(), CORNER_NONE, PWINDOW); - if (PWINDOW->m_vRealSize->goal().x > 1 && PWINDOW->m_vRealSize->goal().y > 1) + if (PWINDOW->m_realSize->goal().x > 1 && PWINDOW->m_realSize->goal().y > 1) PWINDOW->setHidden(false); return {}; @@ -2303,9 +2303,9 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { if (!PWINDOW) return {.success = false, .error = "No such window found"}; - Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle); + Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_title); - const auto PWORKSPACE = PWINDOW->m_pWorkspace; + const auto PWORKSPACE = PWINDOW->m_workspace; if (!PWORKSPACE) { Debug::log(ERR, "BUG THIS: null workspace in focusWindow"); return {.success = false, .error = "BUG THIS: null workspace in focusWindow"}; @@ -2313,8 +2313,8 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { updateRelativeCursorCoords(); - if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_pWorkspace && - g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_pWorkspace) { + if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_workspace && + g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_workspace) { Debug::log(LOG, "Fake executing workspace to move focus"); changeworkspace(PWORKSPACE->getConfigName()); } @@ -2323,26 +2323,26 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { const auto FSWINDOW = PWORKSPACE->getFullscreenWindow(); const auto FSMODE = PWORKSPACE->m_fullscreenMode; - if (PWINDOW->m_bIsFloating) { + if (PWINDOW->m_isFloating) { // don't make floating implicitly fs - if (!PWINDOW->m_bCreatedOverFullscreen) { + if (!PWINDOW->m_createdOverFullscreen) { g_pCompositor->changeWindowZOrder(PWINDOW, true); g_pCompositor->updateFullscreenFadeOnWorkspace(PWORKSPACE); } g_pCompositor->focusWindow(PWINDOW); } else { - if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned) + if (FSWINDOW != PWINDOW && !PWINDOW->m_pinned) g_pCompositor->setWindowFullscreenClient(FSWINDOW, FSMODE_NONE); g_pCompositor->focusWindow(PWINDOW); - if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned) + if (FSWINDOW != PWINDOW && !PWINDOW->m_pinned) g_pCompositor->setWindowFullscreenClient(PWINDOW, FSMODE); // warp the position + size animation, otherwise it looks weird. - PWINDOW->m_vRealPosition->warp(); - PWINDOW->m_vRealSize->warp(); + PWINDOW->m_realPosition->warp(); + PWINDOW->m_realSize->warp(); } } else g_pCompositor->focusWindow(PWINDOW); @@ -2365,7 +2365,7 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) { if (PWINDOW && PWINDOW->m_tags.applyTag(vars[0])) { PWINDOW->updateDynamicRules(); - g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW->m_pSelf.lock()); + g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW->m_self.lock()); } return {}; @@ -2374,19 +2374,19 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) { SDispatchResult CKeybindManager::toggleSwallow(std::string args) { PHLWINDOWREF pWindow = g_pCompositor->m_lastWindow; - if (!valid(pWindow) || !valid(pWindow->m_pSwallowed)) + if (!valid(pWindow) || !valid(pWindow->m_swallowed)) return {}; - if (pWindow->m_pSwallowed->m_bCurrentlySwallowed) { + if (pWindow->m_swallowed->m_currentlySwallowed) { // Unswallow - pWindow->m_pSwallowed->m_bCurrentlySwallowed = false; - pWindow->m_pSwallowed->setHidden(false); - g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed.lock()); + pWindow->m_swallowed->m_currentlySwallowed = false; + pWindow->m_swallowed->setHidden(false); + g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_swallowed.lock()); } else { // Reswallow - pWindow->m_pSwallowed->m_bCurrentlySwallowed = true; - pWindow->m_pSwallowed->setHidden(true); - g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pSwallowed.lock()); + pWindow->m_swallowed->m_currentlySwallowed = true; + pWindow->m_swallowed->setHidden(true); + g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_swallowed.lock()); } return {}; @@ -2430,16 +2430,16 @@ SDispatchResult CKeybindManager::pass(std::string regexp) { return {.success = false, .error = "No kb in pass?"}; } - const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsX11; + const auto XWTOXW = PWINDOW->m_isX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isX11; const auto LASTMOUSESURF = g_pSeatManager->state.pointerFocus.lock(); const auto LASTKBSURF = g_pSeatManager->state.keyboardFocus.lock(); // pass all mf shit if (!XWTOXW) { if (g_pKeybindManager->m_uLastCode != 0) - g_pSeatManager->setKeyboardFocus(PWINDOW->m_pWLSurface->resource()); + g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource()); else - g_pSeatManager->setPointerFocus(PWINDOW->m_pWLSurface->resource(), {1, 1}); + g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1}); } g_pSeatManager->sendKeyboardMods(g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0); @@ -2471,7 +2471,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) { // Massive hack: // this will make g_pSeatManager NOT send the leave event to XWayland apps, provided we are not on an XWayland window already. // please kill me - if (PWINDOW->m_bIsX11) { + if (PWINDOW->m_isX11) { if (g_pKeybindManager->m_uLastCode != 0) { g_pSeatManager->state.keyboardFocus.reset(); g_pSeatManager->state.keyboardFocusResource.reset(); @@ -2481,7 +2481,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) { } } - const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal(); + const auto SL = PWINDOW->m_realPosition->goal() - g_pInputManager->getMouseCoordsInternal(); if (g_pKeybindManager->m_uLastCode != 0) g_pSeatManager->setKeyboardFocus(LASTKBSURF); @@ -2585,17 +2585,17 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { } if (!isMouse) - g_pSeatManager->setKeyboardFocus(PWINDOW->m_pWLSurface->resource()); + g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource()); else - g_pSeatManager->setPointerFocus(PWINDOW->m_pWLSurface->resource(), {1, 1}); + g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1}); } //copied the rest from pass and modified it // if wl -> xwl, activate destination - if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_bIsX11) - g_pXWaylandManager->activateSurface(PWINDOW->m_pWLSurface->resource(), true); + if (PWINDOW && PWINDOW->m_isX11 && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_isX11) + g_pXWaylandManager->activateSurface(PWINDOW->m_wlSurface->resource(), true); // if xwl -> xwl, send to current. Timing issues make this not work. - if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && g_pCompositor->m_lastWindow->m_bIsX11) + if (PWINDOW && PWINDOW->m_isX11 && g_pCompositor->m_lastWindow && g_pCompositor->m_lastWindow->m_isX11) PWINDOW = nullptr; g_pSeatManager->sendKeyboardMods(MOD, 0, 0, 0); @@ -2626,7 +2626,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { if (!PWINDOW) return {}; - if (PWINDOW->m_bIsX11) { //xwayland hack, see pass + if (PWINDOW->m_isX11) { //xwayland hack, see pass if (!isMouse) { g_pSeatManager->state.keyboardFocus.reset(); g_pSeatManager->state.keyboardFocusResource.reset(); @@ -2636,7 +2636,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { } } - const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal(); + const auto SL = PWINDOW->m_realPosition->goal() - g_pInputManager->getMouseCoordsInternal(); if (!isMouse) g_pSeatManager->setKeyboardFocus(LASTSURFACE); @@ -2704,8 +2704,8 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) { const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock(); const auto PLASTCYCLED = - validMapped(g_pCompositor->m_lastWindow->m_pLastCycledWindow) && g_pCompositor->m_lastWindow->m_pLastCycledWindow->m_pWorkspace == PLASTWINDOW->m_pWorkspace ? - g_pCompositor->m_lastWindow->m_pLastCycledWindow.lock() : + validMapped(g_pCompositor->m_lastWindow->m_lastCycledWindow) && g_pCompositor->m_lastWindow->m_lastCycledWindow->m_workspace == PLASTWINDOW->m_workspace ? + g_pCompositor->m_lastWindow->m_lastCycledWindow.lock() : nullptr; const bool NEED_PREV = arg == "last" || arg == "l" || arg == "prev" || arg == "p"; @@ -2717,7 +2717,7 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) { g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, toSwap); - PLASTWINDOW->m_pLastCycledWindow = toSwap; + PLASTWINDOW->m_lastCycledWindow = toSwap; g_pCompositor->focusWindow(PLASTWINDOW); @@ -2756,28 +2756,28 @@ SDispatchResult CKeybindManager::pinActive(std::string args) { return {.success = false, .error = "pin: window not found"}; } - if (!PWINDOW->m_bIsFloating || PWINDOW->isFullscreen()) + if (!PWINDOW->m_isFloating || PWINDOW->isFullscreen()) return {.success = false, .error = "Window does not qualify to be pinned"}; - PWINDOW->m_bPinned = !PWINDOW->m_bPinned; + PWINDOW->m_pinned = !PWINDOW->m_pinned; - const auto PMONITOR = PWINDOW->m_pMonitor.lock(); + const auto PMONITOR = PWINDOW->m_monitor.lock(); if (!PMONITOR) { Debug::log(ERR, "pin: monitor not found"); return {.success = false, .error = "pin: window not found"}; } - PWINDOW->m_pWorkspace = PMONITOR->activeWorkspace; + PWINDOW->m_workspace = PMONITOR->activeWorkspace; PWINDOW->updateDynamicRules(); g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); - const auto PWORKSPACE = PWINDOW->m_pWorkspace; + const auto PWORKSPACE = PWINDOW->m_workspace; PWORKSPACE->m_lastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS); - g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_bPinned)}); + g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_pinned)}); EMIT_HOOK_EVENT("pin", PWINDOW); return {}; @@ -2836,7 +2836,7 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE) } SDispatchResult CKeybindManager::bringActiveToTop(std::string args) { - if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating) + if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isFloating) g_pCompositor->changeWindowZOrder(g_pCompositor->m_lastWindow.lock(), true); return {}; @@ -2847,7 +2847,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) { const auto POSITION = args.substr(0, args.find_first_of(',')); auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX); - if (!PWINDOW && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating) + if (!PWINDOW && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isFloating) PWINDOW = g_pCompositor->m_lastWindow.lock(); if (!PWINDOW) { @@ -2889,17 +2889,17 @@ SDispatchResult CKeybindManager::lockActiveGroup(std::string args) { if (!PWINDOW) return {.success = false, .error = "No window found"}; - if (!PWINDOW->m_sGroupData.pNextWindow.lock()) + if (!PWINDOW->m_groupData.pNextWindow.lock()) return {.success = false, .error = "Not a group"}; const auto PHEAD = PWINDOW->getGroupHead(); if (args == "lock") - PHEAD->m_sGroupData.locked = true; + PHEAD->m_groupData.locked = true; else if (args == "toggle") - PHEAD->m_sGroupData.locked = !PHEAD->m_sGroupData.locked; + PHEAD->m_groupData.locked = !PHEAD->m_groupData.locked; else - PHEAD->m_sGroupData.locked = false; + PHEAD->m_groupData.locked = false; g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); @@ -2907,16 +2907,16 @@ SDispatchResult CKeybindManager::lockActiveGroup(std::string args) { } void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection) { - if (pWindow->m_sGroupData.deny) + if (pWindow->m_groupData.deny) return; updateRelativeCursorCoords(); g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property! - if (pWindow->m_pMonitor != pWindowInDirection->m_pMonitor) { - pWindow->moveToWorkspace(pWindowInDirection->m_pWorkspace); - pWindow->m_pMonitor = pWindowInDirection->m_pMonitor; + if (pWindow->m_monitor != pWindowInDirection->m_monitor) { + pWindow->moveToWorkspace(pWindowInDirection->m_workspace); + pWindow->m_monitor = pWindowInDirection->m_monitor; } static auto USECURRPOS = CConfigValue("group:insert_after_current"); @@ -2951,7 +2951,7 @@ void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& updateRelativeCursorCoords(); - if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow) { + if (pWindow->m_groupData.pNextWindow.lock() == pWindow) { pWindow->destroyGroup(); } else { g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); @@ -2990,16 +2990,16 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) { const auto PWINDOW = g_pCompositor->m_lastWindow.lock(); - if (!PWINDOW || PWINDOW->m_sGroupData.deny) + if (!PWINDOW || PWINDOW->m_groupData.deny) return {}; auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg); - if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow.lock()) + if (!PWINDOWINDIR || !PWINDOWINDIR->m_groupData.pNextWindow.lock()) return {}; // Do not move window into locked group if binds:ignore_group_lock is false - if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->getGroupHead()->m_sGroupData.locked))) + if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_groupData.locked || (PWINDOW->m_groupData.pNextWindow.lock() && PWINDOW->getGroupHead()->m_groupData.locked))) return {}; moveWindowIntoGroup(PWINDOW, PWINDOWINDIR); @@ -3023,7 +3023,7 @@ SDispatchResult CKeybindManager::moveOutOfGroup(std::string args) { if (!PWINDOW) return {.success = false, .error = "No window found"}; - if (!PWINDOW->m_sGroupData.pNextWindow.lock()) + if (!PWINDOW->m_groupData.pNextWindow.lock()) return {.success = false, .error = "Window not in a group"}; moveWindowOutOfGroup(PWINDOW); @@ -3055,21 +3055,21 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) { const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg); - const bool ISWINDOWGROUP = PWINDOW->m_sGroupData.pNextWindow; - const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_sGroupData.locked; - const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW; + const bool ISWINDOWGROUP = PWINDOW->m_groupData.pNextWindow; + const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_groupData.locked; + const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_groupData.pNextWindow.lock() == PWINDOW; updateRelativeCursorCoords(); - // note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating - if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow) { // target is group - if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) { + // note: PWINDOWINDIR is not null implies !PWINDOW->m_isFloating + if (PWINDOWINDIR && PWINDOWINDIR->m_groupData.pNextWindow) { // target is group + if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_groupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_groupData.deny)) { g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); PWINDOW->warpCursor(); } else moveWindowIntoGroup(PWINDOW, PWINDOWINDIR); } else if (PWINDOWINDIR) { // target is regular window - if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_eGroupRules & GROUP_SET_ALWAYS)) { + if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & GROUP_SET_ALWAYS)) { g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); PWINDOW->warpCursor(); } else @@ -3101,13 +3101,13 @@ SDispatchResult CKeybindManager::setIgnoreGroupLock(std::string args) { SDispatchResult CKeybindManager::denyWindowFromGroup(std::string args) { const auto PWINDOW = g_pCompositor->m_lastWindow.lock(); - if (!PWINDOW || (PWINDOW && PWINDOW->m_sGroupData.pNextWindow.lock())) + if (!PWINDOW || (PWINDOW && PWINDOW->m_groupData.pNextWindow.lock())) return {}; if (args == "toggle") - PWINDOW->m_sGroupData.deny = !PWINDOW->m_sGroupData.deny; + PWINDOW->m_groupData.deny = !PWINDOW->m_groupData.deny; else - PWINDOW->m_sGroupData.deny = args == "on"; + PWINDOW->m_groupData.deny = args == "on"; g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); @@ -3137,14 +3137,14 @@ SDispatchResult CKeybindManager::moveGroupWindow(std::string args) { if (!PLASTWINDOW) return {.success = false, .error = "No window found"}; - if (!PLASTWINDOW->m_sGroupData.pNextWindow.lock()) + if (!PLASTWINDOW->m_groupData.pNextWindow.lock()) return {.success = false, .error = "Window not in a group"}; - if ((!BACK && PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.head) || (BACK && PLASTWINDOW->m_sGroupData.head)) { - std::swap(PLASTWINDOW->m_sGroupData.head, PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.head); - std::swap(PLASTWINDOW->m_sGroupData.locked, PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.locked); + if ((!BACK && PLASTWINDOW->m_groupData.pNextWindow->m_groupData.head) || (BACK && PLASTWINDOW->m_groupData.head)) { + std::swap(PLASTWINDOW->m_groupData.head, PLASTWINDOW->m_groupData.pNextWindow->m_groupData.head); + std::swap(PLASTWINDOW->m_groupData.locked, PLASTWINDOW->m_groupData.pNextWindow->m_groupData.locked); } else - PLASTWINDOW->switchWithWindowInGroup(BACK ? PLASTWINDOW->getGroupPrevious() : PLASTWINDOW->m_sGroupData.pNextWindow.lock()); + PLASTWINDOW->switchWithWindowInGroup(BACK ? PLASTWINDOW->getGroupPrevious() : PLASTWINDOW->m_groupData.pNextWindow.lock()); PLASTWINDOW->updateWindowDecos(); @@ -3174,36 +3174,36 @@ SDispatchResult CKeybindManager::setProp(std::string args) { const auto PROP = vars[1]; const auto VAL = vars[2]; - bool noFocus = PWINDOW->m_sWindowData.noFocus.valueOrDefault(); + bool noFocus = PWINDOW->m_windowData.noFocus.valueOrDefault(); try { if (PROP == "animationstyle") { - PWINDOW->m_sWindowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP); + PWINDOW->m_windowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP); } else if (PROP == "maxsize") { - PWINDOW->m_sWindowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP); - PWINDOW->clampWindowSize(std::nullopt, PWINDOW->m_sWindowData.maxSize.value()); + PWINDOW->m_windowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP); + PWINDOW->clampWindowSize(std::nullopt, PWINDOW->m_windowData.maxSize.value()); PWINDOW->setHidden(false); } else if (PROP == "minsize") { - PWINDOW->m_sWindowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP); - PWINDOW->clampWindowSize(PWINDOW->m_sWindowData.minSize.value(), std::nullopt); + PWINDOW->m_windowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP); + PWINDOW->clampWindowSize(PWINDOW->m_windowData.minSize.value(), std::nullopt); PWINDOW->setHidden(false); } else if (PROP == "alpha") { - PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alpha.valueOrDefault().override}, PRIORITY_SET_PROP); } else if (PROP == "alphainactive") { - PWINDOW->m_sWindowData.alphaInactive = - CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alphaInactive = + CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alphaInactive.valueOrDefault().override}, PRIORITY_SET_PROP); } else if (PROP == "alphafullscreen") { - PWINDOW->m_sWindowData.alphaFullscreen = - CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alphaFullscreen = + CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().override}, PRIORITY_SET_PROP); } else if (PROP == "alphaoverride") { - PWINDOW->m_sWindowData.alpha = - CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alpha = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alpha.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); } else if (PROP == "alphainactiveoverride") { - PWINDOW->m_sWindowData.alphaInactive = - CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alphaInactive = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaInactive.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); } else if (PROP == "alphafullscreenoverride") { - PWINDOW->m_sWindowData.alphaFullscreen = - CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); + PWINDOW->m_windowData.alphaFullscreen = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP); } else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") { CGradientValueData colorData = {}; if (vars.size() > 4) { @@ -3226,9 +3226,9 @@ SDispatchResult CKeybindManager::setProp(std::string args) { colorData.updateColorsOk(); if (PROP == "activebordercolor") - PWINDOW->m_sWindowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); + PWINDOW->m_windowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); else - PWINDOW->m_sWindowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); + PWINDOW->m_windowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); } else if (auto search = NWindowProperties::boolWindowProperties.find(PROP); search != NWindowProperties::boolWindowProperties.end()) { auto pWindowDataElement = search->second(PWINDOW); if (VAL == "toggle") @@ -3261,7 +3261,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) { g_pCompositor->updateAllWindowsAnimatedDecorationValues(); - if (!(PWINDOW->m_sWindowData.noFocus.valueOrDefault() == noFocus)) { + if (!(PWINDOW->m_windowData.noFocus.valueOrDefault() == noFocus)) { g_pCompositor->focusWindow(nullptr); g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PLASTWINDOW); diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 61820fe5..c5cf77f5 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -21,7 +21,7 @@ CHyprXWaylandManager::~CHyprXWaylandManager() { } SP CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) { - return pWindow ? pWindow->m_pWLSurface->resource() : nullptr; + return pWindow ? pWindow->m_wlSurface->resource() : nullptr; } void CHyprXWaylandManager::activateSurface(SP pSurface, bool activate) { @@ -40,41 +40,41 @@ void CHyprXWaylandManager::activateSurface(SP pSurface, bool return; } - if (PWINDOW->m_bIsX11) { - if (PWINDOW->m_pXWaylandSurface) { + if (PWINDOW->m_isX11) { + if (PWINDOW->m_xwaylandSurface) { if (activate) { - PWINDOW->m_pXWaylandSurface->setMinimized(false); - PWINDOW->m_pXWaylandSurface->restackToTop(); + PWINDOW->m_xwaylandSurface->setMinimized(false); + PWINDOW->m_xwaylandSurface->restackToTop(); } - PWINDOW->m_pXWaylandSurface->activate(activate); + PWINDOW->m_xwaylandSurface->activate(activate); } - } else if (PWINDOW->m_pXDGSurface && PWINDOW->m_pXDGSurface->toplevel) - PWINDOW->m_pXDGSurface->toplevel->setActive(activate); + } else if (PWINDOW->m_xdgSurface && PWINDOW->m_xdgSurface->toplevel) + PWINDOW->m_xdgSurface->toplevel->setActive(activate); } void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) { - if (pWindow->m_bIsX11) { + if (pWindow->m_isX11) { if (activate) { pWindow->sendWindowSize(true); // update xwayland output pos - pWindow->m_pXWaylandSurface->setMinimized(false); + pWindow->m_xwaylandSurface->setMinimized(false); if (!pWindow->isX11OverrideRedirect()) - pWindow->m_pXWaylandSurface->restackToTop(); + pWindow->m_xwaylandSurface->restackToTop(); } - pWindow->m_pXWaylandSurface->activate(activate); + pWindow->m_xwaylandSurface->activate(activate); - } else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel) - pWindow->m_pXDGSurface->toplevel->setActive(activate); + } else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel) + pWindow->m_xdgSurface->toplevel->setActive(activate); if (activate) { g_pCompositor->m_lastFocus = getWindowSurface(pWindow); g_pCompositor->m_lastWindow = pWindow; } - if (!pWindow->m_bPinned) - pWindow->m_pWorkspace->m_lastFocusedWindow = pWindow; + if (!pWindow->m_pinned) + pWindow->m_workspace->m_lastFocusedWindow = pWindow; } CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) { @@ -83,52 +83,52 @@ CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) { CBox box; - if (pWindow->m_bIsX11) - box = pWindow->m_pXWaylandSurface->geometry; - else if (pWindow->m_pXDGSurface) - box = pWindow->m_pXDGSurface->current.geometry; + if (pWindow->m_isX11) + box = pWindow->m_xwaylandSurface->geometry; + else if (pWindow->m_xdgSurface) + box = pWindow->m_xdgSurface->current.geometry; return box; } void CHyprXWaylandManager::sendCloseWindow(PHLWINDOW pWindow) { - if (pWindow->m_bIsX11) - pWindow->m_pXWaylandSurface->close(); - else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel) - pWindow->m_pXDGSurface->toplevel->close(); + if (pWindow->m_isX11) + pWindow->m_xwaylandSurface->close(); + else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel) + pWindow->m_xdgSurface->toplevel->close(); } bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) { - if (pWindow->m_bIsX11) { - for (const auto& a : pWindow->m_pXWaylandSurface->atoms) + if (pWindow->m_isX11) { + for (const auto& a : pWindow->m_xwaylandSurface->atoms) if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || a == HYPRATOMS["_KDE_NET_WM_WINDOW_TYPE_OVERRIDE"]) { if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"]) - pWindow->m_bX11ShouldntFocus = true; + pWindow->m_X11ShouldntFocus = true; if (a != HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"]) - pWindow->m_bNoInitialFocus = true; + pWindow->m_noInitialFocus = true; return true; } - if (pWindow->isModal() || pWindow->m_pXWaylandSurface->transient || - (pWindow->m_pXWaylandSurface->role.contains("task_dialog") || pWindow->m_pXWaylandSurface->role.contains("pop-up")) || pWindow->m_pXWaylandSurface->overrideRedirect) + if (pWindow->isModal() || pWindow->m_xwaylandSurface->transient || + (pWindow->m_xwaylandSurface->role.contains("task_dialog") || pWindow->m_xwaylandSurface->role.contains("pop-up")) || pWindow->m_xwaylandSurface->overrideRedirect) return true; - const auto SIZEHINTS = pWindow->m_pXWaylandSurface->sizeHints.get(); - if (pWindow->m_pXWaylandSurface->transient || pWindow->m_pXWaylandSurface->parent || + const auto SIZEHINTS = pWindow->m_xwaylandSurface->sizeHints.get(); + if (pWindow->m_xwaylandSurface->transient || pWindow->m_xwaylandSurface->parent || (SIZEHINTS && (SIZEHINTS->min_width == SIZEHINTS->max_width) && (SIZEHINTS->min_height == SIZEHINTS->max_height))) return true; } else { - if (!pWindow->m_pXDGSurface || !pWindow->m_pXDGSurface->toplevel) + if (!pWindow->m_xdgSurface || !pWindow->m_xdgSurface->toplevel) return false; - const auto PSTATE = pending ? &pWindow->m_pXDGSurface->toplevel->pending : &pWindow->m_pXDGSurface->toplevel->current; - if (pWindow->m_pXDGSurface->toplevel->parent || + const auto PSTATE = pending ? &pWindow->m_xdgSurface->toplevel->pending : &pWindow->m_xdgSurface->toplevel->current; + if (pWindow->m_xdgSurface->toplevel->parent || (PSTATE->minSize.x != 0 && PSTATE->minSize.y != 0 && (PSTATE->minSize.x == PSTATE->maxSize.x || PSTATE->minSize.y == PSTATE->maxSize.y))) return true; } @@ -137,31 +137,31 @@ bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) { } void CHyprXWaylandManager::checkBorders(PHLWINDOW pWindow) { - if (!pWindow->m_bIsX11) + if (!pWindow->m_isX11) return; - for (auto const& a : pWindow->m_pXWaylandSurface->atoms) { + for (auto const& a : pWindow->m_xwaylandSurface->atoms) { if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) { - pWindow->m_bX11DoesntWantBorders = true; + pWindow->m_X11DoesntWantBorders = true; return; } } if (pWindow->isX11OverrideRedirect()) - pWindow->m_bX11DoesntWantBorders = true; + pWindow->m_X11DoesntWantBorders = true; } void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscreen) { if (!pWindow) return; - if (pWindow->m_bIsX11) - pWindow->m_pXWaylandSurface->setFullscreen(fullscreen); - else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel) - pWindow->m_pXDGSurface->toplevel->setFullscreen(fullscreen); + if (pWindow->m_isX11) + pWindow->m_xwaylandSurface->setFullscreen(fullscreen); + else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel) + pWindow->m_xdgSurface->toplevel->setFullscreen(fullscreen); } Vector2D CHyprXWaylandManager::waylandToXWaylandCoords(const Vector2D& coord) { diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp index f0050381..2ca0f4d6 100644 --- a/src/managers/input/IdleInhibitor.cpp +++ b/src/managers/input/IdleInhibitor.cpp @@ -61,13 +61,13 @@ void CInputManager::recheckIdleInhibitorStatus() { } bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) { - if (w->m_eIdleInhibitMode == IDLEINHIBIT_ALWAYS) + if (w->m_idleInhibitMode == IDLEINHIBIT_ALWAYS) return true; - if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w)) + if (w->m_idleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w)) return true; - if (w->m_eIdleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->isFullscreen() && w->m_pWorkspace && w->m_pWorkspace->isVisible()) + if (w->m_idleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->isFullscreen() && w->m_workspace && w->m_workspace->isVisible()) return true; if (onlyHl) @@ -78,7 +78,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) { continue; bool isInhibiting = false; - w->m_pWLSurface->resource()->breadthfirst( + w->m_wlSurface->resource()->breadthfirst( [&ii](SP surf, const Vector2D& pos, void* data) { if (ii->inhibitor->surface != surf) return; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 58ae6e93..319196ee 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -157,7 +157,7 @@ void CInputManager::sendMotionEventsToFocused() { const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock()); - const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{})); + const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_realPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{})); m_bEmptyFocusCursorSet = false; @@ -233,7 +233,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { const auto RG = CONSTRAINT->logicConstraintRegion(); const auto CLOSEST = RG.closestPoint(mouseCoords); const auto BOX = SURF->getSurfaceBoxGlobal(); - const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_fX11SurfaceScaledBy : 1.0); + const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_X11SurfaceScaledBy : 1.0); g_pCompositor->warpCursorTo(CLOSEST, true); g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL); @@ -283,8 +283,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (forcedFocus) { pFoundWindow = forcedFocus; - surfacePos = pFoundWindow->m_vRealPosition->value(); - foundSurface = pFoundWindow->m_pWLSurface->resource(); + surfacePos = pFoundWindow->m_realPosition->value(); + foundSurface = pFoundWindow->m_wlSurface->resource(); } // if we are holding a pointer button, @@ -363,16 +363,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { } if (PWINDOWIDEAL && - ((PWINDOWIDEAL->m_bIsFloating && PWINDOWIDEAL->m_bCreatedOverFullscreen) /* floating over fullscreen */ - || (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_pWorkspace) /* on an open special workspace */)) + ((PWINDOWIDEAL->m_isFloating && PWINDOWIDEAL->m_createdOverFullscreen) /* floating over fullscreen */ + || (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */)) pFoundWindow = PWINDOWIDEAL; - if (!pFoundWindow->m_bIsX11) { + if (!pFoundWindow->m_isX11) { foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords); surfacePos = Vector2D(-1337, -1337); } else { - foundSurface = pFoundWindow->m_pWLSurface->resource(); - surfacePos = pFoundWindow->m_vRealPosition->value(); + foundSurface = pFoundWindow->m_wlSurface->resource(); + surfacePos = pFoundWindow->m_realPosition->value(); } } @@ -398,7 +398,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (pFoundWindow != PWINDOWIDEAL) pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); - if (!(pFoundWindow && pFoundWindow->m_bIsFloating && pFoundWindow->m_bCreatedOverFullscreen)) + if (!(pFoundWindow && pFoundWindow->m_isFloating && pFoundWindow->m_createdOverFullscreen)) pFoundWindow = PWORKSPACE->getFullscreenWindow(); } } @@ -410,15 +410,15 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { } if (pFoundWindow) { - if (!pFoundWindow->m_bIsX11) { + if (!pFoundWindow->m_isX11) { foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords); if (!foundSurface) { - foundSurface = pFoundWindow->m_pWLSurface->resource(); - surfacePos = pFoundWindow->m_vRealPosition->value(); + foundSurface = pFoundWindow->m_wlSurface->resource(); + surfacePos = pFoundWindow->m_realPosition->value(); } } else { - foundSurface = pFoundWindow->m_pWLSurface->resource(); - surfacePos = pFoundWindow->m_vRealPosition->value(); + foundSurface = pFoundWindow->m_wlSurface->resource(); + surfacePos = pFoundWindow->m_realPosition->value(); } } } @@ -483,15 +483,15 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : mouseCoords - surfacePos; - if (pFoundWindow && !pFoundWindow->m_bIsX11 && surfacePos != Vector2D(-1337, -1337)) { + if (pFoundWindow && !pFoundWindow->m_isX11 && surfacePos != Vector2D(-1337, -1337)) { // calc for oversized windows... fucking bullshit. - CBox geom = pFoundWindow->m_pXDGSurface->current.geometry; + CBox geom = pFoundWindow->m_xdgSurface->current.geometry; surfaceLocal = mouseCoords - surfacePos + geom.pos(); } - if (pFoundWindow && pFoundWindow->m_bIsX11) // for x11 force scale zero - surfaceLocal = surfaceLocal * pFoundWindow->m_fX11SurfaceScaledBy; + if (pFoundWindow && pFoundWindow->m_isX11) // for x11 force scale zero + surfaceLocal = surfaceLocal * pFoundWindow->m_X11SurfaceScaledBy; bool allowKeyboardRefocus = true; @@ -514,7 +514,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { return; } - if (pFoundWindow && foundSurface == pFoundWindow->m_pWLSurface->resource() && !m_bCursorImageOverridden) { + if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_bCursorImageOverridden) { const auto BOX = pFoundWindow->getWindowMainSurfaceBox(); if (!VECINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height)) setCursorImageOverride("left_ptr"); @@ -534,7 +534,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (FOLLOWMOUSE != 1 && !refocus) { if (pFoundWindow != g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow.lock() && - ((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) { + ((pFoundWindow->m_isFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_isFloating != pFoundWindow->m_isFloating && *PFLOATBEHAVIOR != 0))) { // enter if change floating style if (FOLLOWMOUSE != 3 && allowKeyboardRefocus) g_pCompositor->focusWindow(pFoundWindow, foundSurface); @@ -562,7 +562,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { // Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit. if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow) { if (m_fMousePosDelta > *PFOLLOWMOUSETHRESHOLD || refocus) { - const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_sWindowData.noFollowMouse.valueOrDefault(); + const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_windowData.noFollowMouse.valueOrDefault(); if (refocus || !hasNoFollowMouse) g_pCompositor->focusWindow(pFoundWindow, foundSurface); @@ -746,7 +746,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) { // TODO detect click on LS properly if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e.state == WL_POINTER_BUTTON_STATE_PRESSED && (!w || !w->isX11OverrideRedirect())) { if (w && !w->isFullscreen()) { - const CBox real = {w->m_vRealPosition->value().x, w->m_vRealPosition->value().y, w->m_vRealSize->value().x, w->m_vRealSize->value().y}; + const CBox real = {w->m_realPosition->value().x, w->m_realPosition->value().y, w->m_realSize->value().x, w->m_realSize->value().y}; const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA}; if ((grab.containsPoint(mouseCoords) && (!real.containsPoint(mouseCoords) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y))) && !w->hasPopupAt(mouseCoords)) { @@ -1482,7 +1482,7 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { foundSurface = nullptr; } - if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pWorkspace && g_pCompositor->m_lastWindow->m_pWorkspace->isVisibleNotCovered()) { + if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_workspace && g_pCompositor->m_lastWindow->m_workspace->isVisibleNotCovered()) { // then the last focused window if we're on the same workspace as it const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock(); g_pCompositor->focusWindow(PLASTWINDOW); @@ -1779,7 +1779,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) { } // ignore X11 OR windows, they shouldn't be touched - if (w->m_bIsX11 && w->isX11OverrideRedirect()) + if (w->m_isX11 && w->isX11OverrideRedirect()) return; static auto PEXTENDBORDERGRAB = CConfigValue("general:extend_border_grab_area"); @@ -1802,7 +1802,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) { bool onDeco = false; - for (auto const& wd : w->m_dWindowDecorations) { + for (auto const& wd : w->m_windowDecorations) { if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)) continue; diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index a543e228..5cbfed46 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -69,12 +69,12 @@ static void refocusTablet(SP tab, SP tool, bool motion = f // yes, this technically ignores any regions set by the app. Too bad! if (LASTHLSURFACE->getWindow()) - local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_vRealSize->goal(); + local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal(); else local = tool->absolutePos * BOX->size(); - if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_bIsX11) - local = local * LASTHLSURFACE->getWindow()->m_fX11SurfaceScaledBy; + if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11) + local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy; PROTO::tablet->motion(tool, local); return; @@ -82,8 +82,8 @@ static void refocusTablet(SP tab, SP tool, bool motion = f auto local = CURSORPOS - BOX->pos(); - if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_bIsX11) - local = local * LASTHLSURFACE->getWindow()->m_fX11SurfaceScaledBy; + if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11) + local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy; PROTO::tablet->motion(tool, local); } diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index a5d53029..71fd27d8 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -80,9 +80,9 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition; m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } else if (!m_sTouchData.touchFocusWindow.expired()) { - if (m_sTouchData.touchFocusWindow->m_bIsX11) { - local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition->goal()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy; - m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition->goal(); + if (m_sTouchData.touchFocusWindow->m_isX11) { + local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_realPosition->goal()) * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy; + m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_realPosition->goal(); } else { g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local); m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; @@ -148,13 +148,13 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); } else if (validMapped(m_sTouchData.touchFocusWindow)) { - const auto PMONITOR = m_sTouchData.touchFocusWindow->m_pMonitor.lock(); + const auto PMONITOR = m_sTouchData.touchFocusWindow->m_monitor.lock(); g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; - if (m_sTouchData.touchFocusWindow->m_bIsX11) - local = local * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy; + if (m_sTouchData.touchFocusWindow->m_isX11) + local = local * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); } else if (!m_sTouchData.touchFocusLS.expired()) { diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp index 523ae7cf..2bca8eb4 100644 --- a/src/plugins/PluginAPI.cpp +++ b/src/plugins/PluginAPI.cpp @@ -131,7 +131,7 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor return false; for (auto const& w : g_pCompositor->m_windows) { - for (auto const& d : w->m_dWindowDecorations) { + for (auto const& d : w->m_windowDecorations) { if (d.get() == pDecoration) { w->removeWindowDeco(pDecoration); return true; diff --git a/src/protocols/ForeignToplevel.cpp b/src/protocols/ForeignToplevel.cpp index e6c026d6..843e8b94 100644 --- a/src/protocols/ForeignToplevel.cpp +++ b/src/protocols/ForeignToplevel.cpp @@ -60,8 +60,8 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) { LOGM(LOG, "Newly mapped window gets an identifier of {}", IDENTIFIER); resource->sendToplevel(NEWHANDLE->resource.get()); NEWHANDLE->resource->sendIdentifier(IDENTIFIER.c_str()); - NEWHANDLE->resource->sendAppId(pWindow->m_szInitialClass.c_str()); - NEWHANDLE->resource->sendTitle(pWindow->m_szInitialTitle.c_str()); + NEWHANDLE->resource->sendAppId(pWindow->m_initialClass.c_str()); + NEWHANDLE->resource->sendTitle(pWindow->m_initialTitle.c_str()); NEWHANDLE->resource->sendDone(); handles.push_back(NEWHANDLE); @@ -81,7 +81,7 @@ void CForeignToplevelList::onTitle(PHLWINDOW pWindow) { if UNLIKELY (!H || H->closed) return; - H->resource->sendTitle(pWindow->m_szTitle.c_str()); + H->resource->sendTitle(pWindow->m_title.c_str()); H->resource->sendDone(); } @@ -93,7 +93,7 @@ void CForeignToplevelList::onClass(PHLWINDOW pWindow) { if UNLIKELY (!H || H->closed) return; - H->resource->sendAppId(pWindow->m_szClass.c_str()); + H->resource->sendAppId(pWindow->m_class.c_str()); H->resource->sendDone(); } diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index f1f32d7e..089c414b 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -32,11 +32,11 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_eSuppressedEvents & SUPPRESS_FULLSCREEN) + if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN) return; - if UNLIKELY (!PWINDOW->m_bIsMapped) { - PWINDOW->m_bWantsInitialFullscreen = true; + if UNLIKELY (!PWINDOW->m_isMapped) { + PWINDOW->m_wantsInitialFullscreen = true; return; } @@ -46,7 +46,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_pWorkspace != monitor->activeWorkspace) { + if (PWINDOW->m_workspace != monitor->activeWorkspace) { g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->activeWorkspace); g_pCompositor->setActiveMonitor(monitor); } @@ -63,7 +63,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_eSuppressedEvents & SUPPRESS_FULLSCREEN) + if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_FULLSCREEN) return; g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_FULLSCREEN, false); @@ -75,11 +75,11 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_eSuppressedEvents & SUPPRESS_MAXIMIZE) + if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE) return; - if UNLIKELY (!PWINDOW->m_bIsMapped) { - PWINDOW->m_bWantsInitialFullscreen = true; + if UNLIKELY (!PWINDOW->m_isMapped) { + PWINDOW->m_wantsInitialFullscreen = true; return; } @@ -92,7 +92,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_eSuppressedEvents & SUPPRESS_MAXIMIZE) + if UNLIKELY (PWINDOW->m_suppressedEvents & SUPPRESS_MAXIMIZE) return; g_pCompositor->changeWindowFullscreenModeClient(PWINDOW, FSMODE_MAXIMIZED, false); @@ -104,7 +104,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_bIsMapped) + if UNLIKELY (!PWINDOW->m_isMapped) return; g_pEventManager->postEvent(SHyprIPCEvent{.event = "minimized", .data = std::format("{:x},1", (uintptr_t)PWINDOW.get())}); @@ -116,7 +116,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_bIsMapped) + if UNLIKELY (!PWINDOW->m_isMapped) return; g_pEventManager->postEvent(SHyprIPCEvent{.event = "minimized", .data = std::format("{:x},0", (uintptr_t)PWINDOW.get())}); @@ -170,7 +170,7 @@ void CForeignToplevelHandleWlr::sendMonitor(PHLMONITOR pMonitor) { void CForeignToplevelHandleWlr::sendState() { const auto PWINDOW = pWindow.lock(); - if UNLIKELY (!PWINDOW || !PWINDOW->m_pWorkspace || !PWINDOW->m_bIsMapped) + if UNLIKELY (!PWINDOW || !PWINDOW->m_workspace || !PWINDOW->m_isMapped) return; wl_array state; @@ -233,9 +233,9 @@ void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) { LOGM(LOG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get()); resource->sendToplevel(NEWHANDLE->resource.get()); - NEWHANDLE->resource->sendAppId(pWindow->m_szClass.c_str()); - NEWHANDLE->resource->sendTitle(pWindow->m_szTitle.c_str()); - if LIKELY (const auto PMONITOR = pWindow->m_pMonitor.lock(); PMONITOR) + NEWHANDLE->resource->sendAppId(pWindow->m_class.c_str()); + NEWHANDLE->resource->sendTitle(pWindow->m_title.c_str()); + if LIKELY (const auto PMONITOR = pWindow->m_monitor.lock(); PMONITOR) NEWHANDLE->sendMonitor(PMONITOR); NEWHANDLE->sendState(); NEWHANDLE->resource->sendDone(); @@ -257,7 +257,7 @@ void CForeignToplevelWlrManager::onTitle(PHLWINDOW pWindow) { if UNLIKELY (!H || H->closed) return; - H->resource->sendTitle(pWindow->m_szTitle.c_str()); + H->resource->sendTitle(pWindow->m_title.c_str()); H->resource->sendDone(); } @@ -269,7 +269,7 @@ void CForeignToplevelWlrManager::onClass(PHLWINDOW pWindow) { if UNLIKELY (!H || H->closed) return; - H->resource->sendAppId(pWindow->m_szClass.c_str()); + H->resource->sendAppId(pWindow->m_class.c_str()); H->resource->sendDone(); } @@ -294,7 +294,7 @@ void CForeignToplevelWlrManager::onMoveMonitor(PHLWINDOW pWindow) { if UNLIKELY (!H || H->closed) return; - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); if UNLIKELY (!PMONITOR) return; diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index 4744fec4..d42ddf41 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -499,7 +499,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() { PHLMONITOR mon; auto HLSurface = CWLSurface::fromResource(feedback->surface); if (auto w = HLSurface->getWindow(); w) - if (auto m = w->m_pMonitor.lock(); m) + if (auto m = w->m_monitor.lock(); m) mon = m->self.lock(); if (!mon) { diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp index c25dfdee..ed24a5fe 100644 --- a/src/protocols/PointerConstraints.cpp +++ b/src/protocols/PointerConstraints.cpp @@ -36,8 +36,8 @@ CPointerConstraint::CPointerConstraint(SP resource_, SPgetWindow(); if (PWINDOW) { - const auto ISXWL = PWINDOW->m_bIsX11; - scale = ISXWL && *PXWLFORCESCALEZERO ? PWINDOW->m_fX11SurfaceScaledBy : 1.f; + const auto ISXWL = PWINDOW->m_isX11; + scale = ISXWL && *PXWLFORCESCALEZERO ? PWINDOW->m_X11SurfaceScaledBy : 1.f; } positionHint = {wl_fixed_to_double(x) / scale, wl_fixed_to_double(y) / scale}; diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp index 61669107..b9219f72 100644 --- a/src/protocols/ShortcutsInhibit.cpp +++ b/src/protocols/ShortcutsInhibit.cpp @@ -71,7 +71,7 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() { if (!g_pCompositor->m_lastFocus) return false; - if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault()) + if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_windowData.noShortcutsInhibit.valueOrDefault()) return false; for (auto const& in : m_vInhibitors) { diff --git a/src/protocols/TearingControl.cpp b/src/protocols/TearingControl.cpp index f78d365e..a6036690 100644 --- a/src/protocols/TearingControl.cpp +++ b/src/protocols/TearingControl.cpp @@ -54,7 +54,7 @@ CTearingControl::CTearingControl(SP resource_, SPsetSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); }); for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWLSurface->resource() == surf_) { + if (w->m_wlSurface->resource() == surf_) { pWindow = w; break; } @@ -70,7 +70,7 @@ void CTearingControl::updateWindow() { if UNLIKELY (pWindow.expired()) return; - pWindow->m_bTearingHint = hint == WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC; + pWindow->m_tearingHint = hint == WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC; } bool CTearingControl::good() { diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index fc0dc9d5..51ad8f5d 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -86,7 +86,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP re return; } - if UNLIKELY (!pWindow->m_bIsMapped) { + if UNLIKELY (!pWindow->m_isMapped) { LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable!", pWindow); resource->sendFailed(); return; @@ -96,7 +96,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP re resource->setDestroy([this](CHyprlandToplevelExportFrameV1* pFrame) { PROTO::toplevelExport->destroyResource(this); }); resource->setCopy([this](CHyprlandToplevelExportFrameV1* pFrame, wl_resource* res, int32_t ignoreDamage) { this->copy(pFrame, res, ignoreDamage); }); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); g_pHyprRenderer->makeEGLCurrent(); @@ -116,7 +116,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP re dmabufFormat = PMONITOR->output->state->state().drmFormat; - box = {0, 0, (int)(pWindow->m_vRealSize->value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize->value().y * PMONITOR->scale)}; + box = {0, 0, (int)(pWindow->m_realSize->value().x * PMONITOR->scale), (int)(pWindow->m_realSize->value().y * PMONITOR->scale)}; box.transform(wlTransformToHyprutils(PMONITOR->transform), PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y).round(); @@ -142,7 +142,7 @@ void CToplevelExportFrame::copy(CHyprlandToplevelExportFrameV1* pFrame, wl_resou return; } - if UNLIKELY (!pWindow->m_bIsMapped) { + if UNLIKELY (!pWindow->m_isMapped) { LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", pWindow); resource->sendFailed(); return; @@ -235,7 +235,7 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) { auto [pixelData, fmt, bufLen] = buffer->beginDataPtr(0); // no need for end, cuz it's shm // render the client - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); CRegion fakeDamage{0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10}; g_pHyprRenderer->makeEGLCurrent(); @@ -262,7 +262,7 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) { g_pHyprRenderer->m_bBlockSurfaceFeedback = false; if (overlayCursor) - g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value()); + g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value()); } else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) { CBox texbox = CBox{PMONITOR->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F); @@ -329,7 +329,7 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) { bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) { const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(resource->client(), PERMISSION_TYPE_SCREENCOPY); - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX}; @@ -350,7 +350,7 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) { g_pHyprRenderer->m_bBlockSurfaceFeedback = false; if (overlayCursor) - g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value()); + g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value()); } else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) { CBox texbox = CBox{PMONITOR->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F); @@ -445,10 +445,10 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) { const auto PWINDOW = f->pWindow; - if (pMonitor != PWINDOW->m_pMonitor.lock()) + if (pMonitor != PWINDOW->m_monitor.lock()) continue; - CBox geometry = {PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y, PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealSize->value().y}; + CBox geometry = {PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y, PWINDOW->m_realSize->value().x, PWINDOW->m_realSize->value().y}; if (geometry.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty()) continue; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index bc606c8d..a6ddb519 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1533,7 +1533,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP tex, const CB } } - if (m_RenderData.currentWindow && m_RenderData.currentWindow->m_sWindowData.RGBX.valueOrDefault()) { + if (m_RenderData.currentWindow && m_RenderData.currentWindow->m_windowData.RGBX.valueOrDefault()) { shader = &m_shaders->m_shRGBX; texType = TEXTURE_RGBX; } @@ -1628,9 +1628,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP tex, const CB const auto DIM = m_RenderData.currentWindow->m_notRespondingTint->value(); glUniform1i(shader->applyTint, 1); glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM); - } else if (m_RenderData.currentWindow->m_fDimPercent->value() > 0) { + } else if (m_RenderData.currentWindow->m_dimPercent->value() > 0) { glUniform1i(shader->applyTint, 1); - const auto DIM = m_RenderData.currentWindow->m_fDimPercent->value(); + const auto DIM = m_RenderData.currentWindow->m_dimPercent->value(); glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM); } else glUniform1i(shader->applyTint, 0); @@ -2054,16 +2054,16 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) { if (!pWindow) return false; - if (pWindow->m_sWindowData.noBlur.valueOrDefault()) + if (pWindow->m_windowData.noBlur.valueOrDefault()) return false; - if (pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_fillIgnoreSmall) + if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall) return true; - const auto PSURFACE = pWindow->m_pWLSurface->resource(); + const auto PSURFACE = pWindow->m_wlSurface->resource(); - const auto PWORKSPACE = pWindow->m_pWorkspace; - const float A = pWindow->m_fAlpha->value() * pWindow->m_fActiveInactiveAlpha->value() * PWORKSPACE->m_alpha->value(); + const auto PWORKSPACE = pWindow->m_workspace; + const float A = pWindow->m_alpha->value() * pWindow->m_activeInactiveAlpha->value() * PWORKSPACE->m_alpha->value(); if (A >= 1.f) { // if (PSURFACE->opaque) @@ -2084,7 +2084,7 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) { bool hasWindows = false; for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) { + if (w->m_workspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_isMapped && (!w->m_isFloating || *PBLURXRAY)) { // check if window is valid if (!windowShouldBeBlurred(w)) @@ -2170,16 +2170,16 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWin if (!m_RenderData.pCurrentMonData->blurFB.getTexture()) return false; - if (pWindow && pWindow->m_sWindowData.xray.hasValue() && !pWindow->m_sWindowData.xray.valueOrDefault()) + if (pWindow && pWindow->m_windowData.xray.hasValue() && !pWindow->m_windowData.xray.valueOrDefault()) return false; if (pLayer && pLayer->m_xray == 0) return false; - if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY) + if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_isFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY) return true; - if ((pLayer && pLayer->m_xray == 1) || (pWindow && pWindow->m_sWindowData.xray.valueOrDefault())) + if ((pLayer && pLayer->m_xray == 1) || (pWindow && pWindow->m_windowData.xray.valueOrDefault())) return true; return false; @@ -2303,7 +2303,7 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr TRACY_GPU_ZONE("RenderBorder"); - if (m_RenderData.damage.empty() || (m_RenderData.currentWindow && m_RenderData.currentWindow->m_sWindowData.noBorder.valueOrDefault())) + if (m_RenderData.damage.empty() || (m_RenderData.currentWindow && m_RenderData.currentWindow->m_windowData.noBorder.valueOrDefault())) return; CBox newBox = box; @@ -2401,7 +2401,7 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr TRACY_GPU_ZONE("RenderBorder2"); - if (m_RenderData.damage.empty() || (m_RenderData.currentWindow && m_RenderData.currentWindow->m_sWindowData.noBorder.valueOrDefault())) + if (m_RenderData.damage.empty() || (m_RenderData.currentWindow && m_RenderData.currentWindow->m_windowData.noBorder.valueOrDefault())) return; CBox newBox = box; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index fd231027..813aec08 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -143,18 +143,18 @@ CHyprRenderer::CHyprRenderer() { continue; } - if (!w->m_pWLSurface || !w->m_pWLSurface->resource() || shouldRenderWindow(w.lock())) + if (!w->m_wlSurface || !w->m_wlSurface->resource() || shouldRenderWindow(w.lock())) continue; - w->m_pWLSurface->resource()->frame(Time::steadyNow()); - auto FEEDBACK = makeShared(w->m_pWLSurface->resource()); + w->m_wlSurface->resource()->frame(Time::steadyNow()); + auto FEEDBACK = makeShared(w->m_wlSurface->resource()); FEEDBACK->attachMonitor(g_pCompositor->m_lastMonitor.lock()); FEEDBACK->discarded(); PROTO::presentation->queueData(FEEDBACK); } if (dirty) - std::erase_if(m_vRenderUnfocused, [](const auto& e) { return !e || !e->m_sWindowData.renderUnfocused.valueOr(false); }); + std::erase_if(m_vRenderUnfocused, [](const auto& e) { return !e || !e->m_windowData.renderUnfocused.valueOr(false); }); if (!m_vRenderUnfocused.empty()) m_tRenderUnfocusedTimer->updateTimeout(std::chrono::milliseconds(1000 / *PFPS)); @@ -173,52 +173,51 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor) { if (!pWindow->visibleOnMonitor(pMonitor)) return false; - if (!pWindow->m_pWorkspace && !pWindow->m_bFadingOut) + if (!pWindow->m_workspace && !pWindow->m_fadingOut) return false; - if (!pWindow->m_pWorkspace && pWindow->m_bFadingOut) + if (!pWindow->m_workspace && pWindow->m_fadingOut) return pWindow->workspaceID() == pMonitor->activeWorkspaceID(); - if (pWindow->m_bPinned) + if (pWindow->m_pinned) return true; // if the window is being moved to a workspace that is not invisible, and the alpha is > 0.F, render it. - if (pWindow->m_iMonitorMovedFrom != -1 && pWindow->m_fMovingToWorkspaceAlpha->isBeingAnimated() && pWindow->m_fMovingToWorkspaceAlpha->value() > 0.F && pWindow->m_pWorkspace && - !pWindow->m_pWorkspace->isVisible()) + if (pWindow->m_monitorMovedFrom != -1 && pWindow->m_movingToWorkspaceAlpha->isBeingAnimated() && pWindow->m_movingToWorkspaceAlpha->value() > 0.F && pWindow->m_workspace && + !pWindow->m_workspace->isVisible()) return true; - const auto PWINDOWWORKSPACE = pWindow->m_pWorkspace; + const auto PWINDOWWORKSPACE = pWindow->m_workspace; if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_monitor == pMonitor) { if (PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() || PWINDOWWORKSPACE->m_alpha->isBeingAnimated() || PWINDOWWORKSPACE->m_forceRendering) return true; // if hidden behind fullscreen - if (PWINDOWWORKSPACE->m_hasFullscreenWindow && !pWindow->isFullscreen() && (!pWindow->m_bIsFloating || !pWindow->m_bCreatedOverFullscreen) && - pWindow->m_fAlpha->value() == 0) + if (PWINDOWWORKSPACE->m_hasFullscreenWindow && !pWindow->isFullscreen() && (!pWindow->m_isFloating || !pWindow->m_createdOverFullscreen) && pWindow->m_alpha->value() == 0) return false; if (!PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOWWORKSPACE->m_alpha->isBeingAnimated() && !PWINDOWWORKSPACE->isVisible()) return false; } - if (pWindow->m_pMonitor == pMonitor) + if (pWindow->m_monitor == pMonitor) return true; - if ((!pWindow->m_pWorkspace || !pWindow->m_pWorkspace->isVisible()) && pWindow->m_pMonitor != pMonitor) + if ((!pWindow->m_workspace || !pWindow->m_workspace->isVisible()) && pWindow->m_monitor != pMonitor) return false; // if not, check if it maybe is active on a different monitor. - if (pWindow->m_pWorkspace && pWindow->m_pWorkspace->isVisible() && pWindow->m_bIsFloating /* tiled windows can't be multi-ws */) + if (pWindow->m_workspace && pWindow->m_workspace->isVisible() && pWindow->m_isFloating /* tiled windows can't be multi-ws */) return !pWindow->isFullscreen(); // Do not draw fullscreen windows on other monitors - if (pMonitor->activeSpecialWorkspace == pWindow->m_pWorkspace) + if (pMonitor->activeSpecialWorkspace == pWindow->m_workspace) return true; // if window is tiled and it's flying in, don't render on other mons (for slide) - if (!pWindow->m_bIsFloating && pWindow->m_vRealPosition->isBeingAnimated() && pWindow->m_bAnimatingIn && pWindow->m_pMonitor != pMonitor) + if (!pWindow->m_isFloating && pWindow->m_realPosition->isBeingAnimated() && pWindow->m_animatingIn && pWindow->m_monitor != pMonitor) return false; - if (pWindow->m_vRealPosition->isBeingAnimated()) { + if (pWindow->m_realPosition->isBeingAnimated()) { if (PWINDOWWORKSPACE && !PWINDOWWORKSPACE->m_isSpecialWorkspace && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated()) return false; // render window if window and monitor intersect @@ -226,10 +225,10 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor) { CBox windowBox = pWindow->getFullWindowBoundingBox(); if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated()) windowBox.translate(PWINDOWWORKSPACE->m_renderOffset->value()); - windowBox.translate(pWindow->m_vFloatingOffset); + windowBox.translate(pWindow->m_floatingOffset); const CBox monitorBox = {pMonitor->vecPosition, pMonitor->vecSize}; - if (!windowBox.intersection(monitorBox).empty() && (pWindow->workspaceID() == pMonitor->activeWorkspaceID() || pWindow->m_iMonitorMovedFrom != -1)) + if (!windowBox.intersection(monitorBox).empty() && (pWindow->workspaceID() == pMonitor->activeWorkspaceID() || pWindow->m_monitorMovedFrom != -1)) return true; } @@ -241,12 +240,12 @@ bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow) { if (!validMapped(pWindow)) return false; - const auto PWORKSPACE = pWindow->m_pWorkspace; + const auto PWORKSPACE = pWindow->m_workspace; - if (!pWindow->m_pWorkspace) + if (!pWindow->m_workspace) return false; - if (pWindow->m_bPinned || PWORKSPACE->m_forceRendering) + if (pWindow->m_pinned || PWORKSPACE->m_forceRendering) return true; if (PWORKSPACE && PWORKSPACE->isVisible()) @@ -273,10 +272,10 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR if (!shouldRenderWindow(w, pMonitor)) continue; - if (w->m_fAlpha->value() == 0.f) + if (w->m_alpha->value() == 0.f) continue; - if (w->isFullscreen() || w->m_bIsFloating) + if (w->isFullscreen() || w->m_isFloating) continue; if (pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) @@ -290,16 +289,16 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR if (!shouldRenderWindow(w, pMonitor)) continue; - if (w->m_fAlpha->value() == 0.f) + if (w->m_alpha->value() == 0.f) continue; - if (w->isFullscreen() || !w->m_bIsFloating) + if (w->isFullscreen() || !w->m_isFloating) continue; - if (w->m_pMonitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) + if (w->m_monitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; - if (pWorkspace->m_isSpecialWorkspace && w->m_pMonitor != pWorkspace->m_monitor) + if (pWorkspace->m_isSpecialWorkspace && w->m_monitor != pWorkspace->m_monitor) continue; // special on another are rendered as a part of the base pass renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL); @@ -307,26 +306,26 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR // TODO: this pass sucks for (auto const& w : g_pCompositor->m_windows) { - const auto PWORKSPACE = w->m_pWorkspace; + const auto PWORKSPACE = w->m_workspace; - if (w->m_pWorkspace != pWorkspace || !w->isFullscreen()) { + if (w->m_workspace != pWorkspace || !w->isFullscreen()) { if (!(PWORKSPACE && (PWORKSPACE->m_renderOffset->isBeingAnimated() || PWORKSPACE->m_alpha->isBeingAnimated() || PWORKSPACE->m_forceRendering))) continue; - if (w->m_pMonitor != pMonitor) + if (w->m_monitor != pMonitor) continue; } if (!w->isFullscreen()) continue; - if (w->m_pMonitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) + if (w->m_monitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; if (shouldRenderWindow(w, pMonitor)) renderWindow(w, pMonitor, time, pWorkspace->m_fullscreenMode != FSMODE_FULLSCREEN, RENDER_PASS_ALL); - if (w->m_pWorkspace != pWorkspace) + if (w->m_workspace != pWorkspace) continue; pWorkspaceWindow = w; @@ -340,14 +339,14 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(PHLMONITOR pMonitor, PHLWOR // then render windows over fullscreen. for (auto const& w : g_pCompositor->m_windows) { - if (w->m_pWorkspace != pWorkspaceWindow->m_pWorkspace || !w->m_bIsFloating || (!w->m_bCreatedOverFullscreen && !w->m_bPinned) || (!w->m_bIsMapped && !w->m_bFadingOut) || + if (w->m_workspace != pWorkspaceWindow->m_workspace || !w->m_isFloating || (!w->m_createdOverFullscreen && !w->m_pinned) || (!w->m_isMapped && !w->m_fadingOut) || w->isFullscreen()) continue; - if (w->m_pMonitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) + if (w->m_monitor == pWorkspace->m_monitor && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; - if (pWorkspace->m_isSpecialWorkspace && w->m_pMonitor != pWorkspace->m_monitor) + if (pWorkspace->m_isSpecialWorkspace && w->m_monitor != pWorkspace->m_monitor) continue; // special on another are rendered as a part of the base pass renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL); @@ -363,7 +362,7 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo windows.reserve(g_pCompositor->m_windows.size()); for (auto const& w : g_pCompositor->m_windows) { - if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut)) + if (w->isHidden() || (!w->m_isMapped && !w->m_fadingOut)) continue; if (!shouldRenderWindow(w, pMonitor)) @@ -374,11 +373,11 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo // Non-floating main for (auto& w : windows) { - if (w->m_bIsFloating) + if (w->m_isFloating) continue; // floating are in the second pass // some things may force us to ignore the special/not special disparity - const bool IGNORE_SPECIAL_CHECK = w->m_iMonitorMovedFrom != -1 && (w->m_pWorkspace && !w->m_pWorkspace->isVisible()); + const bool IGNORE_SPECIAL_CHECK = w->m_monitorMovedFrom != -1 && (w->m_workspace && !w->m_workspace->isVisible()); if (!IGNORE_SPECIAL_CHECK && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; @@ -390,7 +389,7 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo } // render tiled fading out after others - if (w->m_bFadingOut) { + if (w->m_fadingOut) { tiledFadingOut.emplace_back(w); w.reset(); continue; @@ -416,11 +415,11 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo if (!w) continue; - if (w->m_bIsFloating) + if (w->m_isFloating) continue; // floating are in the second pass // some things may force us to ignore the special/not special disparity - const bool IGNORE_SPECIAL_CHECK = w->m_iMonitorMovedFrom != -1 && (w->m_pWorkspace && !w->m_pWorkspace->isVisible()); + const bool IGNORE_SPECIAL_CHECK = w->m_monitorMovedFrom != -1 && (w->m_workspace && !w->m_workspace->isVisible()); if (!IGNORE_SPECIAL_CHECK && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; @@ -435,16 +434,16 @@ void CHyprRenderer::renderWorkspaceWindows(PHLMONITOR pMonitor, PHLWORKSPACE pWo if (!w) continue; - if (!w->m_bIsFloating || w->m_bPinned) + if (!w->m_isFloating || w->m_pinned) continue; // some things may force us to ignore the special/not special disparity - const bool IGNORE_SPECIAL_CHECK = w->m_iMonitorMovedFrom != -1 && (w->m_pWorkspace && !w->m_pWorkspace->isVisible()); + const bool IGNORE_SPECIAL_CHECK = w->m_monitorMovedFrom != -1 && (w->m_workspace && !w->m_workspace->isVisible()); if (!IGNORE_SPECIAL_CHECK && pWorkspace->m_isSpecialWorkspace != w->onSpecialWorkspace()) continue; - if (pWorkspace->m_isSpecialWorkspace && w->m_pMonitor != pWorkspace->m_monitor) + if (pWorkspace->m_isSpecialWorkspace && w->m_monitor != pWorkspace->m_monitor) continue; // special on another are rendered as a part of the base pass // render the bad boy @@ -456,24 +455,24 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T if (pWindow->isHidden() && !standalone) return; - if (pWindow->m_bFadingOut) { - if (pMonitor == pWindow->m_pMonitor) // TODO: fix this + if (pWindow->m_fadingOut) { + if (pMonitor == pWindow->m_monitor) // TODO: fix this renderSnapshot(pWindow); return; } - if (!pWindow->m_bIsMapped) + if (!pWindow->m_isMapped) return; TRACY_GPU_ZONE("RenderWindow"); - const auto PWORKSPACE = pWindow->m_pWorkspace; - const auto REALPOS = pWindow->m_vRealPosition->value() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_renderOffset->value()); + const auto PWORKSPACE = pWindow->m_workspace; + const auto REALPOS = pWindow->m_realPosition->value() + (pWindow->m_pinned ? Vector2D{} : PWORKSPACE->m_renderOffset->value()); static auto PDIMAROUND = CConfigValue("decoration:dim_around"); static auto PBLUR = CConfigValue("decoration:blur:enabled"); CSurfacePassElement::SRenderData renderdata = {pMonitor, time}; - CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize->value().x, 5.0), std::max(pWindow->m_vRealSize->value().y, 5.0)}; + CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_realSize->value().x, 5.0), std::max(pWindow->m_realSize->value().y, 5.0)}; renderdata.pos.x = textureBox.x; renderdata.pos.y = textureBox.y; @@ -495,15 +494,15 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T decorate = false; // whether to use m_fMovingToWorkspaceAlpha, only if fading out into an invisible ws - const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_iMonitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible()); - const bool DONT_BLUR = pWindow->m_sWindowData.noBlur.valueOrDefault() || pWindow->m_sWindowData.RGBX.valueOrDefault() || pWindow->opaque(); + const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_monitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible()); + const bool DONT_BLUR = pWindow->m_windowData.noBlur.valueOrDefault() || pWindow->m_windowData.RGBX.valueOrDefault() || pWindow->opaque(); - renderdata.surface = pWindow->m_pWLSurface->resource(); - renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || pWindow->m_sWindowData.noRounding.valueOrDefault(); - renderdata.fadeAlpha = pWindow->m_fAlpha->value() * (pWindow->m_bPinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) * - (USE_WORKSPACE_FADE_ALPHA ? pWindow->m_fMovingToWorkspaceAlpha->value() : 1.F) * pWindow->m_fMovingFromWorkspaceAlpha->value(); - renderdata.alpha = pWindow->m_fActiveInactiveAlpha->value(); - renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && !pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN); + renderdata.surface = pWindow->m_wlSurface->resource(); + renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || pWindow->m_windowData.noRounding.valueOrDefault(); + renderdata.fadeAlpha = pWindow->m_alpha->value() * (pWindow->m_pinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) * + (USE_WORKSPACE_FADE_ALPHA ? pWindow->m_movingToWorkspaceAlpha->value() : 1.F) * pWindow->m_movingFromWorkspaceAlpha->value(); + renderdata.alpha = pWindow->m_activeInactiveAlpha->value(); + renderdata.decorate = decorate && !pWindow->m_X11DoesntWantBorders && !pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN); renderdata.rounding = standalone || renderdata.dontRound ? 0 : pWindow->rounding() * pMonitor->scale; renderdata.roundingPower = standalone || renderdata.dontRound ? 2.0f : pWindow->roundingPower(); renderdata.blur = !standalone && *PBLUR && !DONT_BLUR; @@ -515,14 +514,14 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T } // apply opaque - if (pWindow->m_sWindowData.opaque.valueOrDefault()) + if (pWindow->m_windowData.opaque.valueOrDefault()) renderdata.alpha = 1.f; renderdata.pWindow = pWindow; EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOW); - if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.valueOrDefault() && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) { + if (*PDIMAROUND && pWindow->m_windowData.dimAround.valueOrDefault() && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) { CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y}; CRectPassElement::SRectData data; data.color = CHyprColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha); @@ -530,38 +529,37 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T m_sRenderPass.add(makeShared(data)); } - renderdata.pos.x += pWindow->m_vFloatingOffset.x; - renderdata.pos.y += pWindow->m_vFloatingOffset.y; + renderdata.pos.x += pWindow->m_floatingOffset.x; + renderdata.pos.y += pWindow->m_floatingOffset.y; // if window is floating and we have a slide animation, clip it to its full bb - if (!ignorePosition && pWindow->m_bIsFloating && !pWindow->isFullscreen() && PWORKSPACE->m_renderOffset->isBeingAnimated() && !pWindow->m_bPinned) { - CRegion rg = - pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition + PWORKSPACE->m_renderOffset->value() + pWindow->m_vFloatingOffset).scale(pMonitor->scale); + if (!ignorePosition && pWindow->m_isFloating && !pWindow->isFullscreen() && PWORKSPACE->m_renderOffset->isBeingAnimated() && !pWindow->m_pinned) { + CRegion rg = pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition + PWORKSPACE->m_renderOffset->value() + pWindow->m_floatingOffset).scale(pMonitor->scale); renderdata.clipBox = rg.getExtents(); } // render window decorations first, if not fullscreen full if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) { - const bool TRANSFORMERSPRESENT = !pWindow->m_vTransformers.empty(); + const bool TRANSFORMERSPRESENT = !pWindow->m_transformers.empty(); if (TRANSFORMERSPRESENT) { g_pHyprOpenGL->bindOffMain(); - for (auto const& t : pWindow->m_vTransformers) { + for (auto const& t : pWindow->m_transformers) { t->preWindowRender(&renderdata); } } if (renderdata.decorate) { - for (auto const& wd : pWindow->m_dWindowDecorations) { + for (auto const& wd : pWindow->m_windowDecorations) { if (wd->getDecorationLayer() != DECORATION_LAYER_BOTTOM) continue; wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha); } - for (auto const& wd : pWindow->m_dWindowDecorations) { + for (auto const& wd : pWindow->m_windowDecorations) { if (wd->getDecorationLayer() != DECORATION_LAYER_UNDER) continue; @@ -570,10 +568,10 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T } static auto PXWLUSENN = CConfigValue("xwayland:use_nearest_neighbor"); - if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sWindowData.nearestNeighbor.valueOrDefault()) + if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_windowData.nearestNeighbor.valueOrDefault()) renderdata.useNearestNeighbor = true; - if (!pWindow->m_sWindowData.noBlur.valueOrDefault() && pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_fillIgnoreSmall && renderdata.blur && *PBLUR) { + if (!pWindow->m_windowData.noBlur.valueOrDefault() && pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall && renderdata.blur && *PBLUR) { CBox wb = {renderdata.pos.x - pMonitor->vecPosition.x, renderdata.pos.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; wb.scale(pMonitor->scale).round(); CRectPassElement::SRectData data; @@ -588,12 +586,12 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T } renderdata.surfaceCounter = 0; - pWindow->m_pWLSurface->resource()->breadthfirst( + pWindow->m_wlSurface->resource()->breadthfirst( [this, &renderdata, &pWindow](SP s, const Vector2D& offset, void* data) { renderdata.localPos = offset; renderdata.texture = s->current.texture; renderdata.surface = s; - renderdata.mainSurface = s == pWindow->m_pWLSurface->resource(); + renderdata.mainSurface = s == pWindow->m_wlSurface->resource(); m_sRenderPass.add(makeShared(renderdata)); renderdata.surfaceCounter++; }, @@ -602,7 +600,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T renderdata.useNearestNeighbor = false; if (renderdata.decorate) { - for (auto const& wd : pWindow->m_dWindowDecorations) { + for (auto const& wd : pWindow->m_windowDecorations) { if (wd->getDecorationLayer() != DECORATION_LAYER_OVER) continue; @@ -612,7 +610,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T if (TRANSFORMERSPRESENT) { CFramebuffer* last = g_pHyprOpenGL->m_RenderData.currentFB; - for (auto const& t : pWindow->m_vTransformers) { + for (auto const& t : pWindow->m_transformers) { last = t->transform(last); } @@ -624,8 +622,8 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T g_pHyprOpenGL->m_RenderData.clipBox = CBox(); if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_POPUP) { - if (!pWindow->m_bIsX11) { - CBox geom = pWindow->m_pXDGSurface->current.geometry; + if (!pWindow->m_isX11) { + CBox geom = pWindow->m_xdgSurface->current.geometry; renderdata.pos -= geom.pos(); renderdata.dontRound = true; // don't round popups @@ -643,12 +641,12 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T renderdata.discardOpacity = *PBLURIGNOREA; } - if (pWindow->m_sWindowData.nearestNeighbor.valueOrDefault()) + if (pWindow->m_windowData.nearestNeighbor.valueOrDefault()) renderdata.useNearestNeighbor = true; renderdata.surfaceCounter = 0; - pWindow->m_pPopupHead->breadthfirst( + pWindow->m_popupHead->breadthfirst( [this, &renderdata](WP popup, void* data) { if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped) return; @@ -673,7 +671,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T } if (decorate) { - for (auto const& wd : pWindow->m_dWindowDecorations) { + for (auto const& wd : pWindow->m_windowDecorations) { if (wd->getDecorationLayer() != DECORATION_LAYER_OVERLAY) continue; @@ -950,10 +948,10 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA // pinned always above for (auto const& w : g_pCompositor->m_windows) { - if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) + if (w->isHidden() && !w->m_isMapped && !w->m_fadingOut) continue; - if (!w->m_bPinned || !w->m_bIsFloating) + if (!w->m_pinned || !w->m_isFloating) continue; if (!shouldRenderWindow(w, pMonitor)) @@ -1049,7 +1047,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) { void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP pSurface, PHLMONITOR pMonitor, bool main, const Vector2D& projSize, const Vector2D& projSizeUnscaled, bool fixMisalignedFSV1) { - if (!pWindow || !pWindow->m_bIsX11) { + if (!pWindow || !pWindow->m_isX11) { static auto PEXPANDEDGES = CConfigValue("render:expand_undersized_textures"); Vector2D uvTL; @@ -1109,7 +1107,7 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SPm_pXDGSurface->current.geometry; + CBox geom = pWindow->m_xdgSurface->current.geometry; // ignore X and Y, adjust uv if (geom.x != 0 || geom.y != 0 || geom.width > projSizeUnscaled.x || geom.height > projSizeUnscaled.y) { @@ -1124,8 +1122,8 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SPm_pWLSurface->small() && !pWindow->m_pWLSurface->m_fillIgnoreSmall) - maxSize = pWindow->m_pWLSurface->getViewporterCorrectedSize(); + if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall) + maxSize = pWindow->m_wlSurface->getViewporterCorrectedSize(); if (geom.width > maxSize.x) uvBR.x = uvBR.x * (maxSize.x / geom.width); @@ -1500,7 +1498,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) { bool hdrIsHandled = false; if (*PPASS && pMonitor->activeWorkspace && pMonitor->activeWorkspace->m_hasFullscreenWindow && pMonitor->activeWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN) { const auto WINDOW = pMonitor->activeWorkspace->getFullscreenWindow(); - const auto ROOT_SURF = WINDOW->m_pWLSurface->resource(); + const auto ROOT_SURF = WINDOW->m_wlSurface->resource(); const auto SURF = ROOT_SURF->findFirstPreorder([ROOT_SURF](SP surf) { return surf->colorManagement.valid() && surf->extends() == ROOT_SURF->extends(); }); @@ -1609,13 +1607,13 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now) { for (auto const& w : g_pCompositor->m_windows) { - if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || !w->m_pWLSurface->resource()) + if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->m_wlSurface->resource()) continue; if (!shouldRenderWindow(w, pMonitor)) continue; - w->m_pWLSurface->resource()->breadthfirst([now](SP r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr); + w->m_wlSurface->resource()->breadthfirst([now](SP r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr); } for (auto const& lsl : pMonitor->m_aLayerSurfaceLayers) { @@ -1886,10 +1884,10 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) { return; CBox windowBox = pWindow->getFullWindowBoundingBox(); - const auto PWINDOWWORKSPACE = pWindow->m_pWorkspace; - if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !pWindow->m_bPinned) + const auto PWINDOWWORKSPACE = pWindow->m_workspace; + if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !pWindow->m_pinned) windowBox.translate(PWINDOWWORKSPACE->m_renderOffset->value()); - windowBox.translate(pWindow->m_vFloatingOffset); + windowBox.translate(pWindow->m_floatingOffset); for (auto const& m : g_pCompositor->m_monitors) { if (forceFull || shouldRenderWindow(pWindow, m)) { // only damage if window is rendered on monitor @@ -1899,13 +1897,13 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) { } } - for (auto const& wd : pWindow->m_dWindowDecorations) + for (auto const& wd : pWindow->m_windowDecorations) wd->damageEntire(); static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); if (*PLOGDAMAGE) - Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_szTitle, windowBox.x, windowBox.y, windowBox.width, windowBox.height); + Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_title, windowBox.x, windowBox.y, windowBox.width, windowBox.height); } void CHyprRenderer::damageMonitor(PHLMONITOR pMonitor) { @@ -2148,8 +2146,8 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) { if (!PCANDIDATE->opaque()) return; - if (PCANDIDATE->m_vRealSize->value() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition->value() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition->isBeingAnimated() || - PCANDIDATE->m_vRealSize->isBeingAnimated()) + if (PCANDIDATE->m_realSize->value() != pMonitor->vecSize || PCANDIDATE->m_realPosition->value() != pMonitor->vecPosition || PCANDIDATE->m_realPosition->isBeingAnimated() || + PCANDIDATE->m_realSize->isBeingAnimated()) return; if (!pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty()) @@ -2161,10 +2159,10 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) { } for (auto const& w : g_pCompositor->m_windows) { - if (w == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden()) + if (w == PCANDIDATE || (!w->m_isMapped && !w->m_fadingOut) || w->isHidden()) continue; - if (w->m_pWorkspace == PCANDIDATE->m_pWorkspace && w->m_bIsFloating && w->m_bCreatedOverFullscreen && w->visibleOnMonitor(pMonitor)) + if (w->m_workspace == PCANDIDATE->m_workspace && w->m_isFloating && w->m_createdOverFullscreen && w->visibleOnMonitor(pMonitor)) return; } @@ -2173,7 +2171,7 @@ void CHyprRenderer::recheckSolitaryForMonitor(PHLMONITOR pMonitor) { // check if it did not open any subsurfaces or shit int surfaceCount = 0; - if (PCANDIDATE->m_bIsX11) + if (PCANDIDATE->m_isX11) surfaceCount = 1; else surfaceCount = PCANDIDATE->popupsCount() + PCANDIDATE->surfacesCount(); @@ -2387,7 +2385,7 @@ void CHyprRenderer::addWindowToRenderUnfocused(PHLWINDOW window) { void CHyprRenderer::makeRawWindowSnapshot(PHLWINDOW pWindow, CFramebuffer* pFramebuffer) { // we trust the window is valid. - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0) return; @@ -2431,7 +2429,7 @@ void CHyprRenderer::makeRawWindowSnapshot(PHLWINDOW pWindow, CFramebuffer* pFram void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) { // we trust the window is valid. - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); if (!PMONITOR || !PMONITOR->output || PMONITOR->vecPixelSize.x <= 0 || PMONITOR->vecPixelSize.y <= 0) return; @@ -2469,7 +2467,7 @@ void CHyprRenderer::makeWindowSnapshot(PHLWINDOW pWindow) { g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 0)); // JIC - renderWindow(pWindow, PMONITOR, Time::steadyNow(), !pWindow->m_bX11DoesntWantBorders, RENDER_PASS_ALL); + renderWindow(pWindow, PMONITOR, Time::steadyNow(), !pWindow->m_X11DoesntWantBorders, RENDER_PASS_ALL); **PBLUR = BLURVAL; @@ -2528,27 +2526,27 @@ void CHyprRenderer::renderSnapshot(PHLWINDOW pWindow) { if (!FBDATA->getTexture()) return; - const auto PMONITOR = pWindow->m_pMonitor.lock(); + const auto PMONITOR = pWindow->m_monitor.lock(); CBox windowBox; // some mafs to figure out the correct box // the originalClosedPos is relative to the monitor's pos - Vector2D scaleXY = Vector2D((PMONITOR->scale * pWindow->m_vRealSize->value().x / (pWindow->m_vOriginalClosedSize.x * PMONITOR->scale)), - (PMONITOR->scale * pWindow->m_vRealSize->value().y / (pWindow->m_vOriginalClosedSize.y * PMONITOR->scale))); + Vector2D scaleXY = Vector2D((PMONITOR->scale * pWindow->m_realSize->value().x / (pWindow->m_originalClosedSize.x * PMONITOR->scale)), + (PMONITOR->scale * pWindow->m_realSize->value().y / (pWindow->m_originalClosedSize.y * PMONITOR->scale))); windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x; windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y; - windowBox.x = ((pWindow->m_vRealPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.x * PMONITOR->scale) * scaleXY.x); - windowBox.y = ((pWindow->m_vRealPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.y * PMONITOR->scale) * scaleXY.y); + windowBox.x = ((pWindow->m_realPosition->value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((pWindow->m_originalClosedPos.x * PMONITOR->scale) * scaleXY.x); + windowBox.y = ((pWindow->m_realPosition->value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((pWindow->m_originalClosedPos.y * PMONITOR->scale) * scaleXY.y); CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; - if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.valueOrDefault()) { + if (*PDIMAROUND && pWindow->m_windowData.dimAround.valueOrDefault()) { CRectPassElement::SRectData data; data.box = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y}; - data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pWindow->m_fAlpha->value()); + data.color = CHyprColor(0, 0, 0, *PDIMAROUND * pWindow->m_alpha->value()); m_sRenderPass.add(makeShared(data)); damageMonitor(PMONITOR); @@ -2558,7 +2556,7 @@ void CHyprRenderer::renderSnapshot(PHLWINDOW pWindow) { data.flipEndFrame = true; data.tex = FBDATA->getTexture(); data.box = windowBox; - data.a = pWindow->m_fAlpha->value(); + data.a = pWindow->m_alpha->value(); data.damage = fakeDamage; m_sRenderPass.add(makeShared(data)); diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index 229736de..d1d8e9c0 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -36,12 +36,12 @@ CBox CHyprBorderDecoration::assignedBoxGlobal() { CBox box = m_bAssignedGeometry; box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_pWindow.lock())); - const auto PWORKSPACE = m_pWindow->m_pWorkspace; + const auto PWORKSPACE = m_pWindow->m_workspace; if (!PWORKSPACE) return box; - const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_renderOffset->value() : Vector2D(); + const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D(); return box.translate(WORKSPACEOFFSET); } @@ -52,22 +52,22 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) { if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1) return; - CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow->m_vFloatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round(); + CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow->m_floatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round(); if (windowBox.width < 1 || windowBox.height < 1) return; - auto grad = m_pWindow->m_cRealBorderColor; - const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress->isBeingAnimated(); + auto grad = m_pWindow->m_realBorderColor; + const bool ANIMATED = m_pWindow->m_borderFadeAnimationProgress->isBeingAnimated(); - if (m_pWindow->m_fBorderAngleAnimationProgress->enabled()) { - grad.m_angle += m_pWindow->m_fBorderAngleAnimationProgress->value() * M_PI * 2; + if (m_pWindow->m_borderAngleAnimationProgress->enabled()) { + grad.m_angle += m_pWindow->m_borderAngleAnimationProgress->value() * M_PI * 2; grad.m_angle = normalizeAngleRad(grad.m_angle); // When borderangle is animated, it is counterintuitive to fade between inactive/active gradient angles. // Instead we sync the angles to avoid fading between them and additionally rotating the border angle. if (ANIMATED) - m_pWindow->m_cRealBorderColorPrevious.m_angle = grad.m_angle; + m_pWindow->m_realBorderColorPrevious.m_angle = grad.m_angle; } int borderSize = m_pWindow->getRealBorderSize(); @@ -84,9 +84,9 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) { if (ANIMATED) { data.hasGrad2 = true; - data.grad1 = m_pWindow->m_cRealBorderColorPrevious; + data.grad1 = m_pWindow->m_realBorderColorPrevious; data.grad2 = grad; - data.lerp = m_pWindow->m_fBorderFadeAnimationProgress->value(); + data.lerp = m_pWindow->m_borderFadeAnimationProgress->value(); } g_pHyprRenderer->m_sRenderPass.add(makeShared(data)); @@ -119,10 +119,10 @@ void CHyprBorderDecoration::damageEntire() { const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 2; const auto BORDERSIZE = m_pWindow->getRealBorderSize() + 1; - const auto PWINDOWWORKSPACE = m_pWindow->m_pWorkspace; - if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_pWindow->m_bPinned) + const auto PWINDOWWORKSPACE = m_pWindow->m_workspace; + if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_pWindow->m_pinned) surfaceBox.translate(PWINDOWWORKSPACE->m_renderOffset->value()); - surfaceBox.translate(m_pWindow->m_vFloatingOffset); + surfaceBox.translate(m_pWindow->m_floatingOffset); CBox surfaceBoxExpandedBorder = surfaceBox; surfaceBoxExpandedBorder.expand(BORDERSIZE); @@ -157,5 +157,5 @@ std::string CHyprBorderDecoration::getDisplayName() { } bool CHyprBorderDecoration::doesntWantBorders() { - return m_pWindow->m_sWindowData.noBorder.valueOrDefault() || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0; + return m_pWindow->m_windowData.noBorder.valueOrDefault() || m_pWindow->m_X11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0; } diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 8a3e9334..ff9a195e 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -43,14 +43,14 @@ void CHyprDropShadowDecoration::damageEntire() { const auto PWINDOW = m_pWindow.lock(); - CBox shadowBox = {PWINDOW->m_vRealPosition->value().x - m_seExtents.topLeft.x, PWINDOW->m_vRealPosition->value().y - m_seExtents.topLeft.y, - PWINDOW->m_vRealSize->value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, - PWINDOW->m_vRealSize->value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y}; + CBox shadowBox = {PWINDOW->m_realPosition->value().x - m_seExtents.topLeft.x, PWINDOW->m_realPosition->value().y - m_seExtents.topLeft.y, + PWINDOW->m_realSize->value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, + PWINDOW->m_realSize->value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y}; - const auto PWORKSPACE = PWINDOW->m_pWorkspace; - if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_bPinned) + const auto PWORKSPACE = PWINDOW->m_workspace; + if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_pinned) shadowBox.translate(PWORKSPACE->m_renderOffset->value()); - shadowBox.translate(PWINDOW->m_vFloatingOffset); + shadowBox.translate(PWINDOW->m_floatingOffset); static auto PSHADOWIGNOREWINDOW = CConfigValue("decoration:shadow:ignore_window"); const auto ROUNDING = PWINDOW->rounding(); @@ -59,9 +59,9 @@ void CHyprDropShadowDecoration::damageEntire() { CRegion shadowRegion(shadowBox); if (*PSHADOWIGNOREWINDOW) { CBox surfaceBox = PWINDOW->getWindowMainSurfaceBox(); - if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_bPinned) + if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_pinned) surfaceBox.translate(PWORKSPACE->m_renderOffset->value()); - surfaceBox.translate(PWINDOW->m_vFloatingOffset); + surfaceBox.translate(PWINDOW->m_floatingOffset); surfaceBox.expand(-ROUNDINGSIZE); shadowRegion.subtract(CRegion(surfaceBox)); } @@ -79,8 +79,8 @@ void CHyprDropShadowDecoration::damageEntire() { void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) { const auto PWINDOW = m_pWindow.lock(); - m_vLastWindowPos = PWINDOW->m_vRealPosition->value(); - m_vLastWindowSize = PWINDOW->m_vRealSize->value(); + m_vLastWindowPos = PWINDOW->m_realPosition->value(); + m_vLastWindowSize = PWINDOW->m_realSize->value(); m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow); @@ -99,13 +99,13 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { if (!validMapped(PWINDOW)) return; - if (PWINDOW->m_cRealShadowColor->value() == CHyprColor(0, 0, 0, 0)) + if (PWINDOW->m_realShadowColor->value() == CHyprColor(0, 0, 0, 0)) return; // don't draw invisible shadows - if (!PWINDOW->m_sWindowData.decorate.valueOrDefault()) + if (!PWINDOW->m_windowData.decorate.valueOrDefault()) return; - if (PWINDOW->m_sWindowData.noShadow.valueOrDefault()) + if (PWINDOW->m_windowData.noShadow.valueOrDefault()) return; static auto PSHADOWS = CConfigValue("decoration:shadow:enabled"); @@ -120,8 +120,8 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { const auto ROUNDINGBASE = PWINDOW->rounding(); const auto ROUNDINGPOWER = PWINDOW->roundingPower(); const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + PWINDOW->getRealBorderSize() : 0; - const auto PWORKSPACE = PWINDOW->m_pWorkspace; - const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_renderOffset->value() : Vector2D(); + const auto PWORKSPACE = PWINDOW->m_workspace; + const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D(); // draw the shadow CBox fullBox = m_bLastWindowBoxWithDecos; @@ -142,7 +142,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { {fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2, fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}}; - fullBox.translate(PWINDOW->m_vFloatingOffset); + fullBox.translate(PWINDOW->m_floatingOffset); if (fullBox.width < 1 || fullBox.height < 1) return; // don't draw invisible shadows @@ -165,8 +165,8 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { windowBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET); withDecos.translate(-pMonitor->vecPosition + WORKSPACEOFFSET); - windowBox.translate(PWINDOW->m_vFloatingOffset); - withDecos.translate(PWINDOW->m_vFloatingOffset); + windowBox.translate(PWINDOW->m_floatingOffset); + withDecos.translate(PWINDOW->m_floatingOffset); auto scaledExtentss = withDecos.extentsFrom(windowBox); scaledExtentss = scaledExtentss * pMonitor->scale; @@ -192,7 +192,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { g_pHyprOpenGL->renderRect(fullBox, CHyprColor(0, 0, 0, 1), 0); // render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit) - drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, CHyprColor(1, 1, 1, PWINDOW->m_cRealShadowColor->value().a), a); + drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, CHyprColor(1, 1, 1, PWINDOW->m_realShadowColor->value().a), a); // render black window box ("clip") g_pHyprOpenGL->renderRect(windowBox, CHyprColor(0, 0, 0, 1.0), (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->scale, ROUNDINGPOWER); @@ -200,7 +200,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { alphaSwapFB.bind(); // alpha swap just has the shadow color. It will be the "texture" to render. - g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_cRealShadowColor->value().stripA(), 0); + g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_realShadowColor->value().stripA(), 0); LASTFB->bind(); @@ -214,7 +214,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) { g_pHyprOpenGL->m_RenderData.damage = saveDamage; } else - drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_cRealShadowColor->value(), a); + drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_realShadowColor->value(), a); if (m_seExtents != m_seReportedExtents) g_pDecorationPositioner->repositionDeco(this); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index c09ca991..57861d26 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -43,7 +43,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { info.priority = *PPRIORITY; info.reserved = true; - if (*PENABLED && m_pWindow->m_sWindowData.decorate.valueOrDefault()) { + if (*PENABLED && m_pWindow->m_windowData.decorate.valueOrDefault()) { if (*PSTACKED) { const auto ONEBARHEIGHT = *POUTERGAP + *PINDICATORHEIGHT + *PINDICATORGAP + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0); info.desiredExtents = {{0, (ONEBARHEIGHT * m_dwGroupMembers.size()) + (*PKEEPUPPERGAP * *POUTERGAP)}, {0, 0}}; @@ -65,7 +65,7 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() { // void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) { - if (m_pWindow->m_sGroupData.pNextWindow.expired()) { + if (m_pWindow->m_groupData.pNextWindow.expired()) { m_pWindow->removeWindowDeco(this); return; } @@ -74,10 +74,10 @@ void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) { PHLWINDOW head = pWindow->getGroupHead(); m_dwGroupMembers.emplace_back(head); - PHLWINDOW curr = head->m_sGroupData.pNextWindow.lock(); + PHLWINDOW curr = head->m_groupData.pNextWindow.lock(); while (curr != head) { m_dwGroupMembers.emplace_back(curr); - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); } damageEntire(); @@ -90,7 +90,7 @@ void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) { void CHyprGroupBarDecoration::damageEntire() { auto box = assignedBoxGlobal(); - box.translate(m_pWindow->m_vFloatingOffset); + box.translate(m_pWindow->m_floatingOffset); g_pHyprRenderer->damageBox(box); } @@ -100,7 +100,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { static auto PENABLED = CConfigValue("group:groupbar:enabled"); - if (!*PENABLED || !m_pWindow->m_sWindowData.decorate.valueOrDefault()) + if (!*PENABLED || !m_pWindow->m_windowData.decorate.valueOrDefault()) return; static auto PRENDERTITLES = CConfigValue("group:groupbar:render_titles"); @@ -143,13 +143,13 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { for (int i = 0; i < barsToDraw; ++i) { const auto WINDOWINDEX = *PSTACKED ? m_dwGroupMembers.size() - i - 1 : i; - CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x, - ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth, + CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_floatingOffset.x, + ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->vecPosition.y + m_pWindow->m_floatingOffset.y, m_fBarWidth, *PINDICATORHEIGHT}; rect.scale(pMonitor->scale).round(); - const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked || g_pKeybindManager->m_bGroupsLocked; + const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_groupData.locked || g_pKeybindManager->m_bGroupsLocked; const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE; const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE; @@ -187,8 +187,8 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { g_pHyprRenderer->m_sRenderPass.add(makeShared(rectdata)); } - rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x, - ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth, + rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_floatingOffset.x, + ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_floatingOffset.y, m_fBarWidth, (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)}; rect.scale(pMonitor->scale); @@ -229,7 +229,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) { } if (*PRENDERTITLES) { - CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_szTitle); + CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_title); if (!pTitleTex) pTitleTex = @@ -276,7 +276,7 @@ void CHyprGroupBarDecoration::invalidateTextures() { m_sTitleTexs.titleTexs.clear(); } -CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : szContent(pWindow->m_szTitle), pWindowOwner(pWindow) { +CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : szContent(pWindow->m_title), pWindowOwner(pWindow) { static auto FALLBACKFONT = CConfigValue("misc:font_family"); static auto PTITLEFONTFAMILY = CConfigValue("group:groupbar:font_family"); static auto PTITLEFONTSIZE = CConfigValue("group:groupbar:font_size"); @@ -291,8 +291,8 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float const CHyprColor COLOR = CHyprColor(*PTEXTCOLOR); const auto FONTFAMILY = *PTITLEFONTFAMILY != STRVAL_EMPTY ? *PTITLEFONTFAMILY : *FALLBACKFONT; - texActive = g_pHyprOpenGL->renderText(pWindow->m_szTitle, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value); - texInactive = g_pHyprOpenGL->renderText(pWindow->m_szTitle, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value); + texActive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value); + texInactive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value); } static void renderGradientTo(SP tex, CGradientValueData* grad) { @@ -380,7 +380,7 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) { static auto PSTACKED = CConfigValue("group:groupbar:stacked"); static auto POUTERGAP = CConfigValue("group:groupbar:gaps_out"); static auto PINNERGAP = CConfigValue("group:groupbar:gaps_in"); - if (m_pWindow.lock() == m_pWindow->m_sGroupData.pNextWindow.lock()) + if (m_pWindow.lock() == m_pWindow->m_groupData.pNextWindow.lock()) return false; const float BARRELATIVEX = pos.x - assignedBoxGlobal().x; @@ -397,7 +397,7 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) { // hack g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); - if (!pWindow->m_bIsFloating) { + if (!pWindow->m_isFloating) { const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked; g_pKeybindManager->m_bGroupsLocked = true; g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow); @@ -419,12 +419,12 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND static auto PMERGEGROUPSONGROUPBAR = CConfigValue("group:merge_groups_on_groupbar"); static auto POUTERGAP = CConfigValue("group:groupbar:gaps_out"); static auto PINNERGAP = CConfigValue("group:groupbar:gaps_in"); - const bool FLOATEDINTOTILED = !m_pWindow->m_bIsFloating && !pDraggedWindow->m_bDraggingTiled; + const bool FLOATEDINTOTILED = !m_pWindow->m_isFloating && !pDraggedWindow->m_draggingTiled; g_pInputManager->m_bWasDraggingWindow = false; if (!pDraggedWindow->canBeGroupedInto(m_pWindow.lock()) || (*PDRAGINTOGROUP != 1 && *PDRAGINTOGROUP != 2) || (FLOATEDINTOTILED && !*PMERGEFLOATEDINTOTILEDONGROUPBAR) || - (!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_sGroupData.pNextWindow.lock() && m_pWindow->m_sGroupData.pNextWindow.lock())) { + (!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_groupData.pNextWindow.lock() && m_pWindow->m_groupData.pNextWindow.lock())) { g_pInputManager->m_bWasDraggingWindow = true; return false; } @@ -434,49 +434,49 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND const int WINDOWINDEX = BARRELATIVE < 0 ? -1 : BARRELATIVE / BARSIZE; PHLWINDOW pWindowInsertAfter = m_pWindow->getGroupWindowByIndex(WINDOWINDEX); - PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock(); - PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; + PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_groupData.pNextWindow.lock(); + PHLWINDOW pDraggedHead = pDraggedWindow->m_groupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; - if (!pDraggedWindow->m_sGroupData.pNextWindow.expired()) { + if (!pDraggedWindow->m_groupData.pNextWindow.expired()) { // stores group data std::vector members; PHLWINDOW curr = pDraggedHead; - const bool WASLOCKED = pDraggedHead->m_sGroupData.locked; + const bool WASLOCKED = pDraggedHead->m_groupData.locked; do { members.push_back(curr); - curr = curr->m_sGroupData.pNextWindow.lock(); + curr = curr->m_groupData.pNextWindow.lock(); } while (curr != members[0]); // removes all windows for (const PHLWINDOW& w : members) { - w->m_sGroupData.pNextWindow.reset(); - w->m_sGroupData.head = false; - w->m_sGroupData.locked = false; + w->m_groupData.pNextWindow.reset(); + w->m_groupData.head = false; + w->m_groupData.locked = false; g_pLayoutManager->getCurrentLayout()->onWindowRemoved(w); } // restores the group for (auto it = members.begin(); it != members.end(); ++it) { - (*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members - *(*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize->goal(); // match the size of group members - *(*it)->m_vRealPosition = pWindowInsertAfter->m_vRealPosition->goal(); // match the position of group members + (*it)->m_isFloating = pWindowInsertAfter->m_isFloating; // match the floating state of group members + *(*it)->m_realSize = pWindowInsertAfter->m_realSize->goal(); // match the size of group members + *(*it)->m_realPosition = pWindowInsertAfter->m_realPosition->goal(); // match the position of group members if (std::next(it) != members.end()) - (*it)->m_sGroupData.pNextWindow = *std::next(it); + (*it)->m_groupData.pNextWindow = *std::next(it); else - (*it)->m_sGroupData.pNextWindow = members[0]; + (*it)->m_groupData.pNextWindow = members[0]; } - members[0]->m_sGroupData.head = true; - members[0]->m_sGroupData.locked = WASLOCKED; + members[0]->m_groupData.head = true; + members[0]->m_groupData.locked = WASLOCKED; } else g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pDraggedWindow); - pDraggedWindow->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of the window + pDraggedWindow->m_isFloating = pWindowInsertAfter->m_isFloating; // match the floating state of the window pWindowInsertAfter->insertWindowToGroup(pDraggedWindow); if (WINDOWINDEX == -1) - std::swap(pDraggedHead->m_sGroupData.head, pWindowInsertEnd->m_sGroupData.head); + std::swap(pDraggedHead->m_groupData.head, pWindowInsertEnd->m_groupData.head); m_pWindow->setGroupCurrent(pDraggedWindow); pDraggedWindow->applyGroupRules(); @@ -533,7 +533,7 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo if (!g_pCompositor->isWindowActive(pWindow) && *PFOLLOWMOUSE != 3) g_pCompositor->focusWindow(pWindow); - if (pWindow->m_bIsFloating) + if (pWindow->m_isFloating) g_pCompositor->changeWindowZOrder(pWindow, true); return true; @@ -542,11 +542,11 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, const IPointer::SAxisEvent e) { static auto PGROUPBARSCROLLING = CConfigValue("group:groupbar:scrolling"); - if (!*PGROUPBARSCROLLING || m_pWindow->m_sGroupData.pNextWindow.expired()) + if (!*PGROUPBARSCROLLING || m_pWindow->m_groupData.pNextWindow.expired()) return false; if (e.delta > 0) - m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow.lock()); + m_pWindow->setGroupCurrent(m_pWindow->m_groupData.pNextWindow.lock()); else m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious()); @@ -579,9 +579,9 @@ CBox CHyprGroupBarDecoration::assignedBoxGlobal() { CBox box = m_bAssignedBox; box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow.lock())); - const auto PWORKSPACE = m_pWindow->m_pWorkspace; + const auto PWORKSPACE = m_pWindow->m_workspace; - if (PWORKSPACE && !m_pWindow->m_bPinned) + if (PWORKSPACE && !m_pWindow->m_pinned) box.translate(PWORKSPACE->m_renderOffset->value()); return box.round(); diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index b2d32ad0..cb70304f 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -91,8 +91,8 @@ void CDecorationPositioner::sanitizeDatas() { std::erase_if(m_vWindowPositioningDatas, [](const auto& other) { if (!validMapped(other->pWindow)) return true; - if (std::find_if(other->pWindow->m_dWindowDecorations.begin(), other->pWindow->m_dWindowDecorations.end(), - [&](const auto& el) { return el.get() == other->pDecoration; }) == other->pWindow->m_dWindowDecorations.end()) + if (std::find_if(other->pWindow->m_windowDecorations.begin(), other->pWindow->m_windowDecorations.end(), [&](const auto& el) { return el.get() == other->pDecoration; }) == + other->pWindow->m_windowDecorations.end()) return true; return false; }); @@ -123,13 +123,13 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { // std::vector datas; // reserve to avoid reallocations - datas.reserve(pWindow->m_dWindowDecorations.size()); + datas.reserve(pWindow->m_windowDecorations.size()); - for (auto const& wd : pWindow->m_dWindowDecorations) { + for (auto const& wd : pWindow->m_windowDecorations) { datas.push_back(getDataFor(wd.get(), pWindow)); } - if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize->value() /* position not changed */ + if (WINDOWDATA->lastWindowSize == pWindow->m_realSize->value() /* position not changed */ && std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [pWindow](const auto& data) { return pWindow != data->pWindow.lock() || !data->needsReposition; }) /* all window datas are either not for this window or don't need a reposition */ @@ -141,9 +141,9 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { wd->positioningInfo = wd->pDecoration->getPositioningInfo(); } - WINDOWDATA->lastWindowSize = pWindow->m_vRealSize->value(); + WINDOWDATA->lastWindowSize = pWindow->m_realSize->value(); WINDOWDATA->needsRecalc = false; - const bool EPHEMERAL = pWindow->m_vRealSize->isBeingAnimated(); + const bool EPHEMERAL = pWindow->m_realSize->isBeingAnimated(); std::sort(datas.begin(), datas.end(), [](const auto& a, const auto& b) { return a->positioningInfo.priority > b->positioningInfo.priority; }); diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp index 16d94785..6a56eea8 100644 --- a/src/render/pass/Pass.cpp +++ b/src/render/pass/Pass.cpp @@ -241,7 +241,7 @@ void CRenderPass::renderDebugData() { renderHLSurface(debugData.keyboardFocusText, g_pSeatManager->state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F)); renderHLSurface(debugData.pointerFocusText, g_pSeatManager->state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F)); if (g_pCompositor->m_lastWindow) - renderHLSurface(debugData.lastWindowText, g_pCompositor->m_lastWindow->m_pWLSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F)); + renderHLSurface(debugData.lastWindowText, g_pCompositor->m_lastWindow->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F)); if (g_pSeatManager->state.pointerFocus) { if (g_pSeatManager->state.pointerFocus->current.input.intersect(CBox{{}, g_pSeatManager->state.pointerFocus->current.size}).getExtents().size() != diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp index 252c0924..c47c76ce 100644 --- a/src/render/pass/SurfacePassElement.cpp +++ b/src/render/pass/SurfacePassElement.cpp @@ -75,7 +75,7 @@ void CSurfacePassElement::draw(const CRegion& damage) { const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->scale) != data.pMonitor->scale /* Fractional */ && data.surface->current.scale == 1 /* fs protocol */ && windowBox.size() != data.surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->current.bufferSize.x, 3) && DELTALESSTHAN(windowBox.height, data.surface->current.bufferSize.y, 3) /* off by one-or-two */ && - (!data.pWindow || (!data.pWindow->m_vRealSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */; + (!data.pWindow || (!data.pWindow->m_realSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */; if (data.surface->colorManagement.valid()) Debug::log(TRACE, "FIXME: rendering surface with color management enabled, should apply necessary transformations"); @@ -103,7 +103,7 @@ void CSurfacePassElement::draw(const CRegion& damage) { roundingPower = 2.0f; } - const bool WINDOWOPAQUE = data.pWindow && data.pWindow->m_pWLSurface->resource() == data.surface ? data.pWindow->opaque() : false; + const bool WINDOWOPAQUE = data.pWindow && data.pWindow->m_wlSurface->resource() == data.surface ? data.pWindow->opaque() : false; const bool CANDISABLEBLEND = ALPHA >= 1.f && OVERALL_ALPHA >= 1.f && rounding == 0 && WINDOWOPAQUE; if (CANDISABLEBLEND) @@ -153,8 +153,8 @@ CBox CSurfacePassElement::getTexBox() { if (!INTERACTIVERESIZEINPROGRESS) { windowBox.translate(CORRECT); - windowBox.width = SIZE.x * (PWINDOW->m_vRealSize->value().x / PWINDOW->m_vReportedSize.x); - windowBox.height = SIZE.y * (PWINDOW->m_vRealSize->value().y / PWINDOW->m_vReportedSize.y); + windowBox.width = SIZE.x * (PWINDOW->m_realSize->value().x / PWINDOW->m_reportedSize.x); + windowBox.height = SIZE.y * (PWINDOW->m_realSize->value().y / PWINDOW->m_reportedSize.y); } else { windowBox.width = SIZE.x; windowBox.height = SIZE.y; @@ -164,10 +164,10 @@ CBox CSurfacePassElement::getTexBox() { } else { // here we clamp to 2, these might be some tiny specks windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, std::max((float)data.surface->current.size.x, 2.F), std::max((float)data.surface->current.size.y, 2.F)}; - if (data.pWindow && data.pWindow->m_vRealSize->isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) { + if (data.pWindow && data.pWindow->m_realSize->isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) { // adjust subsurfaces to the window - windowBox.width = (windowBox.width / data.pWindow->m_vReportedSize.x) * data.pWindow->m_vRealSize->value().x; - windowBox.height = (windowBox.height / data.pWindow->m_vReportedSize.y) * data.pWindow->m_vRealSize->value().y; + windowBox.width = (windowBox.width / data.pWindow->m_reportedSize.x) * data.pWindow->m_realSize->value().x; + windowBox.height = (windowBox.height / data.pWindow->m_reportedSize.y) * data.pWindow->m_realSize->value().y; } } diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index f0fad928..613ec5f9 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -46,7 +46,7 @@ void CXWM::handleCreate(xcb_create_notify_event_t* e) { const auto WINDOW = CWindow::create(XSURF); g_pCompositor->m_windows.emplace_back(WINDOW); - WINDOW->m_pSelf = WINDOW; + WINDOW->m_self = WINDOW; Debug::log(LOG, "[xwm] New XWayland window at {:x} for surf {:x}", (uintptr_t)WINDOW.get(), (uintptr_t)XSURF.get()); } @@ -1000,7 +1000,7 @@ void CXWM::activateSurface(SP surf, bool activate) { if ((surf == focusedSurface && activate) || (surf && surf->overrideRedirect)) return; - if (!surf || (!activate && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_bIsX11)) { + if (!surf || (!activate && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_isX11)) { setActiveWindow((uint32_t)XCB_WINDOW_NONE); focusWindow(nullptr); } else { diff --git a/src/xwayland/XWayland.cpp b/src/xwayland/XWayland.cpp index 041cf87c..1f78231f 100644 --- a/src/xwayland/XWayland.cpp +++ b/src/xwayland/XWayland.cpp @@ -9,7 +9,7 @@ CXWayland::CXWayland(const bool wantsEnabled) { if (!wantsEnabled) { Debug::log(LOG, "XWayland has been disabled, cleaning up..."); for (auto& w : g_pCompositor->m_windows) { - if (!w->m_bIsX11) + if (!w->m_isX11) continue; g_pCompositor->closeWindow(w); }