protocols: refactor class member vars (core) (#10259)
This commit is contained in:
parent
0c736217a7
commit
d9cad5e1b6
57 changed files with 1160 additions and 1158 deletions
|
|
@ -131,9 +131,9 @@ void CPointerManager::setCursorSurface(SP<CWLSurface> 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<CWLSurface> 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<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
|
|||
// get the texture data if available.
|
||||
auto texData = texture->dataCopy();
|
||||
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<CTexture> 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<CTexture> 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<IPointer> pointer) {
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ CProtocolManager::CProtocolManager() {
|
|||
|
||||
auto ref = makeShared<CWLOutputProtocol>(&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); });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
#include <ranges>
|
||||
|
||||
CSeatManager::CSeatManager() {
|
||||
m_listeners.newSeatResource = PROTO::seat->events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast<SP<CWLSeatResource>>(res)); });
|
||||
m_listeners.newSeatResource = PROTO::seat->m_events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast<SP<CWLSeatResource>>(res)); });
|
||||
}
|
||||
|
||||
CSeatManager::SSeatResourceContainer::SSeatResourceContainer(SP<CWLSeatResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSeatResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CWLSurfaceResource> pSurface) {
|
||||
if (!pSurface || !pSurface->mapped)
|
||||
if (!pSurface || !pSurface->m_mapped)
|
||||
return;
|
||||
|
||||
if (pSurface == focusedSurface())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue