From 8b21a37059c81eee6b54d0d4af7089674592ba72 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 27 Apr 2024 03:06:21 +0100 Subject: [PATCH] format --- src/Compositor.cpp | 17 ++++--- src/debug/HyprCtl.cpp | 4 +- src/desktop/Subsurface.hpp | 4 +- src/desktop/WLSurface.cpp | 8 ++-- src/desktop/Window.cpp | 16 +++---- src/desktop/Window.hpp | 6 +-- src/events/Misc.cpp | 3 +- src/events/Windows.cpp | 44 ++++++++++--------- src/layout/DwindleLayout.cpp | 8 ++-- src/layout/IHyprLayout.cpp | 2 +- src/managers/KeybindManager.cpp | 14 +++--- src/managers/input/InputManager.cpp | 11 ++--- src/managers/input/Touch.cpp | 3 +- src/protocols/TearingControl.cpp | 3 +- src/render/OpenGL.cpp | 5 +-- src/render/OpenGL.hpp | 8 ++-- .../decorations/CHyprBorderDecoration.cpp | 3 +- .../decorations/CHyprDropShadowDecoration.hpp | 2 +- .../decorations/CHyprGroupBarDecoration.cpp | 14 +++--- .../decorations/DecorationPositioner.cpp | 4 +- .../decorations/DecorationPositioner.hpp | 14 +++--- 21 files changed, 99 insertions(+), 94 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 2ddeefdb..197a1d27 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -362,7 +362,7 @@ void CCompositor::cleanup() { // still in a normal working state. g_pPluginSystem->unloadAllPlugins(); - m_pLastFocus = nullptr; + m_pLastFocus = nullptr; m_pLastWindow.reset(); // end threads @@ -693,8 +693,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper for (auto& w : m_vWindows | std::views::reverse) { const auto BB = w->getWindowBoxUnified(properties); CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA}; - if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sAdditionalConfigData.noFocus && - w != pIgnoreWindow) { + if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sAdditionalConfigData.noFocus && w != pIgnoreWindow) { if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y})) return w; @@ -734,7 +733,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) { // Override Redirect return g_pCompositor->m_pLastWindow.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. + // TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases. } return w; @@ -934,7 +933,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, wlr_surface* pSurface) { g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","}); g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","}); - EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW)nullptr); + EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr); g_pLayoutManager->getCurrentLayout()->onWindowFocusChange(nullptr); @@ -1327,7 +1326,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) { std::deque toMove; - auto x11Stack = [&](PHLWINDOW pw, bool top, auto&& x11Stack) -> void { + auto x11Stack = [&](PHLWINDOW pw, bool top, auto&& x11Stack) -> void { if (top) toMove.emplace_back(pw); else @@ -1464,7 +1463,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) { const auto PWORKSPACE = pWindow->m_pWorkspace; auto leaderValue = -1; - PHLWINDOW leaderWindow = nullptr; + PHLWINDOW leaderWindow = nullptr; if (!pWindow->m_bIsFloating) { @@ -1839,8 +1838,8 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) { setBorderColor(pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying().m_vColors.empty() ? *ACTIVECOLOR : pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying()); } else { - const auto* const INACTIVECOLOR = - !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL); + const auto* const INACTIVECOLOR = !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : + (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL); setBorderColor(pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying().m_vColors.empty() ? *INACTIVECOLOR : pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying()); } diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 1c738494..d02d6023 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -148,8 +148,8 @@ static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) { std::ostringstream result; - PHLWINDOW head = w->getGroupHead(); - PHLWINDOW curr = head; + PHLWINDOW head = w->getGroupHead(); + PHLWINDOW curr = head; while (true) { if (isJson) result << std::format("\"0x{:x}\"", (uintptr_t)curr.get()); diff --git a/src/desktop/Subsurface.hpp b/src/desktop/Subsurface.hpp index 0db9d7dc..e5094041 100644 --- a/src/desktop/Subsurface.hpp +++ b/src/desktop/Subsurface.hpp @@ -45,8 +45,8 @@ class CSubsurface { // if nullptr, means it's a dummy node CSubsurface* m_pParent = nullptr; - PHLWINDOWREF m_pWindowParent; - CPopup* m_pPopupParent = nullptr; + PHLWINDOWREF m_pWindowParent; + CPopup* m_pPopupParent = nullptr; std::vector> m_vChildren; diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index 8371ef08..2d870870 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -113,10 +113,10 @@ void CWLSurface::destroy() { hyprListener_commit.removeCallback(); m_pWLRSurface->data = nullptr; m_pWindowOwner.reset(); - m_pLayerOwner = nullptr; - m_pPopupOwner = nullptr; - m_pSubsurfaceOwner = nullptr; - m_bInert = true; + m_pLayerOwner = nullptr; + m_pPopupOwner = nullptr; + m_pSubsurfaceOwner = nullptr; + m_bInert = true; if (g_pCompositor && g_pCompositor->m_pLastFocus == m_pWLRSurface) g_pCompositor->m_pLastFocus = nullptr; diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 1f4817f1..fe717165 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -849,7 +849,7 @@ void CWindow::destroyGroup() { return; } m_sGroupData.pNextWindow.reset(); - m_sGroupData.head = false; + m_sGroupData.head = false; updateWindowDecos(); g_pCompositor->updateWorkspaceWindows(workspaceID()); g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); @@ -861,8 +861,8 @@ void CWindow::destroyGroup() { PHLWINDOW curr = m_pSelf.lock(); std::vector members; do { - const auto PLASTWIN = curr; - curr = curr->m_sGroupData.pNextWindow.lock(); + const auto PLASTWIN = curr; + curr = curr->m_sGroupData.pNextWindow.lock(); PLASTWIN->m_sGroupData.pNextWindow.reset(); curr->setHidden(false); members.push_back(curr); @@ -920,12 +920,12 @@ int CWindow::getGroupSize() { } bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) { - 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 + 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 + && !m_sGroupData.deny // source is not denied entry + && !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window } PHLWINDOW CWindow::getGroupWindowByIndex(int index) { diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 6d9474d4..dd7d2e1e 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -370,9 +370,9 @@ class CWindow { // for groups struct SGroupData { PHLWINDOWREF pNextWindow; // nullptr means no grouping. Self means single group. - bool head = false; - bool locked = false; // per group lock - bool deny = false; // deny window from enter a group or made a group + 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; diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp index df50c134..996c5128 100644 --- a/src/events/Misc.cpp +++ b/src/events/Misc.cpp @@ -141,7 +141,8 @@ void Events::listener_destroyDrag(void* owner, void* data) { g_pInputManager->m_sDrag.dragIcon = nullptr; g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback(); - g_pCompositor->focusWindow(g_pCompositor->m_pLastWindow.lock(), g_pCompositor->m_pLastWindow.lock() ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow.lock()) : nullptr); + g_pCompositor->focusWindow(g_pCompositor->m_pLastWindow.lock(), + g_pCompositor->m_pLastWindow.lock() ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow.lock()) : nullptr); } void Events::listener_mapDragIcon(void* owner, void* data) { diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 45737adf..59f6e716 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -505,14 +505,16 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(), "XDG Window Late"); PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW.get(), "XDG Window Late"); - PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW.get(), "XDG Window Late"); + PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW.get(), + "XDG Window Late"); PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW.get(), "XDG Window Late"); PWINDOW->hyprListener_ackConfigure.initCallback(&PWINDOW->m_uSurface.xdg->events.ack_configure, &Events::listener_ackConfigure, PWINDOW.get(), "XDG Window Late"); } else { PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW.get(), "XWayland Window Late"); - PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW.get(), "XWayland Window Late"); + PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW.get(), + "XWayland Window Late"); PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW.get(), "XWayland Window Late"); PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(), "Xwayland Window Late"); @@ -670,7 +672,7 @@ void Events::listener_mapWindow(void* owner, void* data) { } void Events::listener_unmapWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); Debug::log(LOG, "{:c} unmapped", PWINDOW); @@ -727,9 +729,9 @@ void Events::listener_unmapWindow(void* owner, void* data) { bool wasLastWindow = false; if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) { - wasLastWindow = true; + wasLastWindow = true; g_pCompositor->m_pLastWindow.reset(); - g_pCompositor->m_pLastFocus = nullptr; + g_pCompositor->m_pLastFocus = nullptr; g_pInputManager->releaseAllMouseButtons(); } @@ -763,7 +765,7 @@ void Events::listener_unmapWindow(void* owner, void* data) { if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || !g_pCompositor->m_pLastWindow.lock()) { g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","}); g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","}); - EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW)nullptr); + EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr); } } else { Debug::log(LOG, "Unmapped was not focused, ignoring a refocus."); @@ -793,7 +795,7 @@ void Events::listener_unmapWindow(void* owner, void* data) { } void Events::listener_ackConfigure(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); const auto E = (wlr_xdg_surface_configure*)data; // find last matching serial @@ -807,7 +809,7 @@ void Events::listener_ackConfigure(void* owner, void* data) { } void Events::listener_commitWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); if (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->initial_commit) { Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(PWINDOW); @@ -883,7 +885,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_pSelf.lock(); Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW); @@ -892,7 +894,7 @@ void Events::listener_destroyWindow(void* owner, void* data) { if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) { g_pCompositor->m_pLastWindow.reset(); - g_pCompositor->m_pLastFocus = nullptr; + g_pCompositor->m_pLastFocus = nullptr; } PWINDOW->m_pWLSurface.unassign(); @@ -919,7 +921,7 @@ void Events::listener_destroyWindow(void* owner, void* data) { } void Events::listener_setTitleWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); if (!validMapped(PWINDOW)) return; @@ -947,7 +949,7 @@ void Events::listener_setTitleWindow(void* owner, void* data) { } void Events::listener_fullscreenWindow(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); if (!PWINDOW->m_bIsMapped) { PWINDOW->m_bWantsInitialFullscreen = true; @@ -1022,7 +1024,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) { } void Events::listener_activateX11(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); Debug::log(LOG, "X11 Activate request for window {}", PWINDOW); @@ -1047,7 +1049,7 @@ void Events::listener_activateX11(void* owner, void* data) { } void Events::listener_configureX11(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); const auto E = (wlr_xwayland_surface_configure_event*)data; @@ -1113,7 +1115,7 @@ void Events::listener_configureX11(void* owner, void* data) { } void Events::listener_unmanagedSetGeometry(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); if (!PWINDOW->m_bIsMapped) return; @@ -1178,7 +1180,7 @@ void Events::listener_setOverrideRedirect(void* owner, void* data) { } void Events::listener_associateX11(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PWINDOW->hyprListener_mapWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.map, &Events::listener_mapWindow, PWINDOW.get(), "XWayland Window"); PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.commit, &Events::listener_commitWindow, PWINDOW.get(), "XWayland Window"); @@ -1187,7 +1189,7 @@ void Events::listener_associateX11(void* owner, void* data) { } void Events::listener_dissociateX11(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PWINDOW->m_pWLSurface.unassign(); @@ -1235,7 +1237,7 @@ void Events::listener_newXDGToplevel(wl_listener* listener, void* data) { } void Events::listener_requestMaximize(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE) return; @@ -1256,7 +1258,7 @@ void Events::listener_requestMaximize(void* owner, void* data) { } void Events::listener_requestMinimize(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); Debug::log(LOG, "Minimize request for {}", PWINDOW); @@ -1277,14 +1279,14 @@ void Events::listener_requestMinimize(void* owner, void* data) { } void Events::listener_requestMove(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); // ignore wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg); } void Events::listener_requestResize(void* owner, void* data) { - PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); + PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); // ignore wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg); diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 7beb4fa9..e6ebe998 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -339,7 +339,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir } // if it's a group, add the window - if (OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group + if (OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group && pWindow->canBeGroupedInto(OPENINGON->pWindow.lock()) && !m_vOverrideFocalPoint) { // we are not moving window m_lDwindleNodesData.remove(*PNODE); @@ -984,13 +984,13 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) { getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive(); if (ACTIVE1) { - ACTIVE1->box = PNODE->box; + ACTIVE1->box = PNODE->box; ACTIVE1->pWindow.lock()->m_vPosition = ACTIVE1->box.pos(); ACTIVE1->pWindow.lock()->m_vSize = ACTIVE1->box.size(); } if (ACTIVE2) { - ACTIVE2->box = PNODE2->box; + ACTIVE2->box = PNODE2->box; ACTIVE2->pWindow.lock()->m_vPosition = ACTIVE2->box.pos(); ACTIVE2->pWindow.lock()->m_vSize = ACTIVE2->box.size(); } @@ -1140,7 +1140,7 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() { if (!PNODE) return {}; - node = *PNODE; + node = *PNODE; node.pWindow.reset(); CBox box = PNODE->box; diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 3af1551a..d9c99496 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -283,7 +283,7 @@ void IHyprLayout::onEndDragWindow() { g_pInputManager->unsetCursorImage(); g_pInputManager->currentlyDraggedWindow.reset(); - g_pInputManager->m_bWasDraggingWindow = true; + g_pInputManager->m_bWasDraggingWindow = true; if (DRAGGINGWINDOW->m_bDraggingTiled) { DRAGGINGWINDOW->m_bIsFloating = false; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 4d570525..bd0e9599 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -231,7 +231,7 @@ bool CKeybindManager::ensureMouseBindState() { m_bIsMouseBindActive = false; g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pInputManager->currentlyDraggedWindow.reset(); - g_pInputManager->dragMode = MBIND_INVALID; + g_pInputManager->dragMode = MBIND_INVALID; g_pCompositor->updateWorkspaceWindows(lastDraggedWindow->workspaceID()); g_pCompositor->updateWorkspaceSpecialRenderData(lastDraggedWindow->workspaceID()); @@ -1119,7 +1119,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { } void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { - PHLWINDOW PWINDOW = nullptr; + PHLWINDOW PWINDOW = nullptr; const auto ORIGINALARGS = args; @@ -1209,7 +1209,7 @@ void CKeybindManager::moveFocusTo(std::string args) { void CKeybindManager::focusUrgentOrLast(std::string args) { const auto PWINDOWURGENT = g_pCompositor->getUrgentWindow(); const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) : - (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock()); + (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock()); if (!PWINDOWURGENT && !PWINDOWPREV) return; @@ -1219,7 +1219,7 @@ void CKeybindManager::focusUrgentOrLast(std::string args) { void CKeybindManager::focusCurrentOrLast(std::string args) { const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) : - (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock()); + (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock()); if (!PWINDOWPREV) return; @@ -2098,7 +2098,7 @@ void CKeybindManager::mouse(std::string args) { g_pKeybindManager->m_bIsMouseBindActive = true; const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); - PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); + PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); if (pWindow && !pWindow->m_bIsFullscreen) pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_START, mouseCoords); @@ -2114,7 +2114,7 @@ void CKeybindManager::mouse(std::string args) { if (g_pInputManager->currentlyDraggedWindow.lock()) { g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pInputManager->currentlyDraggedWindow.reset(); - g_pInputManager->dragMode = MBIND_INVALID; + g_pInputManager->dragMode = MBIND_INVALID; } } } else if (ARGS[0] == "resizewindow") { @@ -2138,7 +2138,7 @@ void CKeybindManager::mouse(std::string args) { if (g_pInputManager->currentlyDraggedWindow.lock()) { g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pInputManager->currentlyDraggedWindow.reset(); - g_pInputManager->dragMode = MBIND_INVALID; + g_pInputManager->dragMode = MBIND_INVALID; } } } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 2ed770d3..f8b3eded 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -118,13 +118,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { const auto FOLLOWMOUSE = *PFOLLOWONDND && m_sDrag.drag ? 1 : *PFOLLOWMOUSE; - m_pFoundSurfaceToFocus = nullptr; - m_pFoundLSToFocus = nullptr; + m_pFoundSurfaceToFocus = nullptr; + m_pFoundLSToFocus = nullptr; m_pFoundWindowToFocus.reset(); wlr_surface* foundSurface = nullptr; Vector2D surfaceCoords; - Vector2D surfacePos = Vector2D(-1337, -1337); - PHLWINDOW pFoundWindow; + Vector2D surfacePos = Vector2D(-1337, -1337); + PHLWINDOW pFoundWindow; SLayerSurface* pFoundLayerSurface = nullptr; if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState) @@ -419,7 +419,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { if (FOLLOWMOUSE != 1 && !refocus) { if (pFoundWindow != g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock() && - ((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow.lock()->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) { + ((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || + (g_pCompositor->m_pLastWindow.lock()->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) { // enter if change floating style if (FOLLOWMOUSE != 3 && allowKeyboardRefocus) g_pCompositor->focusWindow(pFoundWindow, foundSurface); diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index b35d0ab4..9fc5c7c3 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -66,7 +66,8 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) { if (m_sTouchData.touchFocusWindow.lock()) { if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11) { - local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) * m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy; + local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) * + m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy; m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal(); } else { g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local); diff --git a/src/protocols/TearingControl.cpp b/src/protocols/TearingControl.cpp index e8a94c30..97ec670a 100644 --- a/src/protocols/TearingControl.cpp +++ b/src/protocols/TearingControl.cpp @@ -4,7 +4,8 @@ #include "../Compositor.hpp" CTearingControlProtocol::CTearingControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { - static auto P = g_pHookSystem->hookDynamic("destroyWindow", [this](void* self, SCallbackInfo& info, std::any param) { this->onWindowDestroy(std::any_cast(param)); }); + static auto P = + g_pHookSystem->hookDynamic("destroyWindow", [this](void* self, SCallbackInfo& info, std::any param) { this->onWindowDestroy(std::any_cast(param)); }); } void CTearingControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index e83b70e3..4ea44390 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1742,7 +1742,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(PHLWINDOW pWindow) { // we need to "damage" the entire monitor // so that we render the entire window // this is temporary, doesnt mess with the actual wlr damage - CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y}; + CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y}; PHLWINDOWREF ref{pWindow}; @@ -1824,11 +1824,10 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) { void CHyprOpenGLImpl::renderSnapshot(PHLWINDOW pWindow) { RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!"); - static auto PDIMAROUND = CConfigValue("decoration:dim_around"); + static auto PDIMAROUND = CConfigValue("decoration:dim_around"); PHLWINDOWREF ref{pWindow}; - if (!m_mWindowFramebuffers.contains(ref)) return; diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index b3f4b5b9..bbd022e7 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -196,10 +196,10 @@ class CHyprOpenGLImpl { PHLWINDOWREF m_pCurrentWindow; // hack to get the current rendered window SLayerSurface* m_pCurrentLayer = nullptr; // hack to get the current rendered layer - std::map> m_mWindowFramebuffers; - std::unordered_map m_mLayerFramebuffers; - std::unordered_map m_mMonitorRenderResources; - std::unordered_map m_mMonitorBGFBs; + std::map> m_mWindowFramebuffers; + std::unordered_map m_mLayerFramebuffers; + std::unordered_map m_mMonitorRenderResources; + std::unordered_map m_mMonitorBGFBs; struct { PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr; diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index 61161a98..c171a2b6 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -52,7 +52,8 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float 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.lock()->m_vFloatingOffset).expand(-m_pWindow.lock()->getRealBorderSize()).scale(pMonitor->scale).round(); + CBox windowBox = + assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow.lock()->m_vFloatingOffset).expand(-m_pWindow.lock()->getRealBorderSize()).scale(pMonitor->scale).round(); if (windowBox.width < 1 || windowBox.height < 1) return; diff --git a/src/render/decorations/CHyprDropShadowDecoration.hpp b/src/render/decorations/CHyprDropShadowDecoration.hpp index 61efbf37..06319cb7 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.hpp +++ b/src/render/decorations/CHyprDropShadowDecoration.hpp @@ -29,7 +29,7 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration { SWindowDecorationExtents m_seExtents; SWindowDecorationExtents m_seReportedExtents; - PHLWINDOWREF m_pWindow; + PHLWINDOWREF m_pWindow; Vector2D m_vLastWindowPos; Vector2D m_vLastWindowSize; diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index b710926c..5509ab3b 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -144,7 +144,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) { if (*PGRADIENTS) { const auto& GRADIENTTEX = (m_dwGroupMembers[i].lock() == g_pCompositor->m_pLastWindow.lock() ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) : - (GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive)); + (GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive)); if (GRADIENTTEX.m_iTexID != 0) g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0); } @@ -370,16 +370,16 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND const float BARRELATIVEX = pos.x - assignedBoxGlobal().x - m_fBarWidth / 2; const int WINDOWINDEX = BARRELATIVEX < 0 ? -1 : (BARRELATIVEX) / (m_fBarWidth + BAR_HORIZONTAL_PADDING); - PHLWINDOW pWindowInsertAfter = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX); - PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock(); - PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; + PHLWINDOW pWindowInsertAfter = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX); + PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock(); + PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; if (pDraggedWindow->m_sGroupData.pNextWindow.lock()) { // stores group data std::vector members; PHLWINDOW curr = pDraggedHead; - const bool WASLOCKED = pDraggedHead->m_sGroupData.locked; + const bool WASLOCKED = pDraggedHead->m_sGroupData.locked; do { members.push_back(curr); curr = curr->m_sGroupData.pNextWindow.lock(); @@ -388,8 +388,8 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND // removes all windows for (PHLWINDOW w : members) { w->m_sGroupData.pNextWindow.reset(); - w->m_sGroupData.head = false; - w->m_sGroupData.locked = false; + w->m_sGroupData.head = false; + w->m_sGroupData.locked = false; g_pLayoutManager->getCurrentLayout()->onWindowRemoved(w); } diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index 75b7fabc..5690ea65 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -125,8 +125,8 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) { } if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize.value() /* position not changed */ - && - std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [pWindow](const auto& data) { return pWindow != data->pWindow.lock() || !data->needsReposition; }) + && 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 */ && !WINDOWDATA->needsRecalc /* window doesn't need recalc */ ) diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index 7220982a..b99891b6 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -10,7 +10,7 @@ class CWindow; class IHyprWindowDecoration; typedef std::shared_ptr PHLWINDOW; -typedef std::weak_ptr PHLWINDOWREF; +typedef std::weak_ptr PHLWINDOWREF; enum eDecorationPositioningPolicy { DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */ @@ -90,13 +90,13 @@ class CDecorationPositioner { bool needsRecalc = false; }; - std::map> m_mWindowDatas; - std::vector> m_vWindowPositioningDatas; + std::map> m_mWindowDatas; + std::vector> m_vWindowPositioningDatas; - SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow); - void onWindowUnmap(PHLWINDOW pWindow); - void onWindowMap(PHLWINDOW pWindow); - void sanitizeDatas(); + SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow); + void onWindowUnmap(PHLWINDOW pWindow); + void onWindowMap(PHLWINDOW pWindow); + void sanitizeDatas(); }; inline std::unique_ptr g_pDecorationPositioner; \ No newline at end of file