workspaces: refactor class member vars (#10167)

This commit is contained in:
davc0n 2025-04-25 02:37:12 +02:00 committed by GitHub
parent 0e80ecc534
commit 02d7badd15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 687 additions and 688 deletions

View file

@ -100,12 +100,12 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled);
} else if (PWORKSPACE) {
PMONITOR = PWORKSPACE->m_pMonitor.lock();
PMONITOR = PWORKSPACE->m_monitor.lock();
if (!PMONITOR)
return;
// dont damage the whole monitor on workspace change, unless it's a special workspace, because dim/blur etc
if (PWORKSPACE->m_bIsSpecialWorkspace)
if (PWORKSPACE->m_isSpecialWorkspace)
g_pHyprRenderer->damageMonitor(PMONITOR);
// TODO: just make this into a damn callback already vax...
@ -122,7 +122,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
g_pHyprRenderer->damageWindow(w, true);
}
if (PWORKSPACE->m_bIsSpecialWorkspace)
if (PWORKSPACE->m_isSpecialWorkspace)
g_pHyprRenderer->damageWindow(w, true); // hack for special too because it can cross multiple monitors
}

View file

@ -391,7 +391,7 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
if (PLASTWINDOW && PLASTWINDOW->m_pWorkspace == PWINDOWTOCHANGETO->m_pWorkspace && PLASTWINDOW->isFullscreen()) {
const auto PWORKSPACE = PLASTWINDOW->m_pWorkspace;
const auto MODE = PWORKSPACE->m_efFullscreenMode;
const auto MODE = PWORKSPACE->m_fullscreenMode;
if (!PWINDOWTOCHANGETO->m_bPinned)
g_pCompositor->setWindowFullscreenInternal(PLASTWINDOW, FSMODE_NONE);
@ -1223,15 +1223,15 @@ static SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSP
}
const bool PER_MON = args.contains("_per_monitor");
const SWorkspaceIDName PPREVWS = PER_MON ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_iID) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
const SWorkspaceIDName PPREVWS = PER_MON ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_id) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
// Do nothing if there's no previous workspace, otherwise switch to it.
if (PPREVWS.id == -1 || PPREVWS.id == PCURRENTWORKSPACE->m_iID) {
if (PPREVWS.id == -1 || PPREVWS.id == PCURRENTWORKSPACE->m_id) {
Debug::log(LOG, "No previous workspace to change to");
return {.id = WORKSPACE_NOT_CHANGED};
}
if (const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id); PWORKSPACETOCHANGETO) {
return {.id = PWORKSPACETOCHANGETO->m_iID, .name = PWORKSPACETOCHANGETO->m_szName};
return {.id = PWORKSPACETOCHANGETO->m_id, .name = PWORKSPACETOCHANGETO->m_name};
}
return {.id = PPREVWS.id, .name = PPREVWS.name.empty() ? std::to_string(PPREVWS.id) : PPREVWS.name};
@ -1262,9 +1262,9 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
if (workspaceToChangeTo == WORKSPACE_NOT_CHANGED)
return {};
const SWorkspaceIDName PPREVWS = args.contains("_per_monitor") ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_iID) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
const SWorkspaceIDName PPREVWS = args.contains("_per_monitor") ? PMONITOR->getPrevWorkspaceIDName(PCURRENTWORKSPACE->m_id) : PCURRENTWORKSPACE->getPrevWorkspaceIDName();
const bool BISWORKSPACECURRENT = workspaceToChangeTo == PCURRENTWORKSPACE->m_iID;
const bool BISWORKSPACECURRENT = workspaceToChangeTo == PCURRENTWORKSPACE->m_id;
if (BISWORKSPACECURRENT && (!(*PBACKANDFORTH || EXPLICITPREVIOUS) || PPREVWS.id == -1)) {
if (*PHIDESPECIALONWORKSPACECHANGE)
PMONITOR->setSpecialWorkspace(nullptr);
@ -1280,7 +1280,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
pWorkspaceToChangeTo =
g_pCompositor->createNewWorkspace(BISWORKSPACECURRENT ? PPREVWS.id : workspaceToChangeTo, PMONITOR->ID, BISWORKSPACECURRENT ? PPREVWS.name : workspaceName);
if (!BISWORKSPACECURRENT && pWorkspaceToChangeTo->m_bIsSpecialWorkspace) {
if (!BISWORKSPACECURRENT && pWorkspaceToChangeTo->m_isSpecialWorkspace) {
PMONITOR->setSpecialWorkspace(pWorkspaceToChangeTo);
g_pInputManager->simulateMouseMovement();
return {};
@ -1288,7 +1288,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
g_pInputManager->releaseAllMouseButtons();
const auto PMONITORWORKSPACEOWNER = PMONITOR == pWorkspaceToChangeTo->m_pMonitor ? PMONITOR : pWorkspaceToChangeTo->m_pMonitor.lock();
const auto PMONITORWORKSPACEOWNER = PMONITOR == pWorkspaceToChangeTo->m_monitor ? PMONITOR : pWorkspaceToChangeTo->m_monitor.lock();
if (!PMONITORWORKSPACEOWNER)
return {.success = false, .error = "Workspace to switch to has no monitor"};
@ -1425,20 +1425,20 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
if (pWorkspace) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
pMonitor = pWorkspace->m_pMonitor.lock();
pMonitor = pWorkspace->m_monitor.lock();
g_pCompositor->setActiveMonitor(pMonitor);
} else {
pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->monitorID(), workspaceName, false);
pMonitor = pWorkspace->m_pMonitor.lock();
pMonitor = pWorkspace->m_monitor.lock();
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
}
POLDWS->m_pLastFocusedWindow = POLDWS->getFirstWindow();
POLDWS->m_lastFocusedWindow = POLDWS->getFirstWindow();
if (pWorkspace->m_bIsSpecialWorkspace)
if (pWorkspace->m_isSpecialWorkspace)
pMonitor->setSpecialWorkspace(pWorkspace);
else if (POLDWS->m_bIsSpecialWorkspace)
POLDWS->m_pMonitor.lock()->setSpecialWorkspace(nullptr);
else if (POLDWS->m_isSpecialWorkspace)
POLDWS->m_monitor.lock()->setSpecialWorkspace(nullptr);
if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);
@ -1782,7 +1782,7 @@ SDispatchResult CKeybindManager::toggleSplit(std::string args) {
const auto PWORKSPACE = header.pWindow->m_pWorkspace;
if (PWORKSPACE->m_bHasFullscreenWindow)
if (PWORKSPACE->m_hasFullscreenWindow)
return {.success = false, .error = "Can't split windows that already split"};
g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "togglesplit");
@ -1799,7 +1799,7 @@ SDispatchResult CKeybindManager::swapSplit(std::string args) {
const auto PWORKSPACE = header.pWindow->m_pWorkspace;
if (PWORKSPACE->m_bHasFullscreenWindow)
if (PWORKSPACE->m_hasFullscreenWindow)
return {.success = false, .error = "Can't split windows that already split"};
g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "swapsplit");
@ -1919,17 +1919,17 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
return {.success = false, .error = "Workspace not found"}; // ????
if (args == "allpseudo") {
PWORKSPACE->m_bDefaultPseudo = !PWORKSPACE->m_bDefaultPseudo;
PWORKSPACE->m_defaultPseudo = !PWORKSPACE->m_defaultPseudo;
// apply
for (auto const& w : g_pCompositor->m_windows) {
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE)
continue;
w->m_bIsPseudotiled = PWORKSPACE->m_bDefaultPseudo;
w->m_bIsPseudotiled = PWORKSPACE->m_defaultPseudo;
}
} else if (args == "allfloat") {
PWORKSPACE->m_bDefaultFloating = !PWORKSPACE->m_bDefaultFloating;
PWORKSPACE->m_defaultFloating = !PWORKSPACE->m_defaultFloating;
// apply
// we make a copy because changeWindowFloatingMode might invalidate the iterator
@ -1939,14 +1939,14 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
continue;
if (!w->m_bRequestsFloat && w->m_bIsFloating != PWORKSPACE->m_bDefaultFloating) {
if (!w->m_bRequestsFloat && w->m_bIsFloating != PWORKSPACE->m_defaultFloating) {
const auto SAVEDPOS = w->m_vRealPosition->goal();
const auto SAVEDSIZE = w->m_vRealSize->goal();
w->m_bIsFloating = PWORKSPACE->m_bDefaultFloating;
w->m_bIsFloating = PWORKSPACE->m_defaultFloating;
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(w);
if (PWORKSPACE->m_bDefaultFloating) {
if (PWORKSPACE->m_defaultFloating) {
w->m_vRealPosition->setValueAndWarp(SAVEDPOS);
w->m_vRealSize->setValueAndWarp(SAVEDSIZE);
*w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4);
@ -2082,11 +2082,11 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
if (!pWorkspace)
pWorkspace = g_pCompositor->createNewWorkspace(PREVWS.id, PCURRMONITOR->ID, PREVWS.name);
workspaceID = pWorkspace->m_iID;
workspaceID = pWorkspace->m_id;
}
if (pWorkspace->m_pMonitor != PCURRMONITOR) {
const auto POLDMONITOR = pWorkspace->m_pMonitor.lock();
if (pWorkspace->m_monitor != PCURRMONITOR) {
const auto POLDMONITOR = pWorkspace->m_monitor.lock();
if (!POLDMONITOR) { // wat
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!");
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"};
@ -2319,9 +2319,9 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
changeworkspace(PWORKSPACE->getConfigName());
}
if (PWORKSPACE->m_bHasFullscreenWindow) {
if (PWORKSPACE->m_hasFullscreenWindow) {
const auto FSWINDOW = PWORKSPACE->getFullscreenWindow();
const auto FSMODE = PWORKSPACE->m_efFullscreenMode;
const auto FSMODE = PWORKSPACE->m_fullscreenMode;
if (PWINDOW->m_bIsFloating) {
// don't make floating implicitly fs
@ -2775,7 +2775,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
PWORKSPACE->m_pLastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
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)});
EMIT_HOOK_EVENT("pin", PWINDOW);

View file

@ -149,7 +149,7 @@ void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hots
surf->resource()->map();
currentCursorImage.destroySurface = surf->events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
currentCursorImage.destroySurface = surf->m_events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
currentCursorImage.commitSurface = surf->resource()->events.commit.registerListener([this](std::any data) {
damageIfSoftware();
currentCursorImage.size = currentCursorImage.surface->resource()->current.texture ? currentCursorImage.surface->resource()->current.bufferSize : Vector2D{};

View file

@ -74,7 +74,7 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
}
if (!pWindow->m_bPinned)
pWindow->m_pWorkspace->m_pLastFocusedWindow = pWindow;
pWindow->m_pWorkspace->m_lastFocusedWindow = pWindow;
}
CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) {

View file

@ -24,7 +24,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
return;
}
PINHIBIT->surfaceDestroyListener = WLSurface->events.destroy.registerListener(
PINHIBIT->surfaceDestroyListener = WLSurface->m_events.destroy.registerListener(
[this, PINHIBIT](std::any data) { std::erase_if(m_vIdleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); });
recheckIdleInhibitorStatus();

View file

@ -338,12 +338,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// then, we check if the workspace doesnt have a fullscreen window
const auto PWORKSPACE = PMONITOR->activeWorkspace;
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
if (PWORKSPACE->m_bHasFullscreenWindow && !foundSurface && PWORKSPACE->m_efFullscreenMode == FSMODE_FULLSCREEN) {
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
pFoundWindow = PWORKSPACE->getFullscreenWindow();
if (!pFoundWindow) {
// what the fuck, somehow happens occasionally??
PWORKSPACE->m_bHasFullscreenWindow = false;
PWORKSPACE->m_hasFullscreenWindow = false;
return;
}
@ -363,7 +363,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// then windows
if (!foundSurface) {
if (PWORKSPACE->m_bHasFullscreenWindow && PWORKSPACE->m_efFullscreenMode == FSMODE_MAXIMIZED) {
if (PWORKSPACE->m_hasFullscreenWindow && PWORKSPACE->m_fullscreenMode == FSMODE_MAXIMIZED) {
if (!foundSurface) {
if (PMONITOR->activeSpecialWorkspace) {
if (pFoundWindow != PWINDOWIDEAL)

View file

@ -18,7 +18,7 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
int onMonitor = 0;
for (auto const& w : g_pCompositor->m_workspaces) {
if (w->m_pMonitor == g_pCompositor->m_lastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_iID))
if (w->m_monitor == g_pCompositor->m_lastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_id))
onMonitor++;
}
@ -31,7 +31,7 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_szName);
Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_name);
m_sActiveSwipe.pWorkspaceBegin = PWORKSPACE;
m_sActiveSwipe.delta = 0;
@ -39,7 +39,7 @@ void CInputManager::beginWorkspaceSwipe() {
m_sActiveSwipe.avgSpeed = 0;
m_sActiveSwipe.speedPoints = 0;
if (PWORKSPACE->m_bHasFullscreenWindow) {
if (PWORKSPACE->m_hasFullscreenWindow) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
*ls->m_alpha = 1.f;
}
@ -61,7 +61,7 @@ void CInputManager::endWorkspaceSwipe() {
static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
static auto PSWIPEUSER = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_use_r");
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
// commit
@ -71,14 +71,14 @@ void CInputManager::endWorkspaceSwipe() {
// If we've been swiping off the right end with PSWIPENEW enabled, there is
// no workspace there yet, and we need to choose an ID for a new one now.
if (workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID && *PSWIPENEW) {
if (workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_id && *PSWIPENEW) {
workspaceIDRight = getWorkspaceIDNameFromString("r+1").id;
}
auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER
auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->value();
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->value();
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
@ -89,35 +89,35 @@ void CInputManager::endWorkspaceSwipe() {
// revert
if (abs(m_sActiveSwipe.delta) < 2) {
if (PWORKSPACEL)
PWORKSPACEL->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
PWORKSPACEL->m_renderOffset->setValueAndWarp(Vector2D(0, 0));
if (PWORKSPACER)
PWORKSPACER->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0, 0));
PWORKSPACER->m_renderOffset->setValueAndWarp(Vector2D(0, 0));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(0, 0));
} else {
if (m_sActiveSwipe.delta < 0) {
// to left
if (PWORKSPACEL) {
if (VERTANIMS)
*PWORKSPACEL->m_vRenderOffset = Vector2D{0.0, -YDISTANCE};
*PWORKSPACEL->m_renderOffset = Vector2D{0.0, -YDISTANCE};
else
*PWORKSPACEL->m_vRenderOffset = Vector2D{-XDISTANCE, 0.0};
*PWORKSPACEL->m_renderOffset = Vector2D{-XDISTANCE, 0.0};
}
} else if (PWORKSPACER) {
// to right
if (VERTANIMS)
*PWORKSPACER->m_vRenderOffset = Vector2D{0.0, YDISTANCE};
*PWORKSPACER->m_renderOffset = Vector2D{0.0, YDISTANCE};
else
*PWORKSPACER->m_vRenderOffset = Vector2D{XDISTANCE, 0.0};
*PWORKSPACER->m_renderOffset = Vector2D{XDISTANCE, 0.0};
}
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
*m_sActiveSwipe.pWorkspaceBegin->m_renderOffset = Vector2D();
}
pSwitchedTo = m_sActiveSwipe.pWorkspaceBegin;
} else if (m_sActiveSwipe.delta < 0) {
// switch to left
const auto RENDEROFFSET = PWORKSPACEL ? PWORKSPACEL->m_vRenderOffset->value() : Vector2D();
const auto RENDEROFFSET = PWORKSPACEL ? PWORKSPACEL->m_renderOffset->value() : Vector2D();
if (PWORKSPACEL)
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDLeft);
@ -127,15 +127,15 @@ void CInputManager::endWorkspaceSwipe() {
PWORKSPACEL->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin);
}
PWORKSPACEL->m_vRenderOffset->setValue(RENDEROFFSET);
PWORKSPACEL->m_fAlpha->setValueAndWarp(1.f);
PWORKSPACEL->m_renderOffset->setValue(RENDEROFFSET);
PWORKSPACEL->m_alpha->setValueAndWarp(1.f);
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValue(RENDEROFFSETMIDDLE);
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValue(RENDEROFFSETMIDDLE);
if (VERTANIMS)
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, YDISTANCE);
*m_sActiveSwipe.pWorkspaceBegin->m_renderOffset = Vector2D(0.0, YDISTANCE);
else
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(XDISTANCE, 0.0);
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha->setValueAndWarp(1.f);
*m_sActiveSwipe.pWorkspaceBegin->m_renderOffset = Vector2D(XDISTANCE, 0.0);
m_sActiveSwipe.pWorkspaceBegin->m_alpha->setValueAndWarp(1.f);
g_pInputManager->unconstrainMouse();
@ -144,7 +144,7 @@ void CInputManager::endWorkspaceSwipe() {
pSwitchedTo = PWORKSPACEL;
} else {
// switch to right
const auto RENDEROFFSET = PWORKSPACER ? PWORKSPACER->m_vRenderOffset->value() : Vector2D();
const auto RENDEROFFSET = PWORKSPACER ? PWORKSPACER->m_renderOffset->value() : Vector2D();
if (PWORKSPACER)
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDRight);
@ -154,15 +154,15 @@ void CInputManager::endWorkspaceSwipe() {
PWORKSPACER->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin);
}
PWORKSPACER->m_vRenderOffset->setValue(RENDEROFFSET);
PWORKSPACER->m_fAlpha->setValueAndWarp(1.f);
PWORKSPACER->m_renderOffset->setValue(RENDEROFFSET);
PWORKSPACER->m_alpha->setValueAndWarp(1.f);
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValue(RENDEROFFSETMIDDLE);
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValue(RENDEROFFSETMIDDLE);
if (VERTANIMS)
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0.0, -YDISTANCE);
*m_sActiveSwipe.pWorkspaceBegin->m_renderOffset = Vector2D(0.0, -YDISTANCE);
else
*m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-XDISTANCE, 0.0);
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha->setValueAndWarp(1.f);
*m_sActiveSwipe.pWorkspaceBegin->m_renderOffset = Vector2D(-XDISTANCE, 0.0);
m_sActiveSwipe.pWorkspaceBegin->m_alpha->setValueAndWarp(1.f);
g_pInputManager->unconstrainMouse();
@ -175,10 +175,10 @@ void CInputManager::endWorkspaceSwipe() {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock());
if (PWORKSPACEL)
PWORKSPACEL->m_bForceRendering = false;
PWORKSPACEL->m_forceRendering = false;
if (PWORKSPACER)
PWORKSPACER->m_bForceRendering = false;
m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = false;
PWORKSPACER->m_forceRendering = false;
m_sActiveSwipe.pWorkspaceBegin->m_forceRendering = false;
m_sActiveSwipe.pWorkspaceBegin = nullptr;
m_sActiveSwipe.initialDirection = 0;
@ -187,7 +187,7 @@ void CInputManager::endWorkspaceSwipe() {
// apply alpha
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
*ls->m_alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
*ls->m_alpha = pSwitchedTo->m_hasFullscreenWindow && pSwitchedTo->m_fullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
}
}
@ -197,7 +197,7 @@ void CInputManager::onSwipeUpdate(IPointer::SSwipeUpdateEvent e) {
if (!m_sActiveSwipe.pWorkspaceBegin)
return;
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_invert");
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
const double delta = m_sActiveSwipe.delta + (VERTANIMS ? (*PSWIPEINVR ? -e.delta.y : e.delta.y) : (*PSWIPEINVR ? -e.delta.x : e.delta.x));
@ -216,7 +216,7 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX);
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
const double d = m_sActiveSwipe.delta - delta;
m_sActiveSwipe.delta = delta;
@ -227,18 +227,18 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
auto workspaceIDLeft = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r-1" : "m-1")).id;
auto workspaceIDRight = getWorkspaceIDNameFromString((*PSWIPEUSER ? "r+1" : "m+1")).id;
if ((workspaceIDLeft == WORKSPACE_INVALID || workspaceIDRight == WORKSPACE_INVALID || workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_iID) && !*PSWIPENEW) {
if ((workspaceIDLeft == WORKSPACE_INVALID || workspaceIDRight == WORKSPACE_INVALID || workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_id) && !*PSWIPENEW) {
m_sActiveSwipe.pWorkspaceBegin = nullptr; // invalidate the swipe
return;
}
m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = true;
m_sActiveSwipe.pWorkspaceBegin->m_forceRendering = true;
m_sActiveSwipe.delta = std::clamp(m_sActiveSwipe.delta, (double)-SWIPEDISTANCE, (double)SWIPEDISTANCE);
if ((m_sActiveSwipe.pWorkspaceBegin->m_iID == workspaceIDLeft && *PSWIPENEW && (m_sActiveSwipe.delta < 0)) ||
(m_sActiveSwipe.delta > 0 && m_sActiveSwipe.pWorkspaceBegin->getWindows() == 0 && workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID) ||
(m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_iID <= workspaceIDLeft)) {
if ((m_sActiveSwipe.pWorkspaceBegin->m_id == workspaceIDLeft && *PSWIPENEW && (m_sActiveSwipe.delta < 0)) ||
(m_sActiveSwipe.delta > 0 && m_sActiveSwipe.pWorkspaceBegin->getWindows() == 0 && workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_id) ||
(m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_id <= workspaceIDLeft)) {
m_sActiveSwipe.delta = 0;
return;
@ -254,14 +254,14 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
if (m_sActiveSwipe.delta < 0) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
if (workspaceIDLeft > m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) {
if (workspaceIDLeft > m_sActiveSwipe.pWorkspaceBegin->m_id || !PWORKSPACE) {
if (*PSWIPENEW) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock());
if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->updateWindowDecos();
return;
@ -270,38 +270,38 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
return;
}
PWORKSPACE->m_bForceRendering = true;
PWORKSPACE->m_fAlpha->setValueAndWarp(1.f);
PWORKSPACE->m_forceRendering = true;
PWORKSPACE->m_alpha->setValueAndWarp(1.f);
if (workspaceIDLeft != workspaceIDRight && workspaceIDRight != m_sActiveSwipe.pWorkspaceBegin->m_iID) {
if (workspaceIDLeft != workspaceIDRight && workspaceIDRight != m_sActiveSwipe.pWorkspaceBegin->m_id) {
const auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
if (PWORKSPACER) {
PWORKSPACER->m_bForceRendering = false;
PWORKSPACER->m_fAlpha->setValueAndWarp(0.f);
PWORKSPACER->m_forceRendering = false;
PWORKSPACER->m_alpha->setValueAndWarp(0.f);
}
}
if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE - YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
PWORKSPACE->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE - YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
} else {
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE - XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
PWORKSPACE->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE - XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
}
PWORKSPACE->updateWindowDecos();
} else {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDRight);
if (workspaceIDRight < m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) {
if (workspaceIDRight < m_sActiveSwipe.pWorkspaceBegin->m_id || !PWORKSPACE) {
if (*PSWIPENEW) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor.lock());
if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->updateWindowDecos();
return;
@ -310,24 +310,24 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
return;
}
PWORKSPACE->m_bForceRendering = true;
PWORKSPACE->m_fAlpha->setValueAndWarp(1.f);
PWORKSPACE->m_forceRendering = true;
PWORKSPACE->m_alpha->setValueAndWarp(1.f);
if (workspaceIDLeft != workspaceIDRight && workspaceIDLeft != m_sActiveSwipe.pWorkspaceBegin->m_iID) {
if (workspaceIDLeft != workspaceIDRight && workspaceIDLeft != m_sActiveSwipe.pWorkspaceBegin->m_id) {
const auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
if (PWORKSPACEL) {
PWORKSPACEL->m_bForceRendering = false;
PWORKSPACEL->m_fAlpha->setValueAndWarp(0.f);
PWORKSPACEL->m_forceRendering = false;
PWORKSPACEL->m_alpha->setValueAndWarp(0.f);
}
}
if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE + YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
PWORKSPACE->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE + YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(0.0, ((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * YDISTANCE));
} else {
PWORKSPACE->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE + XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
PWORKSPACE->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE + XDISTANCE, 0.0));
m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / SWIPEDISTANCE) * XDISTANCE, 0.0));
}
PWORKSPACE->updateWindowDecos();

View file

@ -44,7 +44,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
// TODO: Don't swipe if you touched a floating window.
} else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->m_layer <= 1) && !g_pSessionLockManager->isSessionLocked()) {
const auto PWORKSPACE = PMONITOR->activeWorkspace;
const auto STYLE = PWORKSPACE->m_vRenderOffset->getStyle();
const auto STYLE = PWORKSPACE->m_renderOffset->getStyle();
const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert");
const double TARGETLEFT = ((VERTANIMS ? gapsOut.m_top : gapsOut.m_left) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x);
const double TARGETRIGHT = 1 - (((VERTANIMS ? gapsOut.m_bottom : gapsOut.m_right) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x));
@ -121,7 +121,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
if (e.touchID != m_sActiveSwipe.touch_id)
return;
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset->getStyle();
const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle();
const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert");
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert");
static auto PSWIPEDIST = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_distance");