protocols: refactor class member vars (a-m) (#10265)

This commit is contained in:
davc0n 2025-05-04 00:13:29 +02:00 committed by GitHub
parent 46ac115bd1
commit adbae0f74d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 1566 additions and 1561 deletions

View file

@ -8,14 +8,14 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
const auto PINHIBIT = m_idleInhibitors.emplace_back(makeUnique<SIdleInhibitor>()).get();
PINHIBIT->inhibitor = std::any_cast<SP<CIdleInhibitor>>(inhibitor);
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->surface.get());
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->m_surface.get());
PINHIBIT->inhibitor->listeners.destroy = PINHIBIT->inhibitor->resource->events.destroy.registerListener([this, PINHIBIT](std::any data) {
PINHIBIT->inhibitor->m_listeners.destroy = PINHIBIT->inhibitor->m_resource->m_events.destroy.registerListener([this, PINHIBIT](std::any data) {
std::erase_if(m_idleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
recheckIdleInhibitorStatus();
});
auto WLSurface = CWLSurface::fromResource(PINHIBIT->inhibitor->surface.lock());
auto WLSurface = CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
if (!WLSurface) {
Debug::log(LOG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible.");
@ -38,7 +38,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
return;
}
auto WLSurface = CWLSurface::fromResource(ii->inhibitor->surface.lock());
auto WLSurface = CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
if (!WLSurface)
continue;
@ -80,7 +80,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
bool isInhibiting = false;
w->m_wlSurface->resource()->breadthfirst(
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
if (ii->inhibitor->surface != surf)
if (ii->inhibitor->m_surface != surf)
return;
auto WLSurface = CWLSurface::fromResource(surf);

View file

@ -42,7 +42,7 @@
#include <aquamarine/input/Input.hpp>
CInputManager::CInputManager() {
m_listeners.setCursorShape = PROTO::cursorShape->events.setShape.registerListener([this](std::any data) {
m_listeners.setCursorShape = PROTO::cursorShape->m_events.setShape.registerListener([this](std::any data) {
if (!cursorImageUnlocked())
return;
@ -65,7 +65,7 @@ CInputManager::CInputManager() {
g_pHyprRenderer->setCursorFromName(m_cursorSurfaceInfo.name);
});
m_listeners.newIdleInhibitor = PROTO::idleInhibit->events.newIdleInhibitor.registerListener([this](std::any data) { this->newIdleInhibitor(data); });
m_listeners.newIdleInhibitor = PROTO::idleInhibit->m_events.newIdleInhibitor.registerListener([this](std::any data) { this->newIdleInhibitor(data); });
m_listeners.newVirtualKeyboard = PROTO::virtualKeyboard->events.newKeyboard.registerListener([this](std::any data) {
this->newVirtualKeyboard(std::any_cast<SP<CVirtualKeyboardV1Resource>>(data));
updateCapabilities();
@ -504,7 +504,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
if (!refocus && g_pCompositor->m_lastFocus) {
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
if (PLS && PLS->m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
if (PLS && PLS->m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
allowKeyboardRefocus = false;
}
@ -589,8 +589,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
unsetCursorImage();
}
if (pFoundLayerSurface && (pFoundLayerSurface->m_layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
(allowKeyboardRefocus || pFoundLayerSurface->m_layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) {
if (pFoundLayerSurface && (pFoundLayerSurface->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
(allowKeyboardRefocus || pFoundLayerSurface->m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) {
g_pCompositor->focusSurface(foundSurface);
}

View file

@ -8,10 +8,10 @@
#include "../../render/Renderer.hpp"
CInputPopup::CInputPopup(SP<CInputMethodPopupV2> popup_) : m_popup(popup_) {
m_listeners.commit = popup_->events.commit.registerListener([this](std::any d) { onCommit(); });
m_listeners.map = popup_->events.map.registerListener([this](std::any d) { onMap(); });
m_listeners.unmap = popup_->events.unmap.registerListener([this](std::any d) { onUnmap(); });
m_listeners.destroy = popup_->events.destroy.registerListener([this](std::any d) { onDestroy(); });
m_listeners.commit = popup_->m_events.commit.registerListener([this](std::any d) { onCommit(); });
m_listeners.map = popup_->m_events.map.registerListener([this](std::any d) { onMap(); });
m_listeners.unmap = popup_->m_events.unmap.registerListener([this](std::any d) { onUnmap(); });
m_listeners.destroy = popup_->m_events.destroy.registerListener([this](std::any d) { onDestroy(); });
m_surface = CWLSurface::create();
m_surface->assign(popup_->surface());
}
@ -77,7 +77,7 @@ void CInputPopup::damageSurface() {
}
void CInputPopup::updateBox() {
if (!m_popup->mapped)
if (!m_popup->m_mapped)
return;
const auto OWNER = queryOwner();

View file

@ -13,7 +13,7 @@ CInputMethodRelay::CInputMethodRelay() {
m_listeners.newTIV3 = PROTO::textInputV3->events.newTextInput.registerListener([this](std::any ti) { onNewTextInput(std::any_cast<WP<CTextInputV3>>(ti)); });
m_listeners.newTIV1 = PROTO::textInputV1->events.newTextInput.registerListener([this](std::any ti) { onNewTextInput(std::any_cast<WP<CTextInputV1>>(ti)); });
m_listeners.newIME = PROTO::ime->events.newIME.registerListener([this](std::any ime) { onNewIME(std::any_cast<SP<CInputMethodV2>>(ime)); });
m_listeners.newIME = PROTO::ime->m_events.newIME.registerListener([this](std::any ime) { onNewIME(std::any_cast<SP<CInputMethodV2>>(ime)); });
}
void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
@ -27,7 +27,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
m_inputMethod = pIME;
m_listeners.commitIME = pIME->events.onCommit.registerListener([this](std::any d) {
m_listeners.commitIME = pIME->m_events.onCommit.registerListener([this](std::any d) {
const auto PTI = getFocusedTextInput();
if (!PTI) {
@ -38,7 +38,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
PTI->updateIMEState(m_inputMethod.lock());
});
m_listeners.destroyIME = pIME->events.destroy.registerListener([this](std::any d) {
m_listeners.destroyIME = pIME->m_events.destroy.registerListener([this](std::any d) {
const auto PTI = getFocusedTextInput();
Debug::log(LOG, "IME Destroy");
@ -49,7 +49,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
m_inputMethod.reset();
});
m_listeners.newPopup = pIME->events.newPopup.registerListener([this](std::any d) {
m_listeners.newPopup = pIME->m_events.newPopup.registerListener([this](std::any d) {
m_inputMethodPopups.emplace_back(makeUnique<CInputPopup>(std::any_cast<SP<CInputMethodPopupV2>>(d)));
Debug::log(LOG, "New input popup");

View file

@ -266,38 +266,38 @@ void CTextInput::updateIMEState(SP<CInputMethodV2> ime) {
if (isV3()) {
const auto INPUT = m_v3Input.lock();
if (ime->current.preeditString.committed)
INPUT->preeditString(ime->current.preeditString.string, ime->current.preeditString.begin, ime->current.preeditString.end);
if (ime->m_current.preeditString.committed)
INPUT->preeditString(ime->m_current.preeditString.string, ime->m_current.preeditString.begin, ime->m_current.preeditString.end);
if (ime->current.committedString.committed)
INPUT->commitString(ime->current.committedString.string);
if (ime->m_current.committedString.committed)
INPUT->commitString(ime->m_current.committedString.string);
if (ime->current.deleteSurrounding.committed)
INPUT->deleteSurroundingText(ime->current.deleteSurrounding.before, ime->current.deleteSurrounding.after);
if (ime->m_current.deleteSurrounding.committed)
INPUT->deleteSurroundingText(ime->m_current.deleteSurrounding.before, ime->m_current.deleteSurrounding.after);
INPUT->sendDone();
} else {
const auto INPUT = m_v1Input.lock();
if (ime->current.preeditString.committed) {
INPUT->preeditCursor(ime->current.preeditString.begin);
INPUT->preeditStyling(0, std::string(ime->current.preeditString.string).length(), ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
INPUT->preeditString(m_v1Input->serial, ime->current.preeditString.string.c_str(), "");
if (ime->m_current.preeditString.committed) {
INPUT->preeditCursor(ime->m_current.preeditString.begin);
INPUT->preeditStyling(0, std::string(ime->m_current.preeditString.string).length(), ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
INPUT->preeditString(m_v1Input->serial, ime->m_current.preeditString.string.c_str(), "");
} else {
INPUT->preeditCursor(0);
INPUT->preeditStyling(0, 0, ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
INPUT->preeditString(m_v1Input->serial, "", "");
}
if (ime->current.committedString.committed)
INPUT->commitString(m_v1Input->serial, ime->current.committedString.string.c_str());
if (ime->m_current.committedString.committed)
INPUT->commitString(m_v1Input->serial, ime->m_current.committedString.string.c_str());
if (ime->current.deleteSurrounding.committed) {
INPUT->deleteSurroundingText(std::string(ime->current.preeditString.string).length() - ime->current.deleteSurrounding.before,
ime->current.deleteSurrounding.after + ime->current.deleteSurrounding.before);
if (ime->m_current.deleteSurrounding.committed) {
INPUT->deleteSurroundingText(std::string(ime->m_current.preeditString.string).length() - ime->m_current.deleteSurrounding.before,
ime->m_current.deleteSurrounding.after + ime->m_current.deleteSurrounding.before);
if (ime->current.preeditString.committed)
INPUT->commitString(m_v1Input->serial, ime->current.preeditString.string.c_str());
if (ime->m_current.preeditString.committed)
INPUT->commitString(m_v1Input->serial, ime->m_current.preeditString.string.c_str());
}
}
}