helpers: refactor class member vars (#10218)

This commit is contained in:
davc0n 2025-04-30 23:45:20 +02:00 committed by GitHub
parent b8a204c21d
commit 50e1bec85f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1770 additions and 1769 deletions

View file

@ -217,7 +217,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
bool skipFrameSchedule = PMONITOR->shouldSkipScheduleFrameOnMouseEvent();
if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) && !skipFrameSchedule)
if (!PMONITOR->m_solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) && !skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
// constraints
@ -252,13 +252,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
if (g_pSessionLockManager->isSessionLocked()) {
// set keyboard focus on session lock surface regardless of layers
const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID);
const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id);
const auto foundLockSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr;
g_pCompositor->focusSurface(foundLockSurface);
// search for interactable abovelock surfaces for pointer focus, or use session lock surface if not found
for (auto& lsl : PMONITOR->m_aLayerSurfaceLayers | std::views::reverse) {
for (auto& lsl : PMONITOR->m_layerSurfaceLayers | std::views::reverse) {
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &lsl, &surfaceCoords, &pFoundLayerSurface, true);
if (foundSurface)
@ -266,7 +266,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
}
if (!foundSurface) {
surfaceCoords = mouseCoords - PMONITOR->vecPosition;
surfaceCoords = mouseCoords - PMONITOR->m_position;
foundSurface = foundLockSurface;
}
@ -336,7 +336,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// overlays are above fullscreen
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
// also IME popups
if (!foundSurface) {
@ -349,10 +349,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// also top layers
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
// then, we check if the workspace doesnt have a fullscreen window
const auto PWORKSPACE = PMONITOR->activeWorkspace;
const auto PWORKSPACE = PMONITOR->m_activeWorkspace;
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
pFoundWindow = PWORKSPACE->getFullscreenWindow();
@ -365,7 +365,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
if (PWINDOWIDEAL &&
((PWINDOWIDEAL->m_isFloating && PWINDOWIDEAL->m_createdOverFullscreen) /* floating over fullscreen */
|| (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */))
|| (PMONITOR->m_activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */))
pFoundWindow = PWINDOWIDEAL;
if (!pFoundWindow->m_isX11) {
@ -381,7 +381,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
if (!foundSurface) {
if (PWORKSPACE->m_hasFullscreenWindow && PWORKSPACE->m_fullscreenMode == FSMODE_MAXIMIZED) {
if (!foundSurface) {
if (PMONITOR->activeSpecialWorkspace) {
if (PMONITOR->m_activeSpecialWorkspace) {
if (pFoundWindow != PWINDOWIDEAL)
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
@ -391,7 +391,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
} else {
// if we have a maximized window, allow focusing on a bar or something if in reserved area.
if (g_pCompositor->isPointOnReservedArea(mouseCoords, PMONITOR)) {
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords,
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords,
&pFoundLayerSurface);
}
@ -426,13 +426,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// then surfaces below
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface);
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface)
foundSurface =
g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface);
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface);
if (g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) > 0 && !skipFrameSchedule)
if (g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) > 0 && !skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_lastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
// FIXME: This will be disabled during DnD operations because we do not exactly follow the spec
@ -1471,14 +1470,14 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
// then any surfaces above windows on the same monitor
if (!foundSurface) {
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&surfaceCoords, &pFoundLayerSurface);
if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND)
foundSurface = nullptr;
}
if (!foundSurface) {
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&surfaceCoords, &pFoundLayerSurface);
if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND)
foundSurface = nullptr;
@ -1636,7 +1635,7 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
PTOUCHDEV->m_boundOutput = bound ? output : "";
const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr;
if (PMONITOR) {
Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->szName);
Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->m_name);
// wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, &PTOUCHDEV->wlr()->base, PMONITOR->output);
} else if (bound)
Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output);

View file

@ -40,7 +40,7 @@ void CInputPopup::onMap() {
if (!PMONITOR)
return;
PROTO::fractional->sendScale(surface->resource(), PMONITOR->scale);
PROTO::fractional->sendScale(surface->resource(), PMONITOR->m_scale);
}
void CInputPopup::onUnmap() {
@ -108,12 +108,12 @@ void CInputPopup::updateBox() {
Vector2D popupOffset(0, 0);
if (parentBox.y + cursorBoxParent.y + cursorBoxParent.height + currentPopupSize.y > pMonitor->vecPosition.y + pMonitor->vecSize.y)
if (parentBox.y + cursorBoxParent.y + cursorBoxParent.height + currentPopupSize.y > pMonitor->m_position.y + pMonitor->m_size.y)
popupOffset.y -= currentPopupSize.y;
else
popupOffset.y = cursorBoxParent.height;
double popupOverflow = parentBox.x + cursorBoxParent.x + currentPopupSize.x - (pMonitor->vecPosition.x + pMonitor->vecSize.x);
double popupOverflow = parentBox.x + cursorBoxParent.x + currentPopupSize.x - (pMonitor->m_position.x + pMonitor->m_size.x);
if (popupOverflow > 0)
popupOffset.x -= popupOverflow;
@ -127,15 +127,15 @@ void CInputPopup::updateBox() {
}
damageSurface();
if (const auto PM = g_pCompositor->getMonitorFromCursor(); PM && PM->ID != lastMonitor) {
if (const auto PM = g_pCompositor->getMonitorFromCursor(); PM && PM->m_id != lastMonitor) {
const auto PML = g_pCompositor->getMonitorFromID(lastMonitor);
if (PML)
surface->resource()->leave(PML->self.lock());
surface->resource()->leave(PML->m_self.lock());
surface->resource()->enter(PM->self.lock());
surface->resource()->enter(PM->m_self.lock());
lastMonitor = PM->ID;
lastMonitor = PM->m_id;
}
}

View file

@ -29,7 +29,7 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
}
void CInputManager::beginWorkspaceSwipe() {
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace;
Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_name);
@ -40,7 +40,7 @@ void CInputManager::beginWorkspaceSwipe() {
m_sActiveSwipe.speedPoints = 0;
if (PWORKSPACE->m_hasFullscreenWindow) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) {
*ls->m_alpha = 1.f;
}
}
@ -79,8 +79,8 @@ void CInputManager::endWorkspaceSwipe() {
auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER
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;
const auto XDISTANCE = m_sActiveSwipe.pMonitor->m_size.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->m_size.y + *PWORKSPACEGAP;
PHLWORKSPACE pSwitchedTo = nullptr;
@ -122,7 +122,7 @@ void CInputManager::endWorkspaceSwipe() {
if (PWORKSPACEL)
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDLeft);
else {
m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDLeft, m_sActiveSwipe.pMonitor->ID));
m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDLeft, m_sActiveSwipe.pMonitor->m_id));
PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
PWORKSPACEL->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin);
}
@ -149,7 +149,7 @@ void CInputManager::endWorkspaceSwipe() {
if (PWORKSPACER)
m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDRight);
else {
m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDRight, m_sActiveSwipe.pMonitor->ID));
m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDRight, m_sActiveSwipe.pMonitor->m_id));
PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
PWORKSPACER->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin);
}
@ -186,7 +186,7 @@ void CInputManager::endWorkspaceSwipe() {
g_pInputManager->refocus();
// apply alpha
for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) {
for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) {
*ls->m_alpha = pSwitchedTo->m_hasFullscreenWindow && pSwitchedTo->m_fullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
}
}
@ -214,8 +214,8 @@ void CInputManager::updateWorkspaceSwipe(double delta) {
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
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 XDISTANCE = m_sActiveSwipe.pMonitor->m_size.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->m_size.y + *PWORKSPACEGAP;
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;

View file

@ -27,7 +27,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock();
g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);
g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true);
refocus();
@ -43,11 +43,11 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
return;
// 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 PWORKSPACE = PMONITOR->m_activeWorkspace;
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));
const double TARGETLEFT = ((VERTANIMS ? gapsOut.m_top : gapsOut.m_left) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->m_size.y : PMONITOR->m_size.x);
const double TARGETRIGHT = 1 - (((VERTANIMS ? gapsOut.m_bottom : gapsOut.m_right) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->m_size.y : PMONITOR->m_size.x));
const double POSITION = (VERTANIMS ? e.pos.y : e.pos.x);
if (POSITION < TARGETLEFT || POSITION > TARGETRIGHT) {
beginWorkspaceSwipe();
@ -62,7 +62,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
}
if (g_pSessionLockManager->isSessionLocked()) {
m_sTouchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID);
m_sTouchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id);
if (!m_sTouchData.touchFocusLockSurface)
Debug::log(WARN, "The session is locked but can't find a lock surface");
else
@ -77,7 +77,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
Vector2D local;
if (m_sTouchData.touchFocusLockSurface) {
local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition;
local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position;
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
} else if (!m_sTouchData.touchFocusWindow.expired()) {
if (m_sTouchData.touchFocusWindow->m_isX11) {
@ -144,13 +144,13 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
}
if (m_sTouchData.touchFocusLockSurface) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLockSurface->iMonitorID);
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() - PMONITOR->vecPosition;
g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true);
auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position;
g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local);
} else if (validMapped(m_sTouchData.touchFocusWindow)) {
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);
g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true);
auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
if (m_sTouchData.touchFocusWindow->m_isX11)
@ -160,7 +160,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
} else if (!m_sTouchData.touchFocusLS.expired()) {
const auto PMONITOR = m_sTouchData.touchFocusLS->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);
g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true);
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;