helpers: refactor class member vars (#10218)
This commit is contained in:
parent
b8a204c21d
commit
50e1bec85f
63 changed files with 1770 additions and 1769 deletions
|
|
@ -24,7 +24,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
return pLS;
|
||||
}
|
||||
|
||||
if (pMonitor->pMirrorOf)
|
||||
if (pMonitor->m_mirrorOf)
|
||||
pMonitor = g_pCompositor->m_monitors.front();
|
||||
|
||||
pLS->m_self = pLS;
|
||||
|
|
@ -34,7 +34,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
pLS->m_layer = resource->current.layer;
|
||||
pLS->m_popupHead = CPopup::create(pLS);
|
||||
pLS->m_monitor = pMonitor;
|
||||
pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS);
|
||||
pMonitor->m_layerSurfaceLayers[resource->current.layer].emplace_back(pLS);
|
||||
|
||||
pLS->m_forceBlur = g_pConfigManager->shouldBlurLS(pLS->m_namespace);
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
|||
|
||||
pLS->m_alpha->setValueAndWarp(0.f);
|
||||
|
||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->m_layer, pMonitor->szName);
|
||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->m_layer, pMonitor->m_name);
|
||||
|
||||
return pLS;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ CLayerSurface::~CLayerSurface() {
|
|||
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == m_self.lock(); });
|
||||
|
||||
for (auto const& mon : g_pCompositor->m_realMonitors) {
|
||||
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
|
||||
for (auto& lsl : mon->m_layerSurfaceLayers) {
|
||||
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
|
||||
}
|
||||
}
|
||||
|
|
@ -110,11 +110,11 @@ void CLayerSurface::onDestroy() {
|
|||
|
||||
// rearrange to fix the reserved areas
|
||||
if (PMONITOR) {
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
PMONITOR->scheduledRecalc = true;
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||
PMONITOR->m_scheduledRecalc = true;
|
||||
|
||||
// and damage
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height};
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
||||
g_pHyprRenderer->damageBox(geomFixed);
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +149,11 @@ void CLayerSurface::onMap() {
|
|||
|
||||
applyRules();
|
||||
|
||||
PMONITOR->scheduledRecalc = true;
|
||||
PMONITOR->m_scheduledRecalc = true;
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||
|
||||
m_surface->resource()->enter(PMONITOR->self.lock());
|
||||
m_surface->resource()->enter(PMONITOR->m_self.lock());
|
||||
|
||||
const bool ISEXCLUSIVE = m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||
|
||||
|
|
@ -171,16 +171,16 @@ void CLayerSurface::onMap() {
|
|||
g_pInputManager->releaseAllMouseButtons();
|
||||
g_pCompositor->focusSurface(m_surface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y);
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||
}
|
||||
|
||||
m_position = Vector2D(m_geometry.x, m_geometry.y);
|
||||
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height};
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
||||
g_pHyprRenderer->damageBox(geomFixed);
|
||||
const bool FULLSCREEN = PMONITOR->activeWorkspace && PMONITOR->activeWorkspace->m_hasFullscreenWindow && PMONITOR->activeWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN;
|
||||
const bool FULLSCREEN = PMONITOR->m_activeWorkspace && PMONITOR->m_activeWorkspace->m_hasFullscreenWindow && PMONITOR->m_activeWorkspace->m_fullscreenMode == FSMODE_FULLSCREEN;
|
||||
|
||||
startAnimation(!(m_layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN && !GRABSFOCUS));
|
||||
m_readyToDelete = false;
|
||||
|
|
@ -189,8 +189,8 @@ void CLayerSurface::onMap() {
|
|||
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", m_namespace});
|
||||
EMIT_HOOK_EVENT("openLayer", m_self.lock());
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::onUnmap() {
|
||||
|
|
@ -244,16 +244,16 @@ void CLayerSurface::onUnmap() {
|
|||
} else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != m_surface->resource())
|
||||
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_lastFocus.lock());
|
||||
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y, m_geometry.width, m_geometry.height};
|
||||
CBox geomFixed = {m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y, m_geometry.width, m_geometry.height};
|
||||
g_pHyprRenderer->damageBox(geomFixed);
|
||||
|
||||
geomFixed = {m_geometry.x + (int)PMONITOR->vecPosition.x, m_geometry.y + (int)PMONITOR->vecPosition.y, (int)m_layerSurface->surface->current.size.x,
|
||||
geomFixed = {m_geometry.x + (int)PMONITOR->m_position.x, m_geometry.y + (int)PMONITOR->m_position.y, (int)m_layerSurface->surface->current.size.x,
|
||||
(int)m_layerSurface->surface->current.size.y};
|
||||
g_pHyprRenderer->damageBox(geomFixed);
|
||||
|
||||
g_pInputManager->simulateMouseMovement();
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||
}
|
||||
|
||||
void CLayerSurface::onCommit() {
|
||||
|
|
@ -285,12 +285,12 @@ void CLayerSurface::onCommit() {
|
|||
if (m_layerSurface->current.committed != 0) {
|
||||
if (m_layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) {
|
||||
|
||||
for (auto it = PMONITOR->m_aLayerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[m_layer].end(); it++) {
|
||||
for (auto it = PMONITOR->m_layerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_layerSurfaceLayers[m_layer].end(); it++) {
|
||||
if (*it == m_self) {
|
||||
if (m_layerSurface->current.layer == m_layer)
|
||||
break;
|
||||
PMONITOR->m_aLayerSurfaceLayers[m_layerSurface->current.layer].emplace_back(*it);
|
||||
PMONITOR->m_aLayerSurfaceLayers[m_layer].erase(it);
|
||||
PMONITOR->m_layerSurfaceLayers[m_layerSurface->current.layer].emplace_back(*it);
|
||||
PMONITOR->m_layerSurfaceLayers[m_layer].erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -301,14 +301,14 @@ void CLayerSurface::onCommit() {
|
|||
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
|
||||
}
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->m_id);
|
||||
|
||||
PMONITOR->scheduledRecalc = true;
|
||||
PMONITOR->m_scheduledRecalc = true;
|
||||
} else {
|
||||
m_position = Vector2D(m_geometry.x, m_geometry.y);
|
||||
|
||||
// update geom if it changed
|
||||
if (m_layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && m_layerSurface->surface->current.viewport.hasDestination) {
|
||||
if (m_layerSurface->surface->current.scale == 1 && PMONITOR->m_scale != 1.f && m_layerSurface->surface->current.viewport.hasDestination) {
|
||||
// fractional scaling. Dirty hack.
|
||||
m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.viewport.destination};
|
||||
} else {
|
||||
|
|
@ -364,7 +364,7 @@ void CLayerSurface::onCommit() {
|
|||
g_pInputManager->releaseAllMouseButtons();
|
||||
g_pCompositor->focusSurface(m_surface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->vecPosition.x, m_geometry.y + PMONITOR->vecPosition.y);
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_geometry.x + PMONITOR->m_position.x, m_geometry.y + PMONITOR->m_position.y);
|
||||
g_pSeatManager->setPointerFocus(m_surface->resource(), LOCAL);
|
||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||
}
|
||||
|
|
@ -374,8 +374,8 @@ void CLayerSurface::onCommit() {
|
|||
|
||||
g_pHyprRenderer->damageSurface(m_surface->resource(), m_position.x, m_position.y);
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_surface->resource(), PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(m_surface->resource(), PMONITOR->m_transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::applyRules() {
|
||||
|
|
@ -484,10 +484,10 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
}
|
||||
|
||||
const std::array<Vector2D, 4> edgePoints = {
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0.0},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, PMONITOR->vecSize.y},
|
||||
PMONITOR->vecPosition + Vector2D{0.0, PMONITOR->vecSize.y},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x, PMONITOR->vecSize.y / 2},
|
||||
PMONITOR->m_position + Vector2D{PMONITOR->m_size.x / 2, 0.0},
|
||||
PMONITOR->m_position + Vector2D{PMONITOR->m_size.x / 2, PMONITOR->m_size.y},
|
||||
PMONITOR->m_position + Vector2D{0.0, PMONITOR->m_size.y},
|
||||
PMONITOR->m_position + Vector2D{PMONITOR->m_size.x, PMONITOR->m_size.y / 2},
|
||||
};
|
||||
|
||||
float closest = std::numeric_limits<float>::max();
|
||||
|
|
@ -511,19 +511,19 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
switch (leader) {
|
||||
case 0:
|
||||
// TOP
|
||||
prePos = {m_geometry.x, PMONITOR->vecPosition.y - m_geometry.h};
|
||||
prePos = {m_geometry.x, PMONITOR->m_position.y - m_geometry.h};
|
||||
break;
|
||||
case 1:
|
||||
// BOTTOM
|
||||
prePos = {m_geometry.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y};
|
||||
prePos = {m_geometry.x, PMONITOR->m_position.y + PMONITOR->m_size.y};
|
||||
break;
|
||||
case 2:
|
||||
// LEFT
|
||||
prePos = {PMONITOR->vecPosition.x - m_geometry.w, m_geometry.y};
|
||||
prePos = {PMONITOR->m_position.x - m_geometry.w, m_geometry.y};
|
||||
break;
|
||||
case 3:
|
||||
// RIGHT
|
||||
prePos = {PMONITOR->vecPosition.x + PMONITOR->vecSize.x, m_geometry.y};
|
||||
prePos = {PMONITOR->m_position.x + PMONITOR->m_size.x, m_geometry.y};
|
||||
break;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
|
|
@ -594,7 +594,7 @@ int CLayerSurface::popupsCount() {
|
|||
}
|
||||
|
||||
MONITORID CLayerSurface::monitorID() {
|
||||
return m_monitor ? m_monitor->ID : MONITOR_INVALID;
|
||||
return m_monitor ? m_monitor->m_id : MONITOR_INVALID;
|
||||
}
|
||||
|
||||
pid_t CLayerSurface::getPID() {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void CPopup::onMap() {
|
|||
|
||||
//unconstrain();
|
||||
sendScale();
|
||||
m_resource->surface->surface->enter(PMONITOR->self.lock());
|
||||
m_resource->surface->surface->enter(PMONITOR->m_self.lock());
|
||||
|
||||
if (!m_layerOwner.expired() && m_layerOwner->m_layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_layerOwner->m_layer));
|
||||
|
|
@ -224,7 +224,7 @@ void CPopup::reposition() {
|
|||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
CBox box = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
|
||||
CBox box = {PMONITOR->m_position.x, PMONITOR->m_position.y, PMONITOR->m_size.x, PMONITOR->m_size.y};
|
||||
m_resource->applyPositioning(box, COORDS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ SBoxExtents CWindow::getFullWindowExtents() {
|
|||
|
||||
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)}};
|
||||
return {{m_realPosition->value().x - PMONITOR->m_position.x, m_realPosition->value().y - PMONITOR->m_position.y},
|
||||
{PMONITOR->m_size.x - (m_realPosition->value().x - PMONITOR->m_position.x), PMONITOR->m_size.y - (m_realPosition->value().y - PMONITOR->m_position.y)}};
|
||||
}
|
||||
|
||||
SBoxExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
|
||||
|
|
@ -197,7 +197,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
|
|||
CBox CWindow::getFullWindowBoundingBox() {
|
||||
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};
|
||||
return {PMONITOR->m_position.x, PMONITOR->m_position.y, PMONITOR->m_size.x, PMONITOR->m_size.y};
|
||||
}
|
||||
|
||||
auto maxExtents = getFullWindowExtents();
|
||||
|
|
@ -218,25 +218,25 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
|
|||
auto SIZE = m_size;
|
||||
|
||||
if (isFullscreen()) {
|
||||
POS = PMONITOR->vecPosition;
|
||||
SIZE = PMONITOR->vecSize;
|
||||
POS = PMONITOR->m_position;
|
||||
SIZE = PMONITOR->m_size;
|
||||
|
||||
return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
|
||||
}
|
||||
|
||||
if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) {
|
||||
POS.y = PMONITOR->vecPosition.y;
|
||||
SIZE.y += PMONITOR->vecReservedTopLeft.y;
|
||||
if (DELTALESSTHAN(POS.y - PMONITOR->m_position.y, PMONITOR->m_reservedTopLeft.y, 1)) {
|
||||
POS.y = PMONITOR->m_position.y;
|
||||
SIZE.y += PMONITOR->m_reservedTopLeft.y;
|
||||
}
|
||||
if (DELTALESSTHAN(POS.x - PMONITOR->vecPosition.x, PMONITOR->vecReservedTopLeft.x, 1)) {
|
||||
POS.x = PMONITOR->vecPosition.x;
|
||||
SIZE.x += PMONITOR->vecReservedTopLeft.x;
|
||||
if (DELTALESSTHAN(POS.x - PMONITOR->m_position.x, PMONITOR->m_reservedTopLeft.x, 1)) {
|
||||
POS.x = PMONITOR->m_position.x;
|
||||
SIZE.x += PMONITOR->m_reservedTopLeft.x;
|
||||
}
|
||||
if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->vecPosition.x, PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x, 1)) {
|
||||
SIZE.x += PMONITOR->vecReservedBottomRight.x;
|
||||
if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->m_position.x, PMONITOR->m_size.x - PMONITOR->m_reservedBottomRight.x, 1)) {
|
||||
SIZE.x += PMONITOR->m_reservedBottomRight.x;
|
||||
}
|
||||
if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->vecPosition.y, PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y, 1)) {
|
||||
SIZE.y += PMONITOR->vecReservedBottomRight.y;
|
||||
if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->m_position.y, PMONITOR->m_size.y - PMONITOR->m_reservedBottomRight.y, 1)) {
|
||||
SIZE.y += PMONITOR->m_reservedBottomRight.y;
|
||||
}
|
||||
|
||||
return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
|
||||
|
|
@ -246,7 +246,7 @@ CBox CWindow::getWindowBoxUnified(uint64_t properties) {
|
|||
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};
|
||||
return {PMONITOR->m_position.x, PMONITOR->m_position.y, PMONITOR->m_size.x, PMONITOR->m_size.y};
|
||||
}
|
||||
|
||||
SBoxExtents EXTENTS = {{0, 0}, {0, 0}};
|
||||
|
|
@ -385,10 +385,10 @@ void CWindow::updateSurfaceScaleTransformDetails(bool force) {
|
|||
return;
|
||||
|
||||
if (PNEWMONITOR != PLASTMONITOR || force) {
|
||||
if (PLASTMONITOR && PLASTMONITOR->m_bEnabled && PNEWMONITOR != PLASTMONITOR)
|
||||
m_wlSurface->resource()->breadthfirst([PLASTMONITOR](SP<CWLSurfaceResource> s, const Vector2D& offset, void* d) { s->leave(PLASTMONITOR->self.lock()); }, nullptr);
|
||||
if (PLASTMONITOR && PLASTMONITOR->m_enabled && PNEWMONITOR != PLASTMONITOR)
|
||||
m_wlSurface->resource()->breadthfirst([PLASTMONITOR](SP<CWLSurfaceResource> s, const Vector2D& offset, void* d) { s->leave(PLASTMONITOR->m_self.lock()); }, nullptr);
|
||||
|
||||
m_wlSurface->resource()->breadthfirst([PNEWMONITOR](SP<CWLSurfaceResource> s, const Vector2D& offset, void* d) { s->enter(PNEWMONITOR->self.lock()); }, nullptr);
|
||||
m_wlSurface->resource()->breadthfirst([PNEWMONITOR](SP<CWLSurfaceResource> s, const Vector2D& offset, void* d) { s->enter(PNEWMONITOR->m_self.lock()); }, nullptr);
|
||||
}
|
||||
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
|
|
@ -396,12 +396,12 @@ void CWindow::updateSurfaceScaleTransformDetails(bool force) {
|
|||
m_wlSurface->resource()->breadthfirst(
|
||||
[PMONITOR](SP<CWLSurfaceResource> s, const Vector2D& offset, void* d) {
|
||||
const auto PSURFACE = CWLSurface::fromResource(s);
|
||||
if (PSURFACE && PSURFACE->m_lastScaleFloat == PMONITOR->scale)
|
||||
if (PSURFACE && PSURFACE->m_lastScaleFloat == PMONITOR->m_scale)
|
||||
return;
|
||||
|
||||
PROTO::fractional->sendScale(s, PMONITOR->scale);
|
||||
g_pCompositor->setPreferredScaleForSurface(s, PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(s, PMONITOR->transform);
|
||||
PROTO::fractional->sendScale(s, PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredScaleForSurface(s, PMONITOR->m_scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(s, PMONITOR->m_transform);
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
|
@ -520,14 +520,14 @@ void CWindow::onUnmap() {
|
|||
|
||||
if (*PCLOSEONLASTSPECIAL && m_workspace && m_workspace->getWindows() == 0 && onSpecialWorkspace()) {
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace == m_workspace)
|
||||
if (PMONITOR && PMONITOR->m_activeSpecialWorkspace && PMONITOR->m_activeSpecialWorkspace == m_workspace)
|
||||
PMONITOR->setSpecialWorkspace(nullptr);
|
||||
}
|
||||
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
|
||||
if (PMONITOR && PMONITOR->solitaryClient == m_self)
|
||||
PMONITOR->solitaryClient.reset();
|
||||
if (PMONITOR && PMONITOR->m_solitaryClient == m_self)
|
||||
PMONITOR->m_solitaryClient.reset();
|
||||
|
||||
if (m_workspace) {
|
||||
m_workspace->updateWindows();
|
||||
|
|
@ -1248,7 +1248,7 @@ void CWindow::setSuspended(bool suspend) {
|
|||
bool CWindow::visibleOnMonitor(PHLMONITOR pMonitor) {
|
||||
CBox wbox = {m_realPosition->value(), m_realSize->value()};
|
||||
|
||||
return !wbox.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty();
|
||||
return !wbox.intersection({pMonitor->m_position, pMonitor->m_size}).empty();
|
||||
}
|
||||
|
||||
void CWindow::setAnimationsToMove() {
|
||||
|
|
@ -1274,21 +1274,21 @@ void CWindow::onWorkspaceAnimUpdate() {
|
|||
|
||||
const auto WINBB = getFullWindowBoundingBox();
|
||||
if (PWORKSPACE->m_renderOffset->value().x != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_renderOffset->value().x / PWSMON->vecSize.x;
|
||||
const auto PROGRESS = PWORKSPACE->m_renderOffset->value().x / PWSMON->m_size.x;
|
||||
|
||||
if (WINBB.x < PWSMON->vecPosition.x)
|
||||
offset.x += (PWSMON->vecPosition.x - WINBB.x) * PROGRESS;
|
||||
if (WINBB.x < PWSMON->m_position.x)
|
||||
offset.x += (PWSMON->m_position.x - WINBB.x) * PROGRESS;
|
||||
|
||||
if (WINBB.x + WINBB.width > PWSMON->vecPosition.x + PWSMON->vecSize.x)
|
||||
offset.x += (WINBB.x + WINBB.width - PWSMON->vecPosition.x - PWSMON->vecSize.x) * PROGRESS;
|
||||
if (WINBB.x + WINBB.width > PWSMON->m_position.x + PWSMON->m_size.x)
|
||||
offset.x += (WINBB.x + WINBB.width - PWSMON->m_position.x - PWSMON->m_size.x) * PROGRESS;
|
||||
} else if (PWORKSPACE->m_renderOffset->value().y != 0) {
|
||||
const auto PROGRESS = PWORKSPACE->m_renderOffset->value().y / PWSMON->vecSize.y;
|
||||
const auto PROGRESS = PWORKSPACE->m_renderOffset->value().y / PWSMON->m_size.y;
|
||||
|
||||
if (WINBB.y < PWSMON->vecPosition.y)
|
||||
offset.y += (PWSMON->vecPosition.y - WINBB.y) * PROGRESS;
|
||||
if (WINBB.y < PWSMON->m_position.y)
|
||||
offset.y += (PWSMON->m_position.y - WINBB.y) * PROGRESS;
|
||||
|
||||
if (WINBB.y + WINBB.height > PWSMON->vecPosition.y + PWSMON->vecSize.y)
|
||||
offset.y += (WINBB.y + WINBB.height - PWSMON->vecPosition.y - PWSMON->vecSize.y) * PROGRESS;
|
||||
if (WINBB.y + WINBB.height > PWSMON->m_position.y + PWSMON->m_size.y)
|
||||
offset.y += (WINBB.y + WINBB.height - PWSMON->m_position.y - PWSMON->m_size.y) * PROGRESS;
|
||||
}
|
||||
|
||||
m_floatingOffset = offset;
|
||||
|
|
@ -1342,7 +1342,7 @@ WORKSPACEID CWindow::workspaceID() {
|
|||
}
|
||||
|
||||
MONITORID CWindow::monitorID() {
|
||||
return m_monitor ? m_monitor->ID : MONITOR_INVALID;
|
||||
return m_monitor ? m_monitor->m_id : MONITOR_INVALID;
|
||||
}
|
||||
|
||||
bool CWindow::onSpecialWorkspace() {
|
||||
|
|
@ -1426,7 +1426,7 @@ void CWindow::onUpdateState() {
|
|||
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_self.lock(), monitor->activeWorkspace);
|
||||
g_pCompositor->moveWindowToWorkspaceSafe(m_self.lock(), monitor->m_activeWorkspace);
|
||||
g_pCompositor->setActiveMonitor(monitor);
|
||||
}
|
||||
|
||||
|
|
@ -1580,7 +1580,7 @@ void CWindow::onX11ConfigureRequest(CBox box) {
|
|||
if (!m_workspace || !m_workspace->isVisible())
|
||||
return; // further things are only for visible windows
|
||||
|
||||
m_workspace = g_pCompositor->getMonitorFromVector(m_realPosition->goal() + m_realSize->goal() / 2.f)->activeWorkspace;
|
||||
m_workspace = g_pCompositor->getMonitorFromVector(m_realPosition->goal() + m_realSize->goal() / 2.f)->m_activeWorkspace;
|
||||
|
||||
g_pCompositor->changeWindowZOrder(m_self.lock(), true);
|
||||
|
||||
|
|
@ -1711,7 +1711,7 @@ Vector2D CWindow::realToReportSize() {
|
|||
const auto PMONITOR = m_monitor.lock();
|
||||
|
||||
if (*PXWLFORCESCALEZERO && PMONITOR)
|
||||
return REPORTSIZE * PMONITOR->scale;
|
||||
return REPORTSIZE * PMONITOR->m_scale;
|
||||
|
||||
return REPORTSIZE;
|
||||
}
|
||||
|
|
@ -1728,7 +1728,7 @@ Vector2D CWindow::xwaylandSizeToReal(Vector2D size) {
|
|||
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
const auto SIZE = size.clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()});
|
||||
const auto SCALE = *PXWLFORCESCALEZERO ? PMONITOR->scale : 1.0f;
|
||||
const auto SCALE = *PXWLFORCESCALEZERO ? PMONITOR->m_scale : 1.0f;
|
||||
|
||||
return SIZE / SCALE;
|
||||
}
|
||||
|
|
@ -1743,7 +1743,7 @@ void CWindow::updateX11SurfaceScale() {
|
|||
m_X11SurfaceScaledBy = 1.0f;
|
||||
if (m_isX11 && *PXWLFORCESCALEZERO) {
|
||||
if (const auto PMONITOR = m_monitor.lock(); PMONITOR)
|
||||
m_X11SurfaceScaledBy = PMONITOR->scale;
|
||||
m_X11SurfaceScaledBy = PMONITOR->m_scale;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,24 +110,24 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
if (ANIMSTYLE.starts_with("slidefadevert")) {
|
||||
if (in) {
|
||||
m_alpha->setValueAndWarp(0.f);
|
||||
m_renderOffset->setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||
m_renderOffset->setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->m_size.y : -PMONITOR->m_size.y) * (movePerc / 100.f)));
|
||||
*m_alpha = 1.f;
|
||||
*m_renderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_alpha->setValueAndWarp(1.f);
|
||||
*m_alpha = 0.f;
|
||||
*m_renderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
||||
*m_renderOffset = Vector2D(0.0, (left ? -PMONITOR->m_size.y : PMONITOR->m_size.y) * (movePerc / 100.f));
|
||||
}
|
||||
} else {
|
||||
if (in) {
|
||||
m_alpha->setValueAndWarp(0.f);
|
||||
m_renderOffset->setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
||||
m_renderOffset->setValueAndWarp(Vector2D((left ? PMONITOR->m_size.x : -PMONITOR->m_size.x) * (movePerc / 100.f), 0.0));
|
||||
*m_alpha = 1.f;
|
||||
*m_renderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_alpha->setValueAndWarp(1.f);
|
||||
*m_alpha = 0.f;
|
||||
*m_renderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
||||
*m_renderOffset = Vector2D((left ? -PMONITOR->m_size.x : PMONITOR->m_size.x) * (movePerc / 100.f), 0.0);
|
||||
}
|
||||
}
|
||||
} else if (ANIMSTYLE == "fade") {
|
||||
|
|
@ -143,7 +143,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
} else if (ANIMSTYLE == "slidevert") {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP;
|
||||
const auto YDISTANCE = PMONITOR->m_size.y + *PWORKSPACEGAP;
|
||||
|
||||
m_alpha->setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
} else {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
||||
const auto XDISTANCE = PMONITOR->m_size.x + *PWORKSPACEGAP;
|
||||
|
||||
m_alpha->setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ bool CWorkspace::inert() {
|
|||
}
|
||||
|
||||
MONITORID CWorkspace::monitorID() {
|
||||
return m_monitor ? m_monitor->ID : MONITOR_INVALID;
|
||||
return m_monitor ? m_monitor->m_id : MONITOR_INVALID;
|
||||
}
|
||||
|
||||
PHLWINDOW CWorkspace::getFullscreenWindow() {
|
||||
|
|
@ -538,10 +538,10 @@ bool CWorkspace::isVisible() {
|
|||
|
||||
bool CWorkspace::isVisibleNotCovered() {
|
||||
const auto PMONITOR = m_monitor.lock();
|
||||
if (PMONITOR->activeSpecialWorkspace)
|
||||
return PMONITOR->activeSpecialWorkspace->m_id == m_id;
|
||||
if (PMONITOR->m_activeSpecialWorkspace)
|
||||
return PMONITOR->m_activeSpecialWorkspace->m_id == m_id;
|
||||
|
||||
return PMONITOR->activeWorkspace->m_id == m_id;
|
||||
return PMONITOR->m_activeWorkspace->m_id == m_id;
|
||||
}
|
||||
|
||||
int CWorkspace::getWindows(std::optional<bool> onlyTiled, std::optional<bool> onlyPinned, std::optional<bool> onlyVisible) {
|
||||
|
|
@ -597,7 +597,7 @@ PHLWINDOW CWorkspace::getTopLeftWindow() {
|
|||
|
||||
const auto WINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
|
||||
|
||||
if (WINDOWIDEALBB.x <= PMONITOR->vecPosition.x + 1 && WINDOWIDEALBB.y <= PMONITOR->vecPosition.y + 1)
|
||||
if (WINDOWIDEALBB.x <= PMONITOR->m_position.x + 1 && WINDOWIDEALBB.y <= PMONITOR->m_position.y + 1)
|
||||
return w;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue