From d9cad5e1b63f2e1e86eb54551c72d17ee4dd070d Mon Sep 17 00:00:00 2001 From: davc0n Date: Sat, 3 May 2025 16:02:49 +0200 Subject: protocols: refactor class member vars (core) (#10259) --- src/managers/PointerManager.cpp | 30 +++++++++++----------- src/managers/ProtocolManager.cpp | 2 +- src/managers/SeatManager.cpp | 44 ++++++++++++++++----------------- src/managers/input/InputManager.cpp | 6 ++--- src/managers/input/InputMethodPopup.cpp | 2 +- src/managers/input/TextInput.cpp | 6 ++--- 6 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/managers') diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 48044a69..d9dd602e 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -131,9 +131,9 @@ void CPointerManager::setCursorSurface(SP surf, const Vector2D& hots damageIfSoftware(); if (surf == m_currentCursorImage.surface) { - if (hotspot != m_currentCursorImage.hotspot || (surf && surf->resource() ? surf->resource()->current.scale : 1.F) != m_currentCursorImage.scale) { + if (hotspot != m_currentCursorImage.hotspot || (surf && surf->resource() ? surf->resource()->m_current.scale : 1.F) != m_currentCursorImage.scale) { m_currentCursorImage.hotspot = hotspot; - m_currentCursorImage.scale = surf && surf->resource() ? surf->resource()->current.scale : 1.F; + m_currentCursorImage.scale = surf && surf->resource() ? surf->resource()->m_current.scale : 1.F; updateCursorBackend(); damageIfSoftware(); } @@ -145,22 +145,22 @@ void CPointerManager::setCursorSurface(SP surf, const Vector2D& hots if (surf) { m_currentCursorImage.surface = surf; - m_currentCursorImage.scale = surf->resource()->current.scale; + m_currentCursorImage.scale = surf->resource()->m_current.scale; surf->resource()->map(); m_currentCursorImage.destroySurface = surf->m_events.destroy.registerListener([this](std::any data) { resetCursorImage(); }); - m_currentCursorImage.commitSurface = surf->resource()->events.commit.registerListener([this](std::any data) { + m_currentCursorImage.commitSurface = surf->resource()->m_events.commit.registerListener([this](std::any data) { damageIfSoftware(); - m_currentCursorImage.size = m_currentCursorImage.surface->resource()->current.texture ? m_currentCursorImage.surface->resource()->current.bufferSize : Vector2D{}; - m_currentCursorImage.scale = m_currentCursorImage.surface ? m_currentCursorImage.surface->resource()->current.scale : 1.F; + m_currentCursorImage.size = m_currentCursorImage.surface->resource()->m_current.texture ? m_currentCursorImage.surface->resource()->m_current.bufferSize : Vector2D{}; + m_currentCursorImage.scale = m_currentCursorImage.surface ? m_currentCursorImage.surface->resource()->m_current.scale : 1.F; recheckEnteredOutputs(); updateCursorBackend(); damageIfSoftware(); }); - if (surf->resource()->current.texture) { - m_currentCursorImage.size = surf->resource()->current.bufferSize; + if (surf->resource()->m_current.texture) { + m_currentCursorImage.size = surf->resource()->m_current.bufferSize; surf->resource()->frame(Time::steadyNow()); } } @@ -464,18 +464,18 @@ SP CPointerManager::renderHWCursorBuffer(SPdataCopy(); if (texData.empty()) { - if (m_currentCursorImage.surface && m_currentCursorImage.surface->resource()->role->role() == SURFACE_ROLE_CURSOR) { + if (m_currentCursorImage.surface && m_currentCursorImage.surface->resource()->m_role->role() == SURFACE_ROLE_CURSOR) { const auto SURFACE = m_currentCursorImage.surface->resource(); auto& shmBuffer = CCursorSurfaceRole::cursorPixelData(SURFACE); bool flipRB = false; - if (SURFACE->current.texture) { - Debug::log(TRACE, "Cursor CPU surface: format {}, expecting AR24", NFormatUtils::drmFormatName(SURFACE->current.texture->m_iDrmFormat)); - if (SURFACE->current.texture->m_iDrmFormat == DRM_FORMAT_ABGR8888) { + if (SURFACE->m_current.texture) { + Debug::log(TRACE, "Cursor CPU surface: format {}, expecting AR24", NFormatUtils::drmFormatName(SURFACE->m_current.texture->m_iDrmFormat)); + if (SURFACE->m_current.texture->m_iDrmFormat == DRM_FORMAT_ABGR8888) { Debug::log(TRACE, "Cursor CPU surface format AB24, will flip. WARNING: this will break on big endian!"); flipRB = true; - } else if (SURFACE->current.texture->m_iDrmFormat != DRM_FORMAT_ARGB8888) { + } else if (SURFACE->m_current.texture->m_iDrmFormat != DRM_FORMAT_ARGB8888) { Debug::log(TRACE, "Cursor CPU surface format rejected, falling back to sw"); return nullptr; } @@ -869,7 +869,7 @@ void CPointerManager::onMonitorLayoutChange() { } SP CPointerManager::getCurrentCursorTexture() { - if (!m_currentCursorImage.pBuffer && (!m_currentCursorImage.surface || !m_currentCursorImage.surface->resource()->current.texture)) + if (!m_currentCursorImage.pBuffer && (!m_currentCursorImage.surface || !m_currentCursorImage.surface->resource()->m_current.texture)) return nullptr; if (m_currentCursorImage.pBuffer) { @@ -878,7 +878,7 @@ SP CPointerManager::getCurrentCursorTexture() { return m_currentCursorImage.bufferTex; } - return m_currentCursorImage.surface->resource()->current.texture; + return m_currentCursorImage.surface->resource()->m_current.texture; } void CPointerManager::attachPointer(SP pointer) { diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp index f2a9b0ea..ab542fc2 100644 --- a/src/managers/ProtocolManager.cpp +++ b/src/managers/ProtocolManager.cpp @@ -120,7 +120,7 @@ CProtocolManager::CProtocolManager() { auto ref = makeShared(&wl_output_interface, 4, std::format("WLOutput ({})", M->m_name), M->m_self.lock()); PROTO::outputs.emplace(M->m_name, ref); - ref->self = ref; + ref->m_self = ref; m_modeChangeListeners[M->m_name] = M->m_events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); }); }); diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp index 809c0ad5..f910598d 100644 --- a/src/managers/SeatManager.cpp +++ b/src/managers/SeatManager.cpp @@ -14,11 +14,11 @@ #include CSeatManager::CSeatManager() { - m_listeners.newSeatResource = PROTO::seat->events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast>(res)); }); + m_listeners.newSeatResource = PROTO::seat->m_events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast>(res)); }); } CSeatManager::SSeatResourceContainer::SSeatResourceContainer(SP res) : resource(res) { - listeners.destroy = res->events.destroy.registerListener( + listeners.destroy = res->m_events.destroy.registerListener( [this](std::any data) { std::erase_if(g_pSeatManager->m_seatResources, [this](const auto& e) { return e->resource.expired() || e->resource == resource; }); }); } @@ -119,7 +119,7 @@ void CSeatManager::setKeyboardFocus(SP surf) { if (s->resource->client() != client) continue; - for (auto const& k : s->resource->keyboards) { + for (auto const& k : s->resource->m_keyboards) { if (!k) continue; @@ -142,7 +142,7 @@ void CSeatManager::setKeyboardFocus(SP surf) { continue; m_state.keyboardFocusResource = r->resource; - for (auto const& k : r->resource->keyboards) { + for (auto const& k : r->resource->m_keyboards) { if (!k) continue; @@ -151,7 +151,7 @@ void CSeatManager::setKeyboardFocus(SP surf) { } } - m_listeners.keyboardSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setKeyboardFocus(nullptr); }); + m_listeners.keyboardSurfaceDestroy = surf->m_events.destroy.registerListener([this](std::any d) { setKeyboardFocus(nullptr); }); m_events.keyboardFocusChange.emit(); } @@ -164,7 +164,7 @@ void CSeatManager::sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_ke if (s->resource->client() != m_state.keyboardFocusResource->client()) continue; - for (auto const& k : s->resource->keyboards) { + for (auto const& k : s->resource->m_keyboards) { if (!k) continue; @@ -181,7 +181,7 @@ void CSeatManager::sendKeyboardMods(uint32_t depressed, uint32_t latched, uint32 if (s->resource->client() != m_state.keyboardFocusResource->client()) continue; - for (auto const& k : s->resource->keyboards) { + for (auto const& k : s->resource->m_keyboards) { if (!k) continue; @@ -216,7 +216,7 @@ void CSeatManager::setPointerFocus(SP surf, const Vector2D& if (s->resource->client() != client) continue; - for (auto const& p : s->resource->pointers) { + for (auto const& p : s->resource->m_pointers) { if (!p) continue; @@ -245,7 +245,7 @@ void CSeatManager::setPointerFocus(SP surf, const Vector2D& continue; m_state.pointerFocusResource = r->resource; - for (auto const& p : r->resource->pointers) { + for (auto const& p : r->resource->m_pointers) { if (!p) continue; @@ -258,7 +258,7 @@ void CSeatManager::setPointerFocus(SP surf, const Vector2D& sendPointerFrame(); - m_listeners.pointerSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setPointerFocus(nullptr, {}); }); + m_listeners.pointerSurfaceDestroy = surf->m_events.destroy.registerListener([this](std::any d) { setPointerFocus(nullptr, {}); }); m_events.pointerFocusChange.emit(); m_events.dndPointerFocusChange.emit(); @@ -272,7 +272,7 @@ void CSeatManager::sendPointerMotion(uint32_t timeMs, const Vector2D& local) { if (s->resource->client() != m_state.pointerFocusResource->client()) continue; - for (auto const& p : s->resource->pointers) { + for (auto const& p : s->resource->m_pointers) { if (!p) continue; @@ -291,7 +291,7 @@ void CSeatManager::sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_b if (s->resource->client() != m_state.pointerFocusResource->client()) continue; - for (auto const& p : s->resource->pointers) { + for (auto const& p : s->resource->m_pointers) { if (!p) continue; @@ -315,7 +315,7 @@ void CSeatManager::sendPointerFrame(WP pResource) { if (s->resource->client() != pResource->client()) continue; - for (auto const& p : s->resource->pointers) { + for (auto const& p : s->resource->m_pointers) { if (!p) continue; @@ -333,7 +333,7 @@ void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double if (s->resource->client() != m_state.pointerFocusResource->client()) continue; - for (auto const& p : s->resource->pointers) { + for (auto const& p : s->resource->m_pointers) { if (!p) continue; @@ -364,7 +364,7 @@ void CSeatManager::sendTouchDown(SP surf, uint32_t timeMs, i continue; m_state.touchFocusResource = r->resource; - for (auto const& t : r->resource->touches) { + for (auto const& t : r->resource->m_touches) { if (!t) continue; @@ -372,7 +372,7 @@ void CSeatManager::sendTouchDown(SP surf, uint32_t timeMs, i } } - m_listeners.touchSurfaceDestroy = surf->events.destroy.registerListener([this, timeMs, id](std::any d) { sendTouchUp(timeMs + 10, id); }); + m_listeners.touchSurfaceDestroy = surf->m_events.destroy.registerListener([this, timeMs, id](std::any d) { sendTouchUp(timeMs + 10, id); }); m_touchLocks++; @@ -390,7 +390,7 @@ void CSeatManager::sendTouchUp(uint32_t timeMs, int32_t id) { continue; m_state.touchFocusResource = r->resource; - for (auto const& t : r->resource->touches) { + for (auto const& t : r->resource->m_touches) { if (!t) continue; @@ -412,7 +412,7 @@ void CSeatManager::sendTouchMotion(uint32_t timeMs, int32_t id, const Vector2D& if (s->resource->client() != m_state.touchFocusResource->client()) continue; - for (auto const& t : s->resource->touches) { + for (auto const& t : s->resource->m_touches) { if (!t) continue; @@ -429,7 +429,7 @@ void CSeatManager::sendTouchFrame() { if (s->resource->client() != m_state.touchFocusResource->client()) continue; - for (auto const& t : s->resource->touches) { + for (auto const& t : s->resource->m_touches) { if (!t) continue; @@ -446,7 +446,7 @@ void CSeatManager::sendTouchCancel() { if (s->resource->client() != m_state.touchFocusResource->client()) continue; - for (auto const& t : s->resource->touches) { + for (auto const& t : s->resource->m_touches) { if (!t) continue; @@ -463,7 +463,7 @@ void CSeatManager::sendTouchShape(int32_t id, const Vector2D& shape) { if (s->resource->client() != m_state.touchFocusResource->client()) continue; - for (auto const& t : s->resource->touches) { + for (auto const& t : s->resource->m_touches) { if (!t) continue; @@ -480,7 +480,7 @@ void CSeatManager::sendTouchOrientation(int32_t id, double angle) { if (s->resource->client() != m_state.touchFocusResource->client()) continue; - for (auto const& t : s->resource->touches) { + for (auto const& t : s->resource->m_touches) { if (!t) continue; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 1e62af64..c48ca908 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -289,8 +289,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { // if we are holding a pointer button, // and we're not dnd-ing, don't refocus. Keep focus on last surface. - if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->mapped && g_pSeatManager->m_state.pointerFocus && - !m_hardInput) { + if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->m_mapped && + g_pSeatManager->m_state.pointerFocus && !m_hardInput) { foundSurface = g_pSeatManager->m_state.pointerFocus.lock(); // IME popups aren't desktop-like elements @@ -1490,7 +1490,7 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { } else { // otherwise fall back to a normal refocus. - if (foundSurface && !foundSurface->hlSurface->keyboardFocusable()) { + if (foundSurface && !foundSurface->m_hlSurface->keyboardFocusable()) { const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock(); g_pCompositor->focusWindow(PLASTWINDOW); } diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp index c374f63c..ac526c7b 100644 --- a/src/managers/input/InputMethodPopup.cpp +++ b/src/managers/input/InputMethodPopup.cpp @@ -102,7 +102,7 @@ void CInputPopup::updateBox() { cursorBoxParent = {0, 0, (int)parentBox.w, (int)parentBox.h}; } - Vector2D currentPopupSize = m_surface->getViewporterCorrectedSize() / m_surface->resource()->current.scale; + Vector2D currentPopupSize = m_surface->getViewporterCorrectedSize() / m_surface->resource()->m_current.scale; PHLMONITOR pMonitor = g_pCompositor->getMonitorFromVector(parentBox.middle()); diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp index 160d1c90..a629cd18 100644 --- a/src/managers/input/TextInput.cpp +++ b/src/managers/input/TextInput.cpp @@ -135,7 +135,7 @@ void CTextInput::setFocusedSurface(SP pSurface) { m_listeners.surfaceUnmap.reset(); m_listeners.surfaceDestroy.reset(); - m_listeners.surfaceUnmap = pSurface->events.unmap.registerListener([this](std::any d) { + m_listeners.surfaceUnmap = pSurface->m_events.unmap.registerListener([this](std::any d) { Debug::log(LOG, "Unmap TI owner1"); if (m_enterLocks) @@ -155,7 +155,7 @@ void CTextInput::setFocusedSurface(SP pSurface) { g_pInputManager->m_relay.deactivateIME(this); }); - m_listeners.surfaceDestroy = pSurface->events.destroy.registerListener([this](std::any d) { + m_listeners.surfaceDestroy = pSurface->m_events.destroy.registerListener([this](std::any d) { Debug::log(LOG, "Destroy TI owner1"); if (m_enterLocks) @@ -181,7 +181,7 @@ bool CTextInput::isV3() { } void CTextInput::enter(SP pSurface) { - if (!pSurface || !pSurface->mapped) + if (!pSurface || !pSurface->m_mapped) return; if (pSurface == focusedSurface()) -- cgit v1.2.3