summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavc0n <dconti.dev@gmail.com>2025-05-03 16:02:49 +0200
committerGitHub <noreply@github.com>2025-05-03 16:02:49 +0200
commitd9cad5e1b63f2e1e86eb54551c72d17ee4dd070d (patch)
tree8238b613480214eaf91fc85343d25503bafa51c3 /src
parent0c736217a787928a87224b2bf7e984c446d4fc22 (diff)
protocols: refactor class member vars (core) (#10259)
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp8
-rw-r--r--src/desktop/LayerSurface.cpp14
-rw-r--r--src/desktop/Popup.cpp14
-rw-r--r--src/desktop/Subsurface.cpp44
-rw-r--r--src/desktop/WLSurface.cpp41
-rw-r--r--src/desktop/Window.cpp30
-rw-r--r--src/devices/Tablet.cpp2
-rw-r--r--src/events/Windows.cpp5
-rw-r--r--src/helpers/Monitor.cpp14
-rw-r--r--src/layout/IHyprLayout.cpp2
-rw-r--r--src/managers/PointerManager.cpp30
-rw-r--r--src/managers/ProtocolManager.cpp2
-rw-r--r--src/managers/SeatManager.cpp44
-rw-r--r--src/managers/input/InputManager.cpp6
-rw-r--r--src/managers/input/InputMethodPopup.cpp2
-rw-r--r--src/managers/input/TextInput.cpp6
-rw-r--r--src/protocols/AlphaModifier.cpp4
-rw-r--r--src/protocols/CTMControl.cpp2
-rw-r--r--src/protocols/ColorManagement.cpp6
-rw-r--r--src/protocols/ContentType.cpp10
-rw-r--r--src/protocols/DRMSyncobj.cpp24
-rw-r--r--src/protocols/FocusGrab.cpp2
-rw-r--r--src/protocols/ForeignToplevelWlr.cpp2
-rw-r--r--src/protocols/FractionalScale.cpp2
-rw-r--r--src/protocols/FrogColorManagement.cpp44
-rw-r--r--src/protocols/GammaControl.cpp2
-rw-r--r--src/protocols/HyprlandSurface.cpp6
-rw-r--r--src/protocols/IdleInhibit.cpp2
-rw-r--r--src/protocols/InputMethodV2.cpp8
-rw-r--r--src/protocols/LayerShell.cpp14
-rw-r--r--src/protocols/OutputPower.cpp2
-rw-r--r--src/protocols/PointerConstraints.cpp6
-rw-r--r--src/protocols/Screencopy.cpp2
-rw-r--r--src/protocols/SessionLock.cpp10
-rw-r--r--src/protocols/Viewporter.cpp32
-rw-r--r--src/protocols/VirtualPointer.cpp2
-rw-r--r--src/protocols/XDGOutput.cpp4
-rw-r--r--src/protocols/XDGShell.cpp16
-rw-r--r--src/protocols/XXColorManagement.cpp16
-rw-r--r--src/protocols/core/Compositor.cpp374
-rw-r--r--src/protocols/core/Compositor.hpp54
-rw-r--r--src/protocols/core/DataDevice.cpp416
-rw-r--r--src/protocols/core/DataDevice.hpp56
-rw-r--r--src/protocols/core/Output.cpp86
-rw-r--r--src/protocols/core/Output.hpp22
-rw-r--r--src/protocols/core/Seat.cpp332
-rw-r--r--src/protocols/core/Seat.hpp62
-rw-r--r--src/protocols/core/Shm.cpp116
-rw-r--r--src/protocols/core/Shm.hpp31
-rw-r--r--src/protocols/core/Subcompositor.cpp156
-rw-r--r--src/protocols/core/Subcompositor.hpp26
-rw-r--r--src/render/OpenGL.cpp18
-rw-r--r--src/render/Renderer.cpp53
-rw-r--r--src/render/pass/Pass.cpp6
-rw-r--r--src/render/pass/SurfacePassElement.cpp22
-rw-r--r--src/xwayland/XSurface.cpp10
-rw-r--r--src/xwayland/XWM.cpp2
57 files changed, 1163 insertions, 1161 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index a9106480..fcb67873 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -1288,14 +1288,14 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, st
bool aboveLockscreen) {
for (auto const& ls : *layerSurfaces | std::views::reverse) {
- if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->surface->mapped) || ls->m_alpha->value() == 0.f ||
+ if (!ls->m_mapped || ls->m_fadingOut || !ls->m_layerSurface || (ls->m_layerSurface && !ls->m_layerSurface->surface->m_mapped) || ls->m_alpha->value() == 0.f ||
(aboveLockscreen && (!ls->m_aboveLockscreen || !ls->m_aboveLockscreenInteractable)))
continue;
auto [surf, local] = ls->m_layerSurface->surface->at(pos - ls->m_geometry.pos(), true);
if (surf) {
- if (surf->current.input.empty())
+ if (surf->m_current.input.empty())
continue;
*ppLayerSurfaceFound = ls.lock();
@@ -1310,10 +1310,10 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, st
}
PHLWINDOW CCompositor::getWindowFromSurface(SP<CWLSurfaceResource> pSurface) {
- if (!pSurface || !pSurface->hlSurface)
+ if (!pSurface || !pSurface->m_hlSurface)
return nullptr;
- return pSurface->hlSurface->getWindow();
+ return pSurface->m_hlSurface->getWindow();
}
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index c31f9bb7..9818c093 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -238,7 +238,7 @@ void CLayerSurface::onUnmap() {
// refocus if needed
// vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window
- if (WASLASTFOCUS || (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->hlSurface && !g_pCompositor->m_lastFocus->hlSurface->keyboardFocusable())) {
+ if (WASLASTFOCUS || (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->m_hlSurface && !g_pCompositor->m_lastFocus->m_hlSurface->keyboardFocusable())) {
if (!g_pInputManager->refocusLastWindow(PMONITOR))
g_pInputManager->refocus();
} else if (g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus != m_surface->resource())
@@ -247,8 +247,8 @@ void CLayerSurface::onUnmap() {
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->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};
+ geomFixed = {m_geometry.x + (int)PMONITOR->m_position.x, m_geometry.y + (int)PMONITOR->m_position.y, (int)m_layerSurface->surface->m_current.size.x,
+ (int)m_layerSurface->surface->m_current.size.y};
g_pHyprRenderer->damageBox(geomFixed);
g_pInputManager->simulateMouseMovement();
@@ -262,7 +262,7 @@ void CLayerSurface::onCommit() {
if (!m_mapped) {
// we're re-mapping if this is the case
- if (m_layerSurface->surface && !m_layerSurface->surface->current.texture) {
+ if (m_layerSurface->surface && !m_layerSurface->surface->m_current.texture) {
m_fadingOut = false;
m_geometry = {};
g_pHyprRenderer->arrangeLayersForMonitor(monitorID());
@@ -308,12 +308,12 @@ void CLayerSurface::onCommit() {
m_position = Vector2D(m_geometry.x, m_geometry.y);
// update geom if it changed
- if (m_layerSurface->surface->current.scale == 1 && PMONITOR->m_scale != 1.f && m_layerSurface->surface->current.viewport.hasDestination) {
+ if (m_layerSurface->surface->m_current.scale == 1 && PMONITOR->m_scale != 1.f && m_layerSurface->surface->m_current.viewport.hasDestination) {
// fractional scaling. Dirty hack.
- m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.viewport.destination};
+ m_geometry = {m_geometry.pos(), m_layerSurface->surface->m_current.viewport.destination};
} else {
// this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly.
- m_geometry = {m_geometry.pos(), m_layerSurface->surface->current.size};
+ m_geometry = {m_geometry.pos(), m_layerSurface->surface->m_current.size};
}
}
diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp
index 30cf966d..86928faf 100644
--- a/src/desktop/Popup.cpp
+++ b/src/desktop/Popup.cpp
@@ -93,7 +93,7 @@ void CPopup::onMap() {
return;
m_mapped = true;
- m_lastSize = m_resource->surface->surface->current.size;
+ m_lastSize = m_resource->surface->surface->m_current.size;
const auto COORDS = coordsGlobal();
const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS);
@@ -128,7 +128,7 @@ void CPopup::onUnmap() {
m_mapped = false;
- m_lastSize = m_resource->surface->surface->current.size;
+ m_lastSize = m_resource->surface->surface->m_current.size;
const auto COORDS = coordsGlobal();
@@ -172,7 +172,7 @@ void CPopup::onCommit(bool ignoreSiblings) {
}
if (!m_windowOwner.expired() && (!m_windowOwner->m_isMapped || !m_windowOwner->m_workspace->m_visible)) {
- m_lastSize = m_resource->surface->surface->current.size;
+ m_lastSize = m_resource->surface->surface->m_current.size;
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
@@ -186,10 +186,10 @@ void CPopup::onCommit(bool ignoreSiblings) {
const auto COORDS = coordsGlobal();
const auto COORDSLOCAL = coordsRelativeToParent();
- if (m_lastSize != m_resource->surface->surface->current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) {
+ if (m_lastSize != m_resource->surface->surface->m_current.size || m_requestedReposition || m_lastPos != COORDSLOCAL) {
CBox box = {localToGlobal(m_lastPos), m_lastSize};
g_pHyprRenderer->damageBox(box);
- m_lastSize = m_resource->surface->surface->current.size;
+ m_lastSize = m_resource->surface->surface->m_current.size;
box = {COORDS, m_lastSize};
g_pHyprRenderer->damageBox(box);
@@ -246,7 +246,7 @@ Vector2D CPopup::coordsRelativeToParent() {
while (current->m_parent && current->m_resource) {
- offset += current->m_wlSurface->resource()->current.offset;
+ offset += current->m_wlSurface->resource()->m_current.offset;
offset += current->m_resource->geometry.pos();
current = current->m_parent;
@@ -363,7 +363,7 @@ WP<CPopup> CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
if (BOX.containsPoint(globalCoords))
return p;
} else {
- const auto REGION = CRegion{p->m_wlSurface->resource()->current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->current.size}).translate(p->coordsGlobal());
+ const auto REGION = CRegion{p->m_wlSurface->resource()->m_current.input}.intersect(CBox{{}, p->m_wlSurface->resource()->m_current.size}).translate(p->coordsGlobal());
if (REGION.containsPoint(globalCoords))
return p;
}
diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp
index 419c7e31..1c5d5c70 100644
--- a/src/desktop/Subsurface.cpp
+++ b/src/desktop/Subsurface.cpp
@@ -32,9 +32,9 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWI
subsurface->m_subsurface = pSubsurface;
subsurface->m_self = subsurface;
subsurface->m_wlSurface = CWLSurface::create();
- subsurface->m_wlSurface->assign(pSubsurface->surface.lock(), subsurface.get());
+ subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
subsurface->initSignals();
- subsurface->initExistingSubsurfaces(pSubsurface->surface.lock());
+ subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
return subsurface;
}
@@ -44,27 +44,27 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CP
subsurface->m_subsurface = pSubsurface;
subsurface->m_self = subsurface;
subsurface->m_wlSurface = CWLSurface::create();
- subsurface->m_wlSurface->assign(pSubsurface->surface.lock(), subsurface.get());
+ subsurface->m_wlSurface->assign(pSubsurface->m_surface.lock(), subsurface.get());
subsurface->initSignals();
- subsurface->initExistingSubsurfaces(pSubsurface->surface.lock());
+ subsurface->initExistingSubsurfaces(pSubsurface->m_surface.lock());
return subsurface;
}
void CSubsurface::initSignals() {
if (m_subsurface) {
- m_listeners.commitSubsurface = m_subsurface->surface->events.commit.registerListener([this](std::any d) { onCommit(); });
- m_listeners.destroySubsurface = m_subsurface->events.destroy.registerListener([this](std::any d) { onDestroy(); });
- m_listeners.mapSubsurface = m_subsurface->surface->events.map.registerListener([this](std::any d) { onMap(); });
- m_listeners.unmapSubsurface = m_subsurface->surface->events.unmap.registerListener([this](std::any d) { onUnmap(); });
+ m_listeners.commitSubsurface = m_subsurface->m_surface->m_events.commit.registerListener([this](std::any d) { onCommit(); });
+ m_listeners.destroySubsurface = m_subsurface->m_events.destroy.registerListener([this](std::any d) { onDestroy(); });
+ m_listeners.mapSubsurface = m_subsurface->m_surface->m_events.map.registerListener([this](std::any d) { onMap(); });
+ m_listeners.unmapSubsurface = m_subsurface->m_surface->m_events.unmap.registerListener([this](std::any d) { onUnmap(); });
m_listeners.newSubsurface =
- m_subsurface->surface->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
+ m_subsurface->m_surface->m_events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
} else {
if (m_windowParent)
- m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->events.newSubsurface.registerListener(
+ m_listeners.newSubsurface = m_windowParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener(
[this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
else if (m_popupParent)
- m_listeners.newSubsurface =
- m_popupParent->m_wlSurface->resource()->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
+ m_listeners.newSubsurface = m_popupParent->m_wlSurface->resource()->m_events.newSubsurface.registerListener(
+ [this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
else
ASSERT(false);
}
@@ -95,7 +95,7 @@ void CSubsurface::recheckDamageForSubsurfaces() {
void CSubsurface::onCommit() {
// no damaging if it's not visible
if (!m_windowParent.expired() && (!m_windowParent->m_isMapped || !m_windowParent->m_workspace->m_visible)) {
- m_lastSize = m_wlSurface->resource()->current.size;
+ m_lastSize = m_wlSurface->resource()->m_current.size;
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
if (*PLOGDAMAGE)
@@ -115,10 +115,10 @@ void CSubsurface::onCommit() {
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
checkSiblingDamage();
- if (m_lastSize != m_wlSurface->resource()->current.size || m_lastPosition != m_subsurface->position) {
+ if (m_lastSize != m_wlSurface->resource()->m_current.size || m_lastPosition != m_subsurface->m_position) {
damageLastArea();
- m_lastSize = m_wlSurface->resource()->current.size;
- m_lastPosition = m_subsurface->position;
+ m_lastSize = m_wlSurface->resource()->m_current.size;
+ m_lastPosition = m_subsurface->m_position;
}
}
@@ -151,8 +151,8 @@ void CSubsurface::onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface) {
}
void CSubsurface::onMap() {
- m_lastSize = m_wlSurface->resource()->current.size;
- m_lastPosition = m_subsurface->position;
+ m_lastSize = m_wlSurface->resource()->m_current.size;
+ m_lastPosition = m_subsurface->m_position;
const auto COORDS = coordsGlobal();
CBox box{COORDS, m_lastSize};
@@ -175,7 +175,7 @@ void CSubsurface::onUnmap() {
}
void CSubsurface::damageLastArea() {
- const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->position;
+ const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->m_position;
CBox box{COORDS, m_lastSize};
box.expand(4);
g_pHyprRenderer->damageBox(box);
@@ -199,15 +199,15 @@ Vector2D CSubsurface::coordsGlobal() {
}
void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
- for (auto const& s : pSurface->subsurfaces) {
- if (!s || s->surface->hlSurface /* already assigned */)
+ for (auto const& s : pSurface->m_subsurfaces) {
+ if (!s || s->m_surface->m_hlSurface /* already assigned */)
continue;
onNewSubsurface(s.lock());
}
}
Vector2D CSubsurface::size() {
- return m_wlSurface->resource()->current.size;
+ return m_wlSurface->resource()->m_current.size;
}
bool CSubsurface::visible() {
diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp
index d5e35be1..6666ea52 100644
--- a/src/desktop/WLSurface.cpp
+++ b/src/desktop/WLSurface.cpp
@@ -59,12 +59,12 @@ bool CWLSurface::small() const {
if (!validMapped(m_windowOwner) || !exists())
return false;
- if (!m_resource->current.texture)
+ if (!m_resource->m_current.texture)
return false;
const auto O = m_windowOwner.lock();
- return O->m_reportedSize.x > m_resource->current.size.x + 1 || O->m_reportedSize.y > m_resource->current.size.y + 1;
+ return O->m_reportedSize.x > m_resource->m_current.size.x + 1 || O->m_reportedSize.y > m_resource->m_current.size.y + 1;
}
Vector2D CWLSurface::correctSmallVec() const {
@@ -78,36 +78,37 @@ Vector2D CWLSurface::correctSmallVec() const {
}
Vector2D CWLSurface::correctSmallVecBuf() const {
- if (!exists() || !small() || m_fillIgnoreSmall || !m_resource->current.texture)
+ if (!exists() || !small() || m_fillIgnoreSmall || !m_resource->m_current.texture)
return {};
const auto SIZE = getViewporterCorrectedSize();
- const auto BS = m_resource->current.bufferSize;
+ const auto BS = m_resource->m_current.bufferSize;
return Vector2D{(BS.x - SIZE.x) / 2, (BS.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY});
}
Vector2D CWLSurface::getViewporterCorrectedSize() const {
- if (!exists() || !m_resource->current.texture)
+ if (!exists() || !m_resource->m_current.texture)
return {};
- return m_resource->current.viewport.hasDestination ? m_resource->current.viewport.destination : m_resource->current.bufferSize;
+ return m_resource->m_current.viewport.hasDestination ? m_resource->m_current.viewport.destination : m_resource->m_current.bufferSize;
}
CRegion CWLSurface::computeDamage() const {
- if (!m_resource->current.texture)
+ if (!m_resource->m_current.texture)
return {};
- CRegion damage = m_resource->current.accumulateBufferDamage();
- damage.transform(wlTransformToHyprutils(m_resource->current.transform), m_resource->current.bufferSize.x, m_resource->current.bufferSize.y);
+ CRegion damage = m_resource->m_current.accumulateBufferDamage();
+ damage.transform(wlTransformToHyprutils(m_resource->m_current.transform), m_resource->m_current.bufferSize.x, m_resource->m_current.bufferSize.y);
- const auto BUFSIZE = m_resource->current.bufferSize;
+ const auto BUFSIZE = m_resource->m_current.bufferSize;
const auto CORRECTVEC = correctSmallVecBuf();
- if (m_resource->current.viewport.hasSource)
- damage.intersect(m_resource->current.viewport.source);
+ if (m_resource->m_current.viewport.hasSource)
+ damage.intersect(m_resource->m_current.viewport.source);
- const auto SCALEDSRCSIZE = m_resource->current.viewport.hasSource ? m_resource->current.viewport.source.size() * m_resource->current.scale : m_resource->current.bufferSize;
+ const auto SCALEDSRCSIZE =
+ m_resource->m_current.viewport.hasSource ? m_resource->m_current.viewport.source.size() * m_resource->m_current.scale : m_resource->m_current.bufferSize;
damage.scale({BUFSIZE.x / SCALEDSRCSIZE.x, BUFSIZE.y / SCALEDSRCSIZE.y});
damage.translate(CORRECTVEC);
@@ -115,8 +116,8 @@ CRegion CWLSurface::computeDamage() const {
// go from buffer coords in the damage to hl logical
const auto BOX = getSurfaceBoxGlobal();
- const Vector2D SCALE = BOX.has_value() ? BOX->size() / m_resource->current.bufferSize :
- Vector2D{1.0 / m_resource->current.scale, 1.0 / m_resource->current.scale /* Wrong... but we can't really do better */};
+ const Vector2D SCALE = BOX.has_value() ? BOX->size() / m_resource->m_current.bufferSize :
+ Vector2D{1.0 / m_resource->m_current.scale, 1.0 / m_resource->m_current.scale /* Wrong... but we can't really do better */};
damage.scale(SCALE);
@@ -135,7 +136,7 @@ void CWLSurface::destroy() {
m_constraint.reset();
m_listeners.destroy.reset();
- m_resource->hlSurface.reset();
+ m_resource->m_hlSurface.reset();
m_windowOwner.reset();
m_layerOwner.reset();
m_popupOwner = nullptr;
@@ -154,11 +155,11 @@ void CWLSurface::init() {
if (!m_resource)
return;
- RASSERT(!m_resource->hlSurface, "Attempted to duplicate CWLSurface ownership!");
+ RASSERT(!m_resource->m_hlSurface, "Attempted to duplicate CWLSurface ownership!");
- m_resource->hlSurface = m_self.lock();
+ m_resource->m_hlSurface = m_self.lock();
- m_listeners.destroy = m_resource->events.destroy.registerListener([this](std::any d) { destroy(); });
+ m_listeners.destroy = m_resource->m_events.destroy.registerListener([this](std::any d) { destroy(); });
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
}
@@ -222,7 +223,7 @@ bool CWLSurface::visible() {
SP<CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
if (!pSurface)
return nullptr;
- return pSurface->hlSurface.lock();
+ return pSurface->m_hlSurface.lock();
}
bool CWLSurface::keyboardFocusable() const {
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 64771895..4686ecb1 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -184,11 +184,11 @@ SBoxExtents CWindow::getFullWindowExtents() {
if (-surfaceExtents.y > maxExtents.topLeft.y)
maxExtents.topLeft.y = -surfaceExtents.y;
- if (surfaceExtents.x + surfaceExtents.width > m_wlSurface->resource()->current.size.x + maxExtents.bottomRight.x)
- maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_wlSurface->resource()->current.size.x;
+ if (surfaceExtents.x + surfaceExtents.width > m_wlSurface->resource()->m_current.size.x + maxExtents.bottomRight.x)
+ maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_wlSurface->resource()->m_current.size.x;
- if (surfaceExtents.y + surfaceExtents.height > m_wlSurface->resource()->current.size.y + maxExtents.bottomRight.y)
- maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_wlSurface->resource()->current.size.y;
+ if (surfaceExtents.y + surfaceExtents.height > m_wlSurface->resource()->m_current.size.y + maxExtents.bottomRight.y)
+ maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_wlSurface->resource()->m_current.size.y;
}
return maxExtents;
@@ -1159,18 +1159,18 @@ bool CWindow::opaque() {
if (PWORKSPACE->m_alpha->value() != 1.f)
return false;
- if (m_isX11 && m_xwaylandSurface && m_xwaylandSurface->surface && m_xwaylandSurface->surface->current.texture)
- return m_xwaylandSurface->surface->current.texture->m_bOpaque;
+ if (m_isX11 && m_xwaylandSurface && m_xwaylandSurface->surface && m_xwaylandSurface->surface->m_current.texture)
+ return m_xwaylandSurface->surface->m_current.texture->m_bOpaque;
- if (!m_wlSurface->resource() || !m_wlSurface->resource()->current.texture)
+ if (!m_wlSurface->resource() || !m_wlSurface->resource()->m_current.texture)
return false;
// TODO: this is wrong
- const auto EXTENTS = m_xdgSurface->surface->current.opaque.getExtents();
- if (EXTENTS.w >= m_xdgSurface->surface->current.bufferSize.x && EXTENTS.h >= m_xdgSurface->surface->current.bufferSize.y)
+ const auto EXTENTS = m_xdgSurface->surface->m_current.opaque.getExtents();
+ if (EXTENTS.w >= m_xdgSurface->surface->m_current.bufferSize.x && EXTENTS.h >= m_xdgSurface->surface->m_current.bufferSize.y)
return true;
- return m_wlSurface->resource()->current.texture->m_bOpaque;
+ return m_wlSurface->resource()->m_current.texture->m_bOpaque;
}
float CWindow::rounding() {
@@ -1772,19 +1772,19 @@ void CWindow::sendWindowSize(bool force) {
}
NContentType::eContentType CWindow::getContentType() {
- if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->contentType.valid())
+ if (!m_wlSurface || !m_wlSurface->resource() || !m_wlSurface->resource()->m_contentType.valid())
return CONTENT_TYPE_NONE;
- return m_wlSurface->resource()->contentType->value;
+ return m_wlSurface->resource()->m_contentType->value;
}
void CWindow::setContentType(NContentType::eContentType contentType) {
- if (!m_wlSurface->resource()->contentType.valid())
- m_wlSurface->resource()->contentType = PROTO::contentType->getContentType(m_wlSurface->resource());
+ if (!m_wlSurface->resource()->m_contentType.valid())
+ m_wlSurface->resource()->m_contentType = PROTO::contentType->getContentType(m_wlSurface->resource());
// else disallow content type change if proto is used?
Debug::log(INFO, "ContentType for window {}", (int)contentType);
- m_wlSurface->resource()->contentType->value = contentType;
+ m_wlSurface->resource()->m_contentType->value = contentType;
}
void CWindow::deactivateGroupMembers() {
diff --git a/src/devices/Tablet.cpp b/src/devices/Tablet.cpp
index e4c399c9..faeb3d73 100644
--- a/src/devices/Tablet.cpp
+++ b/src/devices/Tablet.cpp
@@ -265,7 +265,7 @@ void CTabletTool::setSurface(SP<CWLSurfaceResource> surf) {
m_surface = surf;
if (surf) {
- m_listeners.destroySurface = surf->events.destroy.registerListener([this](std::any d) {
+ m_listeners.destroySurface = surf->m_events.destroy.registerListener([this](std::any d) {
PROTO::tablet->proximityOut(m_self.lock());
m_surface.reset();
m_listeners.destroySurface.reset();
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index eec01a7d..87429874 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -892,8 +892,9 @@ void Events::listener_commitWindow(void* owner, void* data) {
}
// tearing: if solitary, redraw it. This still might be a single surface window
- if (PMONITOR && PMONITOR->m_solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->m_tearingState.canTear && PWINDOW->m_wlSurface->resource()->current.texture) {
- CRegion damageBox{PWINDOW->m_wlSurface->resource()->current.accumulateBufferDamage()};
+ if (PMONITOR && PMONITOR->m_solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->m_tearingState.canTear &&
+ PWINDOW->m_wlSurface->resource()->m_current.texture) {
+ CRegion damageBox{PWINDOW->m_wlSurface->resource()->m_current.accumulateBufferDamage()};
if (!damageBox.empty()) {
if (PMONITOR->m_tearingState.busy) {
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 2edba78a..043cd5cc 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -1368,20 +1368,20 @@ bool CMonitor::attemptDirectScanout() {
const auto PSURFACE = g_pXWaylandManager->getWindowSurface(PCANDIDATE);
- if (!PSURFACE || !PSURFACE->current.texture || !PSURFACE->current.buffer)
+ if (!PSURFACE || !PSURFACE->m_current.texture || !PSURFACE->m_current.buffer)
return false;
- if (PSURFACE->current.bufferSize != m_pixelSize || PSURFACE->current.transform != m_transform)
+ if (PSURFACE->m_current.bufferSize != m_pixelSize || PSURFACE->m_current.transform != m_transform)
return false;
// we can't scanout shm buffers.
- const auto params = PSURFACE->current.buffer->dmabuf();
- if (!params.success || !PSURFACE->current.texture->m_pEglImage /* dmabuf */)
+ const auto params = PSURFACE->m_current.buffer->dmabuf();
+ if (!params.success || !PSURFACE->m_current.texture->m_pEglImage /* dmabuf */)
return false;
- Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {}", (uintptr_t)PSURFACE.get(), (uintptr_t)PSURFACE->current.buffer.buffer.get());
+ Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {}", (uintptr_t)PSURFACE.get(), (uintptr_t)PSURFACE->m_current.buffer.buffer.get());
- auto PBUFFER = PSURFACE->current.buffer.buffer;
+ auto PBUFFER = PSURFACE->m_current.buffer.buffer;
if (PBUFFER == m_output->state->state().buffer) {
PSURFACE->presentFeedback(Time::steadyNow(), m_self.lock());
@@ -1427,7 +1427,7 @@ bool CMonitor::attemptDirectScanout() {
PSURFACE->presentFeedback(Time::steadyNow(), m_self.lock());
- m_output->state->addDamage(PSURFACE->current.accumulateBufferDamage());
+ m_output->state->addDamage(PSURFACE->m_current.accumulateBufferDamage());
m_output->state->resetExplicitFences();
// no need to do explicit sync here as surface current can only ever be ready to read
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 3b0821d7..e107a9e1 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -118,7 +118,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PWINDOWSURFACE = pWindow->m_wlSurface->resource();
- *pWindow->m_realSize = PWINDOWSURFACE->current.size;
+ *pWindow->m_realSize = PWINDOWSURFACE->m_current.size;
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
pWindow->isX11OverrideRedirect()) { // XDG windows should be fine. TODO: check for weird atoms?
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<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) {
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<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); });
});
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 <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;
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<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())
diff --git a/src/protocols/AlphaModifier.cpp b/src/protocols/AlphaModifier.cpp
index 3fea51fe..87c46765 100644
--- a/src/protocols/AlphaModifier.cpp
+++ b/src/protocols/AlphaModifier.cpp
@@ -30,7 +30,7 @@ void CAlphaModifier::setResource(SP<CWpAlphaModifierSurfaceV1> resource) {
m_fAlpha = alpha / (float)UINT32_MAX;
});
- listeners.surfaceCommitted = m_pSurface->events.commit.registerListener([this](std::any data) {
+ listeners.surfaceCommitted = m_pSurface->m_events.commit.registerListener([this](std::any data) {
auto surface = CWLSurface::fromResource(m_pSurface.lock());
if (surface && surface->m_alphaModifier != m_fAlpha) {
@@ -45,7 +45,7 @@ void CAlphaModifier::setResource(SP<CWpAlphaModifierSurfaceV1> resource) {
}
});
- listeners.surfaceDestroyed = m_pSurface->events.destroy.registerListener([this](std::any data) {
+ listeners.surfaceDestroyed = m_pSurface->m_events.destroy.registerListener([this](std::any data) {
if (!m_pResource)
PROTO::alphaModifier->destroyAlphaModifier(this);
});
diff --git a/src/protocols/CTMControl.cpp b/src/protocols/CTMControl.cpp
index a6fad119..c848fab8 100644
--- a/src/protocols/CTMControl.cpp
+++ b/src/protocols/CTMControl.cpp
@@ -25,7 +25,7 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
if UNLIKELY (!OUTPUTRESOURCE)
return; // ?!
- const auto PMONITOR = OUTPUTRESOURCE->monitor.lock();
+ const auto PMONITOR = OUTPUTRESOURCE->m_monitor.lock();
if UNLIKELY (!PMONITOR)
return; // ?!?!
diff --git a/src/protocols/ColorManagement.cpp b/src/protocols/ColorManagement.cpp
index 812ac4c6..5810b414 100644
--- a/src/protocols/ColorManagement.cpp
+++ b/src/protocols/ColorManagement.cpp
@@ -74,7 +74,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
return;
}
- const auto PMONITOR = OUTPUTRESOURCE->monitor.lock();
+ const auto PMONITOR = OUTPUTRESOURCE->m_monitor.lock();
if UNLIKELY (!PMONITOR) {
r->error(-1, "Invalid output (2)");
@@ -102,7 +102,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
return;
}
- if (SURF->colorManagement) {
+ if (SURF->m_colorManagement) {
r->error(WP_COLOR_MANAGER_V1_ERROR_SURFACE_EXISTS, "CM Surface already exists");
return;
}
@@ -117,7 +117,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
RESOURCE->self = RESOURCE;
- SURF->colorManagement = RESOURCE;
+ SURF->m_colorManagement = RESOURCE;
});
m_resource->setGetSurfaceFeedback([](CWpColorManagerV1* r, uint32_t id, wl_resource* surface) {
LOGM(TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface);
diff --git a/src/protocols/ContentType.cpp b/src/protocols/ContentType.cpp
index 0dd5481a..8ea212f1 100644
--- a/src/protocols/ContentType.cpp
+++ b/src/protocols/ContentType.cpp
@@ -19,7 +19,7 @@ CContentTypeManager::CContentTypeManager(SP<CWpContentTypeManagerV1> resource) :
return;
}
- if (SURF->colorManagement) {
+ if (SURF->m_colorManagement) {
r->error(WP_CONTENT_TYPE_MANAGER_V1_ERROR_ALREADY_CONSTRUCTED, "CT manager already exists");
return;
}
@@ -33,7 +33,7 @@ CContentTypeManager::CContentTypeManager(SP<CWpContentTypeManagerV1> resource) :
RESOURCE->self = RESOURCE;
- SURF->contentType = RESOURCE;
+ SURF->m_contentType = RESOURCE;
});
}
@@ -42,7 +42,7 @@ bool CContentTypeManager::good() {
}
CContentType::CContentType(WP<CWLSurfaceResource> surface) {
- destroy = surface->events.destroy.registerListener([this](std::any d) { PROTO::contentType->destroyResource(this); });
+ destroy = surface->m_events.destroy.registerListener([this](std::any d) { PROTO::contentType->destroyResource(this); });
}
CContentType::CContentType(SP<CWpContentTypeV1> resource) : m_resource(resource) {
@@ -80,8 +80,8 @@ void CContentTypeProtocol::bindManager(wl_client* client, void* data, uint32_t v
}
SP<CContentType> CContentTypeProtocol::getContentType(WP<CWLSurfaceResource> surface) {
- if (surface->contentType.valid())
- return surface->contentType.lock();
+ if (surface->m_contentType.valid())
+ return surface->m_contentType.lock();
return m_vContentTypes.emplace_back(makeShared<CContentType>(surface));
}
diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp
index 48a80dcc..2da2340a 100644
--- a/src/protocols/DRMSyncobj.cpp
+++ b/src/protocols/DRMSyncobj.cpp
@@ -74,38 +74,38 @@ CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(UP<CWpLinuxDrmSyncobjSurf
pendingRelease = {timeline->timeline, ((uint64_t)hi << 32) | (uint64_t)lo};
});
- listeners.surfacePrecommit = surface->events.precommit.registerListener([this](std::any d) {
- if (!surface->pending.updated.buffer || !surface->pending.buffer) {
+ listeners.surfacePrecommit = surface->m_events.precommit.registerListener([this](std::any d) {
+ if (!surface->m_pending.updated.buffer || !surface->m_pending.buffer) {
if (pendingAcquire.timeline() || pendingRelease.timeline()) {
resource->error(WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_BUFFER, "Missing buffer");
- surface->pending.rejected = true;
+ surface->m_pending.rejected = true;
}
return;
}
if (!pendingAcquire.timeline()) {
resource->error(WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_ACQUIRE_POINT, "Missing acquire timeline");
- surface->pending.rejected = true;
+ surface->m_pending.rejected = true;
return;
}
if (!pendingRelease.timeline()) {
resource->error(WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_NO_RELEASE_POINT, "Missing release timeline");
- surface->pending.rejected = true;
+ surface->m_pending.rejected = true;
return;
}
if (pendingAcquire.timeline() == pendingRelease.timeline() && pendingAcquire.point() >= pendingRelease.point()) {
resource->error(WP_LINUX_DRM_SYNCOBJ_SURFACE_V1_ERROR_CONFLICTING_POINTS, "Acquire and release points are on the same timeline, and acquire >= release");
- surface->pending.rejected = true;
+ surface->m_pending.rejected = true;
return;
}
- surface->pending.updated.acquire = true;
- surface->pending.acquire = pendingAcquire;
- pendingAcquire = {};
+ surface->m_pending.updated.acquire = true;
+ surface->m_pending.acquire = pendingAcquire;
+ pendingAcquire = {};
- surface->pending.buffer->addReleasePoint(pendingRelease);
+ surface->m_pending.buffer->addReleasePoint(pendingRelease);
pendingRelease = {};
});
}
@@ -163,7 +163,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana
return;
}
- if UNLIKELY (SURF->syncobj) {
+ if UNLIKELY (SURF->m_syncobj) {
resource->error(WP_LINUX_DRM_SYNCOBJ_MANAGER_V1_ERROR_SURFACE_EXISTS, "Surface already has a syncobj attached");
return;
}
@@ -176,7 +176,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana
return;
}
- SURF->syncobj = RESOURCE;
+ SURF->m_syncobj = RESOURCE;
LOGM(LOG, "New linux_syncobj at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)SURF.get());
});
diff --git a/src/protocols/FocusGrab.cpp b/src/protocols/FocusGrab.cpp
index 9a3e1c51..9751666d 100644
--- a/src/protocols/FocusGrab.cpp
+++ b/src/protocols/FocusGrab.cpp
@@ -8,7 +8,7 @@
#include <wayland-server.h>
CFocusGrabSurfaceState::CFocusGrabSurfaceState(CFocusGrab* grab, SP<CWLSurfaceResource> surface) {
- listeners.destroy = surface->events.destroy.registerListener([=](std::any d) { grab->eraseSurface(surface); });
+ listeners.destroy = surface->m_events.destroy.registerListener([=](std::any d) { grab->eraseSurface(surface); });
}
CFocusGrab::CFocusGrab(SP<CHyprlandFocusGrabV1> resource_) : resource(resource_) {
diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp
index 2a2929e5..38ce60d2 100644
--- a/src/protocols/ForeignToplevelWlr.cpp
+++ b/src/protocols/ForeignToplevelWlr.cpp
@@ -41,7 +41,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
}
if (output) {
- const auto wpMonitor = CWLOutputResource::fromResource(output)->monitor;
+ const auto wpMonitor = CWLOutputResource::fromResource(output)->m_monitor;
if (!wpMonitor.expired()) {
const auto monitor = wpMonitor.lock();
diff --git a/src/protocols/FractionalScale.cpp b/src/protocols/FractionalScale.cpp
index 494de9c5..a9fbcb16 100644
--- a/src/protocols/FractionalScale.cpp
+++ b/src/protocols/FractionalScale.cpp
@@ -47,7 +47,7 @@ void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1*
if (std::ranges::find_if(m_mSurfaceScales, [surface](const auto& e) { return e.first == surface; }) == m_mSurfaceScales.end())
m_mSurfaceScales.emplace(surface, 1.F);
- if (surface->mapped)
+ if (surface->m_mapped)
PADDON->setScale(m_mSurfaceScales.at(surface));
// clean old
diff --git a/src/protocols/FrogColorManagement.cpp b/src/protocols/FrogColorManagement.cpp
index 99bdb2bb..870b573f 100644
--- a/src/protocols/FrogColorManagement.cpp
+++ b/src/protocols/FrogColorManagement.cpp
@@ -61,7 +61,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
pClient = resource->client();
- if (!surface->colorManagement.valid()) {
+ if (!surface->m_colorManagement.valid()) {
const auto RESOURCE = PROTO::colorManagement->m_vSurfaces.emplace_back(makeShared<CColorManagementSurface>(surface_));
if UNLIKELY (!RESOURCE) {
resource->noMemory();
@@ -71,12 +71,12 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
RESOURCE->self = RESOURCE;
- surface->colorManagement = RESOURCE;
+ surface->m_colorManagement = RESOURCE;
resource->setOnDestroy([this](CFrogColorManagedSurface* r) {
LOGM(TRACE, "Destroy frog cm and xx cm for surface {}", (uintptr_t)surface);
if (surface.valid())
- PROTO::colorManagement->destroyResource(surface->colorManagement.get());
+ PROTO::colorManagement->destroyResource(surface->m_colorManagement.get());
PROTO::frogColorManagement->destroyResource(this);
});
} else
@@ -94,7 +94,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
LOGM(TRACE, "Set frog cm transfer function {} for {}", (uint32_t)tf, surface->id());
switch (tf) {
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ:
- surface->colorManagement->m_imageDescription.transferFunction =
+ surface->m_colorManagement->m_imageDescription.transferFunction =
convertTransferFunction(getWPTransferFunction(FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ));
break;
;
@@ -102,7 +102,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
if (pqIntentSent) {
LOGM(TRACE,
"FIXME: assuming broken enum value 2 (FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_GAMMA_22) referring to eotf value 2 (TRANSFER_FUNCTION_ST2084_PQ)");
- surface->colorManagement->m_imageDescription.transferFunction =
+ surface->m_colorManagement->m_imageDescription.transferFunction =
convertTransferFunction(getWPTransferFunction(FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ));
break;
};
@@ -110,40 +110,40 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_UNDEFINED:
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SCRGB_LINEAR: LOGM(TRACE, "FIXME: add tf support for {}", (uint32_t)tf); [[fallthrough]];
case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SRGB:
- surface->colorManagement->m_imageDescription.transferFunction = convertTransferFunction(getWPTransferFunction(tf));
+ surface->m_colorManagement->m_imageDescription.transferFunction = convertTransferFunction(getWPTransferFunction(tf));
- surface->colorManagement->setHasImageDescription(true);
+ surface->m_colorManagement->setHasImageDescription(true);
}
});
resource->setSetKnownContainerColorVolume([this](CFrogColorManagedSurface* r, frogColorManagedSurfacePrimaries primariesName) {
LOGM(TRACE, "Set frog cm primaries {}", (uint32_t)primariesName);
switch (primariesName) {
case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_UNDEFINED:
- case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC709: surface->colorManagement->m_imageDescription.primaries = NColorPrimaries::BT709; break;
- case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC2020: surface->colorManagement->m_imageDescription.primaries = NColorPrimaries::BT2020; break;
+ case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC709: surface->m_colorManagement->m_imageDescription.primaries = NColorPrimaries::BT709; break;
+ case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC2020: surface->m_colorManagement->m_imageDescription.primaries = NColorPrimaries::BT2020; break;
}
- surface->colorManagement->m_imageDescription.primariesNamed = convertPrimaries(getWPPrimaries(primariesName));
+ surface->m_colorManagement->m_imageDescription.primariesNamed = convertPrimaries(getWPPrimaries(primariesName));
- surface->colorManagement->setHasImageDescription(true);
+ surface->m_colorManagement->setHasImageDescription(true);
});
resource->setSetRenderIntent([this](CFrogColorManagedSurface* r, frogColorManagedSurfaceRenderIntent intent) {
LOGM(TRACE, "Set frog cm intent {}", (uint32_t)intent);
pqIntentSent = intent == FROG_COLOR_MANAGED_SURFACE_RENDER_INTENT_PERCEPTUAL;
- surface->colorManagement->setHasImageDescription(true);
+ surface->m_colorManagement->setHasImageDescription(true);
});
resource->setSetHdrMetadata([this](CFrogColorManagedSurface* r, uint32_t r_x, uint32_t r_y, uint32_t g_x, uint32_t g_y, uint32_t b_x, uint32_t b_y, uint32_t w_x, uint32_t w_y,
uint32_t max_lum, uint32_t min_lum, uint32_t cll, uint32_t fall) {
LOGM(TRACE, "Set frog primaries r:{},{} g:{},{} b:{},{} w:{},{} luminances {} - {} cll {} fall {}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y, min_lum, max_lum, cll, fall);
- surface->colorManagement->m_imageDescription.masteringPrimaries = SPCPRimaries{.red = {.x = r_x / 50000.0f, .y = r_y / 50000.0f},
- .green = {.x = g_x / 50000.0f, .y = g_y / 50000.0f},
- .blue = {.x = b_x / 50000.0f, .y = b_y / 50000.0f},
- .white = {.x = w_x / 50000.0f, .y = w_y / 50000.0f}};
- surface->colorManagement->m_imageDescription.masteringLuminances.min = min_lum / 10000.0f;
- surface->colorManagement->m_imageDescription.masteringLuminances.max = max_lum;
- surface->colorManagement->m_imageDescription.maxCLL = cll;
- surface->colorManagement->m_imageDescription.maxFALL = fall;
-
- surface->colorManagement->setHasImageDescription(true);
+ surface->m_colorManagement->m_imageDescription.masteringPrimaries = SPCPRimaries{.red = {.x = r_x / 50000.0f, .y = r_y / 50000.0f},
+ .green = {.x = g_x / 50000.0f, .y = g_y / 50000.0f},
+ .blue = {.x = b_x / 50000.0f, .y = b_y / 50000.0f},
+ .white = {.x = w_x / 50000.0f, .y = w_y / 50000.0f}};
+ surface->m_colorManagement->m_imageDescription.masteringLuminances.min = min_lum / 10000.0f;
+ surface->m_colorManagement->m_imageDescription.masteringLuminances.max = max_lum;
+ surface->m_colorManagement->m_imageDescription.maxCLL = cll;
+ surface->m_colorManagement->m_imageDescription.maxFALL = fall;
+
+ surface->m_colorManagement->setHasImageDescription(true);
});
}
diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp
index 322f0e56..1309ffc5 100644
--- a/src/protocols/GammaControl.cpp
+++ b/src/protocols/GammaControl.cpp
@@ -18,7 +18,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
return;
}
- pMonitor = OUTPUTRES->monitor;
+ pMonitor = OUTPUTRES->m_monitor;
if UNLIKELY (!pMonitor || !pMonitor->m_output) {
LOGM(ERR, "No CMonitor");
diff --git a/src/protocols/HyprlandSurface.cpp b/src/protocols/HyprlandSurface.cpp
index cdf6d722..13d5a49a 100644
--- a/src/protocols/HyprlandSurface.cpp
+++ b/src/protocols/HyprlandSurface.cpp
@@ -48,10 +48,10 @@ void CHyprlandSurface::setResource(SP<CHyprlandSurfaceV1> resource) {
}
m_bVisibleRegionChanged = true;
- m_visibleRegion = CWLRegionResource::fromResource(region)->region;
+ m_visibleRegion = CWLRegionResource::fromResource(region)->m_region;
});
- listeners.surfaceCommitted = m_pSurface->events.commit.registerListener([this](std::any data) {
+ listeners.surfaceCommitted = m_pSurface->m_events.commit.registerListener([this](std::any data) {
auto surface = CWLSurface::fromResource(m_pSurface.lock());
if (surface && (surface->m_overallOpacity != m_fOpacity || m_bVisibleRegionChanged)) {
@@ -67,7 +67,7 @@ void CHyprlandSurface::setResource(SP<CHyprlandSurfaceV1> resource) {
}
});
- listeners.surfaceDestroyed = m_pSurface->events.destroy.registerListener([this](std::any data) {
+ listeners.surfaceDestroyed = m_pSurface->m_events.destroy.registerListener([this](std::any data) {
if (!m_pResource)
PROTO::hyprlandSurface->destroySurface(this);
});
diff --git a/src/protocols/IdleInhibit.cpp b/src/protocols/IdleInhibit.cpp
index a015cdd0..b8ba01e2 100644
--- a/src/protocols/IdleInhibit.cpp
+++ b/src/protocols/IdleInhibit.cpp
@@ -6,7 +6,7 @@ CIdleInhibitor::CIdleInhibitor(SP<CIdleInhibitorResource> resource_, SP<CWLSurfa
}
CIdleInhibitorResource::CIdleInhibitorResource(SP<CZwpIdleInhibitorV1> resource_, SP<CWLSurfaceResource> surface_) : resource(resource_), surface(surface_) {
- listeners.destroySurface = surface->events.destroy.registerListener([this](std::any d) {
+ listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) {
surface.reset();
listeners.destroySurface.reset();
destroySent = true;
diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp
index 05cf90e1..ae575250 100644
--- a/src/protocols/InputMethodV2.cpp
+++ b/src/protocols/InputMethodV2.cpp
@@ -88,7 +88,7 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
pSurface = surface;
- listeners.destroySurface = surface->events.destroy.registerListener([this](std::any d) {
+ listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) {
if (mapped)
events.unmap.emit();
@@ -101,15 +101,15 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
pSurface.reset();
});
- listeners.commitSurface = surface->events.commit.registerListener([this](std::any d) {
- if (pSurface->current.texture && !mapped) {
+ listeners.commitSurface = surface->m_events.commit.registerListener([this](std::any d) {
+ if (pSurface->m_current.texture && !mapped) {
mapped = true;
pSurface->map();
events.map.emit();
return;
}
- if (!pSurface->current.texture && mapped) {
+ if (!pSurface->m_current.texture && mapped) {
mapped = false;
pSurface->unmap();
events.unmap.emit();
diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp
index 7f5d366a..bc4112fa 100644
--- a/src/protocols/LayerShell.cpp
+++ b/src/protocols/LayerShell.cpp
@@ -33,18 +33,18 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
PROTO::layerShell->destroyResource(this);
});
- listeners.destroySurface = surf_->events.destroy.registerListener([this](std::any d) {
+ listeners.destroySurface = surf_->m_events.destroy.registerListener([this](std::any d) {
events.destroy.emit();
PROTO::layerShell->destroyResource(this);
});
- listeners.unmapSurface = surf_->events.unmap.registerListener([this](std::any d) { events.unmap.emit(); });
+ listeners.unmapSurface = surf_->m_events.unmap.registerListener([this](std::any d) { events.unmap.emit(); });
- listeners.commitSurface = surf_->events.commit.registerListener([this](std::any d) {
+ listeners.commitSurface = surf_->m_events.commit.registerListener([this](std::any d) {
current = pending;
pending.committed = 0;
- bool attachedBuffer = surface->current.texture;
+ bool attachedBuffer = surface->m_current.texture;
if (attachedBuffer && !configured) {
surface->error(-1, "layerSurface was not configured, but a buffer was attached");
@@ -220,7 +220,7 @@ void CLayerShellProtocol::destroyResource(CLayerShellResource* surf) {
void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* output, zwlrLayerShellV1Layer layer, std::string namespace_) {
const auto CLIENT = pMgr->client();
- const auto PMONITOR = output ? CWLOutputResource::fromResource(output)->monitor.lock() : nullptr;
+ const auto PMONITOR = output ? CWLOutputResource::fromResource(output)->m_monitor.lock() : nullptr;
auto SURF = CWLSurfaceResource::fromResource(surface);
if UNLIKELY (!SURF) {
@@ -228,7 +228,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
return;
}
- if UNLIKELY (SURF->role->role() != SURFACE_ROLE_UNASSIGNED) {
+ if UNLIKELY (SURF->m_role->role() != SURFACE_ROLE_UNASSIGNED) {
pMgr->error(-1, "Surface already has a different role");
return;
}
@@ -246,7 +246,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
return;
}
- SURF->role = makeShared<CLayerShellRole>(RESOURCE);
+ SURF->m_role = makeShared<CLayerShellRole>(RESOURCE);
g_pCompositor->m_layers.emplace_back(CLayerSurface::create(RESOURCE));
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
diff --git a/src/protocols/OutputPower.cpp b/src/protocols/OutputPower.cpp
index 55ea0376..37f932bb 100644
--- a/src/protocols/OutputPower.cpp
+++ b/src/protocols/OutputPower.cpp
@@ -68,7 +68,7 @@ void COutputPowerProtocol::onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uin
}
const auto CLIENT = pMgr->client();
- const auto RESOURCE = m_vOutputPowers.emplace_back(makeUnique<COutputPower>(makeShared<CZwlrOutputPowerV1>(CLIENT, pMgr->version(), id), OUTPUT->monitor.lock())).get();
+ const auto RESOURCE = m_vOutputPowers.emplace_back(makeUnique<COutputPower>(makeShared<CZwlrOutputPowerV1>(CLIENT, pMgr->version(), id), OUTPUT->m_monitor.lock())).get();
if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp
index c97759d8..38df694c 100644
--- a/src/protocols/PointerConstraints.cpp
+++ b/src/protocols/PointerConstraints.cpp
@@ -22,7 +22,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
return;
if (region_)
- region.set(CWLRegionResource::fromResource(region_)->region);
+ region.set(CWLRegionResource::fromResource(region_)->m_region);
resource_->setSetRegion([this](CZwpLockedPointerV1* p, wl_resource* region) { onSetRegion(region); });
resource_->setSetCursorPositionHint([this](CZwpLockedPointerV1* p, wl_fixed_t x, wl_fixed_t y) {
@@ -61,7 +61,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<C
return;
if (region_)
- region.set(CWLRegionResource::fromResource(region_)->region);
+ region.set(CWLRegionResource::fromResource(region_)->m_region);
resource_->setSetRegion([this](CZwpConfinedPointerV1* p, wl_resource* region) { onSetRegion(region); });
@@ -151,7 +151,7 @@ void CPointerConstraint::onSetRegion(wl_resource* wlRegion) {
return;
}
- const auto REGION = region.set(CWLRegionResource::fromResource(wlRegion)->region);
+ const auto REGION = region.set(CWLRegionResource::fromResource(wlRegion)->m_region);
region.set(REGION);
positionHint = region.closestPoint(positionHint);
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index 28523fde..4539a463 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -22,7 +22,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
return;
overlayCursor = !!overlay_cursor;
- pMonitor = CWLOutputResource::fromResource(output)->monitor;
+ pMonitor = CWLOutputResource::fromResource(output)->m_monitor;
if (!pMonitor) {
LOGM(ERR, "Client requested sharing of a monitor that doesnt exist");
diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp
index 40c73a7b..0eccb543 100644
--- a/src/protocols/SessionLock.cpp
+++ b/src/protocols/SessionLock.cpp
@@ -23,8 +23,8 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
resource->setAckConfigure([this](CExtSessionLockSurfaceV1* r, uint32_t serial) { ackdConfigure = true; });
- listeners.surfaceCommit = pSurface->events.commit.registerListener([this](std::any d) {
- if (!pSurface->current.texture) {
+ listeners.surfaceCommit = pSurface->m_events.commit.registerListener([this](std::any d) {
+ if (!pSurface->m_current.texture) {
LOGM(ERR, "SessionLock attached a null buffer");
resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, "Null buffer attached");
return;
@@ -45,7 +45,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
committed = true;
});
- listeners.surfaceDestroy = pSurface->events.destroy.registerListener([this](std::any d) {
+ listeners.surfaceDestroy = pSurface->m_events.destroy.registerListener([this](std::any d) {
LOGM(WARN, "SessionLockSurface object remains but surface is being destroyed???");
pSurface->unmap();
listeners.surfaceCommit.reset();
@@ -64,7 +64,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
}
CSessionLockSurface::~CSessionLockSurface() {
- if (pSurface && pSurface->mapped)
+ if (pSurface && pSurface->m_mapped)
pSurface->unmap();
listeners.surfaceCommit.reset();
listeners.surfaceDestroy.reset();
@@ -189,7 +189,7 @@ void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id
LOGM(LOG, "New sessionLockSurface with id {}", id);
auto PSURFACE = CWLSurfaceResource::fromResource(surface);
- auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.lock();
+ auto PMONITOR = CWLOutputResource::fromResource(output)->m_monitor.lock();
SP<CSessionLock> sessionLock;
for (auto const& l : m_vLocks) {
diff --git a/src/protocols/Viewporter.cpp b/src/protocols/Viewporter.cpp
index 674b8373..0b82603f 100644
--- a/src/protocols/Viewporter.cpp
+++ b/src/protocols/Viewporter.cpp
@@ -15,10 +15,10 @@ CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceRes
return;
}
- surface->pending.updated.viewport = true;
+ surface->m_pending.updated.viewport = true;
if (x == -1 && y == -1) {
- surface->pending.viewport.hasDestination = false;
+ surface->m_pending.viewport.hasDestination = false;
return;
}
@@ -27,8 +27,8 @@ CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceRes
return;
}
- surface->pending.viewport.hasDestination = true;
- surface->pending.viewport.destination = {x, y};
+ surface->m_pending.viewport.hasDestination = true;
+ surface->m_pending.viewport.destination = {x, y};
});
resource->setSetSource([this](CWpViewport* r, wl_fixed_t fx, wl_fixed_t fy, wl_fixed_t fw, wl_fixed_t fh) {
@@ -37,12 +37,12 @@ CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceRes
return;
}
- surface->pending.updated.viewport = true;
+ surface->m_pending.updated.viewport = true;
double x = wl_fixed_to_double(fx), y = wl_fixed_to_double(fy), w = wl_fixed_to_double(fw), h = wl_fixed_to_double(fh);
if (x == -1 && y == -1 && w == -1 && h == -1) {
- surface->pending.viewport.hasSource = false;
+ surface->m_pending.viewport.hasSource = false;
return;
}
@@ -51,20 +51,20 @@ CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceRes
return;
}
- surface->pending.viewport.hasSource = true;
- surface->pending.viewport.source = {x, y, w, h};
+ surface->m_pending.viewport.hasSource = true;
+ surface->m_pending.viewport.source = {x, y, w, h};
});
- listeners.surfacePrecommit = surface->events.precommit.registerListener([this](std::any d) {
- if (!surface || !surface->pending.buffer)
+ listeners.surfacePrecommit = surface->m_events.precommit.registerListener([this](std::any d) {
+ if (!surface || !surface->m_pending.buffer)
return;
- if (surface->pending.viewport.hasSource) {
- auto& src = surface->pending.viewport.source;
+ if (surface->m_pending.viewport.hasSource) {
+ auto& src = surface->m_pending.viewport.source;
- if (src.w + src.x > surface->pending.bufferSize.x || src.h + src.y > surface->pending.bufferSize.y) {
+ if (src.w + src.x > surface->m_pending.bufferSize.x || src.h + src.y > surface->m_pending.bufferSize.y) {
resource->error(WP_VIEWPORT_ERROR_BAD_VALUE, "Box doesn't fit");
- surface->pending.rejected = true;
+ surface->m_pending.rejected = true;
return;
}
}
@@ -75,8 +75,8 @@ CViewportResource::~CViewportResource() {
if (!surface)
return;
- surface->pending.viewport.hasDestination = false;
- surface->pending.viewport.hasSource = false;
+ surface->m_pending.viewport.hasDestination = false;
+ surface->m_pending.viewport.hasSource = false;
}
bool CViewportResource::good() {
diff --git a/src/protocols/VirtualPointer.cpp b/src/protocols/VirtualPointer.cpp
index 8dc4bab6..ce64e1e5 100644
--- a/src/protocols/VirtualPointer.cpp
+++ b/src/protocols/VirtualPointer.cpp
@@ -121,7 +121,7 @@ void CVirtualPointerProtocol::bindManager(wl_client* client, void* data, uint32_
return;
}
- this->onCreatePointer(pMgr, seat, id, RES->monitor);
+ this->onCreatePointer(pMgr, seat, id, RES->m_monitor);
} else
this->onCreatePointer(pMgr, seat, id, {});
});
diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp
index 81c71447..92aaefc9 100644
--- a/src/protocols/XDGOutput.cpp
+++ b/src/protocols/XDGOutput.cpp
@@ -42,7 +42,7 @@ CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver
void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32_t id, wl_resource* outputResource) {
const auto OUTPUT = CWLOutputResource::fromResource(outputResource);
- const auto PMONITOR = OUTPUT->monitor.lock();
+ const auto PMONITOR = OUTPUT->m_monitor.lock();
const auto CLIENT = mgr->client();
CXDGOutput* pXDGOutput = m_vXDGOutputs.emplace_back(makeUnique<CXDGOutput>(makeShared<CZxdgOutputV1>(CLIENT, mgr->version(), id), PMONITOR)).get();
@@ -52,7 +52,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
#endif
pXDGOutput->client = CLIENT;
- pXDGOutput->outputProto = OUTPUT->owner;
+ pXDGOutput->outputProto = OUTPUT->m_owner;
if UNLIKELY (!pXDGOutput->resource->resource()) {
m_vXDGOutputs.pop_back();
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
index a82ba17e..6f58ef64 100644
--- a/src/protocols/XDGShell.cpp
+++ b/src/protocols/XDGShell.cpp
@@ -195,7 +195,7 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
resource->setSetFullscreen([this](CXdgToplevel* r, wl_resource* output) {
if (output)
- if (const auto PM = CWLOutputResource::fromResource(output)->monitor; PM)
+ if (const auto PM = CWLOutputResource::fromResource(output)->m_monitor; PM)
state.requestsFullscreenMonitor = PM->m_id;
state.requestsFullscreen = true;
@@ -372,7 +372,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
PROTO::xdgShell->destroyResource(this);
});
- listeners.surfaceDestroy = surface->events.destroy.registerListener([this](std::any d) {
+ listeners.surfaceDestroy = surface->m_events.destroy.registerListener([this](std::any d) {
LOGM(WARN, "wl_surface destroyed before its xdg_surface role object");
listeners.surfaceDestroy.reset();
listeners.surfaceCommit.reset();
@@ -385,17 +385,17 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
events.destroy.emit();
});
- listeners.surfaceCommit = surface->events.commit.registerListener([this](std::any d) {
+ listeners.surfaceCommit = surface->m_events.commit.registerListener([this](std::any d) {
current = pending;
if (toplevel)
toplevel->current = toplevel->pending;
- if UNLIKELY (initialCommit && surface->pending.buffer) {
+ if UNLIKELY (initialCommit && surface->m_pending.buffer) {
resource->error(-1, "Buffer attached before initial commit");
return;
}
- if (surface->current.texture && !mapped) {
+ if (surface->m_current.texture && !mapped) {
// this forces apps to not draw CSD.
if (toplevel)
toplevel->setMaximized(true);
@@ -406,7 +406,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
return;
}
- if (!surface->current.texture && mapped) {
+ if (!surface->m_current.texture && mapped) {
mapped = false;
events.unmap.emit();
surface->unmap();
@@ -723,7 +723,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : resource(resource_) {
return;
}
- if UNLIKELY (SURF->role->role() != SURFACE_ROLE_UNASSIGNED) {
+ if UNLIKELY (SURF->m_role->role() != SURFACE_ROLE_UNASSIGNED) {
r->error(-1, "Surface already has a different role");
return;
}
@@ -738,7 +738,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : resource(resource_) {
RESOURCE->self = RESOURCE;
RESOURCE->surface = SURF;
- SURF->role = makeShared<CXDGSurfaceRole>(RESOURCE);
+ SURF->m_role = makeShared<CXDGSurfaceRole>(RESOURCE);
surfaces.emplace_back(RESOURCE);
diff --git a/src/protocols/XXColorManagement.cpp b/src/protocols/XXColorManagement.cpp
index 8231ec22..182c2a6d 100644
--- a/src/protocols/XXColorManagement.cpp
+++ b/src/protocols/XXColorManagement.cpp
@@ -88,7 +88,7 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : resource(res
return;
}
- if (SURF->colorManagement) {
+ if (SURF->m_colorManagement) {
r->error(XX_COLOR_MANAGER_V4_ERROR_SURFACE_EXISTS, "CM Surface already exists");
return;
}
@@ -195,7 +195,7 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
pClient = resource->client();
- if (!surface->colorManagement.valid()) {
+ if (!surface->m_colorManagement.valid()) {
const auto RESOURCE = PROTO::colorManagement->m_vSurfaces.emplace_back(makeShared<CColorManagementSurface>(surface_));
if UNLIKELY (!RESOURCE) {
resource->noMemory();
@@ -205,12 +205,12 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
RESOURCE->self = RESOURCE;
- surface->colorManagement = RESOURCE;
+ surface->m_colorManagement = RESOURCE;
resource->setOnDestroy([this](CXxColorManagementSurfaceV4* r) {
LOGM(TRACE, "Destroy wp cm and xx cm for surface {}", (uintptr_t)surface);
if (surface.valid())
- PROTO::colorManagement->destroyResource(surface->colorManagement.get());
+ PROTO::colorManagement->destroyResource(surface->m_colorManagement.get());
PROTO::xxColorManagement->destroyResource(this);
});
} else
@@ -245,16 +245,16 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac
}
if (surface.valid()) {
- surface->colorManagement->m_imageDescription = imageDescription->get()->settings;
- surface->colorManagement->setHasImageDescription(true);
+ surface->m_colorManagement->m_imageDescription = imageDescription->get()->settings;
+ surface->m_colorManagement->setHasImageDescription(true);
} else
LOGM(ERR, "Set image description for invalid surface");
});
resource->setUnsetImageDescription([this](CXxColorManagementSurfaceV4* r) {
LOGM(TRACE, "Unset image description for surface={}", (uintptr_t)r);
if (surface.valid()) {
- surface->colorManagement->m_imageDescription = SImageDescription{};
- surface->colorManagement->setHasImageDescription(false);
+ surface->m_colorManagement->m_imageDescription = SImageDescription{};
+ surface->m_colorManagement->setHasImageDescription(false);
} else
LOGM(ERR, "Unset image description for invalid surface");
});
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index b58ece97..df1916ef 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -24,129 +24,129 @@ class CDefaultSurfaceRole : public ISurfaceRole {
}
};
-CWLCallbackResource::CWLCallbackResource(SP<CWlCallback> resource_) : resource(resource_) {
+CWLCallbackResource::CWLCallbackResource(SP<CWlCallback> resource_) : m_resource(resource_) {
;
}
bool CWLCallbackResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLCallbackResource::send(const Time::steady_tp& now) {
- resource->sendDone(Time::millis(now));
+ m_resource->sendDone(Time::millis(now));
}
-CWLRegionResource::CWLRegionResource(SP<CWlRegion> resource_) : resource(resource_) {
+CWLRegionResource::CWLRegionResource(SP<CWlRegion> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setData(this);
+ m_resource->setData(this);
- resource->setDestroy([this](CWlRegion* r) { PROTO::compositor->destroyResource(this); });
- resource->setOnDestroy([this](CWlRegion* r) { PROTO::compositor->destroyResource(this); });
+ m_resource->setDestroy([this](CWlRegion* r) { PROTO::compositor->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlRegion* r) { PROTO::compositor->destroyResource(this); });
- resource->setAdd([this](CWlRegion* r, int32_t x, int32_t y, int32_t w, int32_t h) { region.add(CBox{x, y, w, h}); });
- resource->setSubtract([this](CWlRegion* r, int32_t x, int32_t y, int32_t w, int32_t h) { region.subtract(CBox{x, y, w, h}); });
+ m_resource->setAdd([this](CWlRegion* r, int32_t x, int32_t y, int32_t w, int32_t h) { m_region.add(CBox{x, y, w, h}); });
+ m_resource->setSubtract([this](CWlRegion* r, int32_t x, int32_t y, int32_t w, int32_t h) { m_region.subtract(CBox{x, y, w, h}); });
}
bool CWLRegionResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
SP<CWLRegionResource> CWLRegionResource::fromResource(wl_resource* res) {
auto data = (CWLRegionResource*)(((CWlRegion*)wl_resource_get_user_data(res))->data());
- return data ? data->self.lock() : nullptr;
+ return data ? data->m_self.lock() : nullptr;
}
-CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(resource_) {
+CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- pClient = resource->client();
+ m_client = m_resource->client();
- resource->setData(this);
+ m_resource->setData(this);
- role = makeShared<CDefaultSurfaceRole>();
+ m_role = makeShared<CDefaultSurfaceRole>();
- resource->setDestroy([this](CWlSurface* r) { destroy(); });
- resource->setOnDestroy([this](CWlSurface* r) { destroy(); });
+ m_resource->setDestroy([this](CWlSurface* r) { destroy(); });
+ m_resource->setOnDestroy([this](CWlSurface* r) { destroy(); });
- resource->setAttach([this](CWlSurface* r, wl_resource* buffer, int32_t x, int32_t y) {
- pending.updated.buffer = true;
- pending.updated.offset = true;
+ m_resource->setAttach([this](CWlSurface* r, wl_resource* buffer, int32_t x, int32_t y) {
+ m_pending.updated.buffer = true;
+ m_pending.updated.offset = true;
- pending.offset = {x, y};
+ m_pending.offset = {x, y};
- if (pending.buffer)
- pending.buffer.drop();
+ if (m_pending.buffer)
+ m_pending.buffer.drop();
auto buf = buffer ? CWLBufferResource::fromResource(buffer) : nullptr;
if (buf && buf->buffer) {
- pending.buffer = CHLBufferReference(buf->buffer.lock());
- pending.texture = buf->buffer->texture;
- pending.size = buf->buffer->size;
- pending.bufferSize = buf->buffer->size;
+ m_pending.buffer = CHLBufferReference(buf->buffer.lock());
+ m_pending.texture = buf->buffer->texture;
+ m_pending.size = buf->buffer->size;
+ m_pending.bufferSize = buf->buffer->size;
} else {
- pending.buffer = {};
- pending.texture.reset();
- pending.size = Vector2D{};
- pending.bufferSize = Vector2D{};
+ m_pending.buffer = {};
+ m_pending.texture.reset();
+ m_pending.size = Vector2D{};
+ m_pending.bufferSize = Vector2D{};
}
- if (pending.bufferSize != current.bufferSize) {
- pending.updated.damage = true;
- pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
+ if (m_pending.bufferSize != m_current.bufferSize) {
+ m_pending.updated.damage = true;
+ m_pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
}
});
- resource->setCommit([this](CWlSurface* r) {
- if (pending.buffer)
- pending.bufferDamage.intersect(CBox{{}, pending.bufferSize});
+ m_resource->setCommit([this](CWlSurface* r) {
+ if (m_pending.buffer)
+ m_pending.bufferDamage.intersect(CBox{{}, m_pending.bufferSize});
- if (!pending.buffer)
- pending.size = {};
- else if (pending.viewport.hasDestination)
- pending.size = pending.viewport.destination;
- else if (pending.viewport.hasSource)
- pending.size = pending.viewport.source.size();
+ if (!m_pending.buffer)
+ m_pending.size = {};
+ else if (m_pending.viewport.hasDestination)
+ m_pending.size = m_pending.viewport.destination;
+ else if (m_pending.viewport.hasSource)
+ m_pending.size = m_pending.viewport.source.size();
else {
- Vector2D tfs = pending.transform % 2 == 1 ? Vector2D{pending.bufferSize.y, pending.bufferSize.x} : pending.bufferSize;
- pending.size = tfs / pending.scale;
+ Vector2D tfs = m_pending.transform % 2 == 1 ? Vector2D{m_pending.bufferSize.y, m_pending.bufferSize.x} : m_pending.bufferSize;
+ m_pending.size = tfs / m_pending.scale;
}
- pending.damage.intersect(CBox{{}, pending.size});
+ m_pending.damage.intersect(CBox{{}, m_pending.size});
- events.precommit.emit();
- if (pending.rejected) {
- pending.rejected = false;
+ m_events.precommit.emit();
+ if (m_pending.rejected) {
+ m_pending.rejected = false;
dropPendingBuffer();
return;
}
- if ((!pending.updated.buffer) || // no new buffer attached
- (!pending.buffer && !pending.texture) // null buffer attached
+ if ((!m_pending.updated.buffer) || // no new buffer attached
+ (!m_pending.buffer && !m_pending.texture) // null buffer attached
) {
- commitState(pending);
- pending.reset();
+ commitState(m_pending);
+ m_pending.reset();
return;
}
// save state while we wait for buffer to become ready to read
- const auto& state = pendingStates.emplace(makeUnique<SSurfaceState>(pending));
- pending.reset();
+ const auto& state = m_pendingStates.emplace(makeUnique<SSurfaceState>(m_pending));
+ m_pending.reset();
- auto whenReadable = [this, surf = self, state = WP<SSurfaceState>(pendingStates.back())] {
+ auto whenReadable = [this, surf = m_self, state = WP<SSurfaceState>(m_pendingStates.back())] {
if (!surf || state.expired())
return;
- while (!pendingStates.empty() && pendingStates.front() != state) {
- commitState(*pendingStates.front());
- pendingStates.pop();
+ while (!m_pendingStates.empty() && m_pendingStates.front() != state) {
+ commitState(*m_pendingStates.front());
+ m_pendingStates.pop();
}
- commitState(*pendingStates.front());
- pendingStates.pop();
+ commitState(*m_pendingStates.front());
+ m_pendingStates.pop();
};
if (state->updated.acquire) {
@@ -169,106 +169,106 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
}
});
- resource->setDamage([this](CWlSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) {
- pending.updated.damage = true;
- pending.damage.add(CBox{x, y, w, h});
+ m_resource->setDamage([this](CWlSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) {
+ m_pending.updated.damage = true;
+ m_pending.damage.add(CBox{x, y, w, h});
});
- resource->setDamageBuffer([this](CWlSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) {
- pending.updated.damage = true;
- pending.bufferDamage.add(CBox{x, y, w, h});
+ m_resource->setDamageBuffer([this](CWlSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) {
+ m_pending.updated.damage = true;
+ m_pending.bufferDamage.add(CBox{x, y, w, h});
});
- resource->setSetBufferScale([this](CWlSurface* r, int32_t scale) {
- if (scale == pending.scale)
+ m_resource->setSetBufferScale([this](CWlSurface* r, int32_t scale) {
+ if (scale == m_pending.scale)
return;
- pending.updated.scale = true;
- pending.updated.damage = true;
+ m_pending.updated.scale = true;
+ m_pending.updated.damage = true;
- pending.scale = scale;
- pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
+ m_pending.scale = scale;
+ m_pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
});
- resource->setSetBufferTransform([this](CWlSurface* r, uint32_t tr) {
- if (tr == pending.transform)
+ m_resource->setSetBufferTransform([this](CWlSurface* r, uint32_t tr) {
+ if (tr == m_pending.transform)
return;
- pending.updated.transform = true;
- pending.updated.damage = true;
+ m_pending.updated.transform = true;
+ m_pending.updated.damage = true;
- pending.transform = (wl_output_transform)tr;
- pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
+ m_pending.transform = (wl_output_transform)tr;
+ m_pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
});
- resource->setSetInputRegion([this](CWlSurface* r, wl_resource* region) {
- pending.updated.input = true;
+ m_resource->setSetInputRegion([this](CWlSurface* r, wl_resource* region) {
+ m_pending.updated.input = true;
if (!region) {
- pending.input = CBox{{}, {INT32_MAX, INT32_MAX}};
+ m_pending.input = CBox{{}, {INT32_MAX, INT32_MAX}};
return;
}
- auto RG = CWLRegionResource::fromResource(region);
- pending.input = RG->region;
+ auto RG = CWLRegionResource::fromResource(region);
+ m_pending.input = RG->m_region;
});
- resource->setSetOpaqueRegion([this](CWlSurface* r, wl_resource* region) {
- pending.updated.opaque = true;
+ m_resource->setSetOpaqueRegion([this](CWlSurface* r, wl_resource* region) {
+ m_pending.updated.opaque = true;
if (!region) {
- pending.opaque = CBox{{}, {}};
+ m_pending.opaque = CBox{{}, {}};
return;
}
- auto RG = CWLRegionResource::fromResource(region);
- pending.opaque = RG->region;
+ auto RG = CWLRegionResource::fromResource(region);
+ m_pending.opaque = RG->m_region;
});
- resource->setFrame([this](CWlSurface* r, uint32_t id) { callbacks.emplace_back(makeShared<CWLCallbackResource>(makeShared<CWlCallback>(pClient, 1, id))); });
+ m_resource->setFrame([this](CWlSurface* r, uint32_t id) { m_callbacks.emplace_back(makeShared<CWLCallbackResource>(makeShared<CWlCallback>(m_client, 1, id))); });
- resource->setOffset([this](CWlSurface* r, int32_t x, int32_t y) {
- pending.updated.offset = true;
- pending.offset = {x, y};
+ m_resource->setOffset([this](CWlSurface* r, int32_t x, int32_t y) {
+ m_pending.updated.offset = true;
+ m_pending.offset = {x, y};
});
}
CWLSurfaceResource::~CWLSurfaceResource() {
- events.destroy.emit();
+ m_events.destroy.emit();
}
void CWLSurfaceResource::destroy() {
- if (mapped) {
- events.unmap.emit();
+ if (m_mapped) {
+ m_events.unmap.emit();
unmap();
}
- events.destroy.emit();
+ m_events.destroy.emit();
releaseBuffers(false);
PROTO::compositor->destroyResource(this);
}
void CWLSurfaceResource::dropPendingBuffer() {
- pending.buffer = {};
+ m_pending.buffer = {};
}
void CWLSurfaceResource::dropCurrentBuffer() {
- current.buffer = {};
+ m_current.buffer = {};
}
SP<CWLSurfaceResource> CWLSurfaceResource::fromResource(wl_resource* res) {
auto data = (CWLSurfaceResource*)(((CWlSurface*)wl_resource_get_user_data(res))->data());
- return data ? data->self.lock() : nullptr;
+ return data ? data->m_self.lock() : nullptr;
}
bool CWLSurfaceResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
wl_client* CWLSurfaceResource::client() {
- return pClient;
+ return m_client;
}
void CWLSurfaceResource::enter(PHLMONITOR monitor) {
- if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) != enteredOutputs.end())
+ if (std::find(m_enteredOutputs.begin(), m_enteredOutputs.end(), monitor) != m_enteredOutputs.end())
return;
if UNLIKELY (!PROTO::outputs.contains(monitor->m_name)) {
@@ -282,59 +282,59 @@ void CWLSurfaceResource::enter(PHLMONITOR monitor) {
return;
}
- auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(pClient);
+ auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client);
if UNLIKELY (!output || !output->getResource() || !output->getResource()->resource()) {
LOGM(ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
return;
}
- enteredOutputs.emplace_back(monitor);
+ m_enteredOutputs.emplace_back(monitor);
- resource->sendEnter(output->getResource().get());
+ m_resource->sendEnter(output->getResource().get());
}
void CWLSurfaceResource::leave(PHLMONITOR monitor) {
- if UNLIKELY (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) == enteredOutputs.end())
+ if UNLIKELY (std::find(m_enteredOutputs.begin(), m_enteredOutputs.end(), monitor) == m_enteredOutputs.end())
return;
- auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(pClient);
+ auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client);
if UNLIKELY (!output) {
LOGM(ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
return;
}
- std::erase(enteredOutputs, monitor);
+ std::erase(m_enteredOutputs, monitor);
- resource->sendLeave(output->getResource().get());
+ m_resource->sendLeave(output->getResource().get());
}
void CWLSurfaceResource::sendPreferredTransform(wl_output_transform t) {
- if (resource->version() < 6)
+ if (m_resource->version() < 6)
return;
- resource->sendPreferredBufferTransform(t);
+ m_resource->sendPreferredBufferTransform(t);
}
void CWLSurfaceResource::sendPreferredScale(int32_t scale) {
- if (resource->version() < 6)
+ if (m_resource->version() < 6)
return;
- resource->sendPreferredBufferScale(scale);
+ m_resource->sendPreferredBufferScale(scale);
}
void CWLSurfaceResource::frame(const Time::steady_tp& now) {
- if (callbacks.empty())
+ if (m_callbacks.empty())
return;
- for (auto const& c : callbacks) {
+ for (auto const& c : m_callbacks) {
c->send(now);
}
- callbacks.clear();
+ m_callbacks.clear();
}
void CWLSurfaceResource::resetRole() {
- role = makeShared<CDefaultSurfaceRole>();
+ m_role = makeShared<CDefaultSurfaceRole>();
}
void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
@@ -343,14 +343,14 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
// first, gather all nodes below
for (auto const& n : nodes) {
- std::erase_if(n->subsurfaces, [](const auto& e) { return e.expired(); });
+ std::erase_if(n->m_subsurfaces, [](const auto& e) { return e.expired(); });
// subsurfaces is sorted lowest -> highest
- for (auto const& c : n->subsurfaces) {
- if (c->zIndex >= 0)
+ for (auto const& c : n->m_subsurfaces) {
+ if (c->m_zIndex >= 0)
break;
- if (c->surface.expired())
+ if (c->m_surface.expired())
continue;
- nodes2.push_back(c->surface.lock());
+ nodes2.push_back(c->m_surface.lock());
}
}
@@ -361,8 +361,8 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
for (auto const& n : nodes) {
Vector2D offset = {};
- if (n->role->role() == SURFACE_ROLE_SUBSURFACE) {
- auto subsurface = ((CSubsurfaceRole*)n->role.get())->subsurface.lock();
+ if (n->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
+ auto subsurface = ((CSubsurfaceRole*)n->m_role.get())->m_subsurface.lock();
offset = subsurface->posRelativeToParent();
}
@@ -370,12 +370,12 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
}
for (auto const& n : nodes) {
- for (auto const& c : n->subsurfaces) {
- if (c->zIndex < 0)
+ for (auto const& c : n->m_subsurfaces) {
+ if (c->m_zIndex < 0)
continue;
- if (c->surface.expired())
+ if (c->m_surface.expired())
continue;
- nodes2.push_back(c->surface.lock());
+ nodes2.push_back(c->m_surface.lock());
}
}
@@ -385,17 +385,17 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> const& nod
void CWLSurfaceResource::breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data) {
std::vector<SP<CWLSurfaceResource>> surfs;
- surfs.push_back(self.lock());
+ surfs.push_back(m_self.lock());
bfHelper(surfs, fn, data);
}
SP<CWLSurfaceResource> CWLSurfaceResource::findFirstPreorderHelper(SP<CWLSurfaceResource> root, std::function<bool(SP<CWLSurfaceResource>)> fn) {
if (fn(root))
return root;
- for (auto const& sub : root->subsurfaces) {
- if (sub.expired() || sub->surface.expired())
+ for (auto const& sub : root->m_subsurfaces) {
+ if (sub.expired() || sub->m_surface.expired())
continue;
- const auto found = findFirstPreorderHelper(sub->surface.lock(), fn);
+ const auto found = findFirstPreorderHelper(sub->m_surface.lock(), fn);
if (found)
return found;
}
@@ -403,7 +403,7 @@ SP<CWLSurfaceResource> CWLSurfaceResource::findFirstPreorderHelper(SP<CWLSurface
}
SP<CWLSurfaceResource> CWLSurfaceResource::findFirstPreorder(std::function<bool(SP<CWLSurfaceResource>)> fn) {
- return findFirstPreorderHelper(self.lock(), fn);
+ return findFirstPreorderHelper(m_self.lock(), fn);
}
std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2D& localCoords, bool allowsInput) {
@@ -412,11 +412,11 @@ std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2
for (auto const& [surf, pos] : surfs | std::views::reverse) {
if (!allowsInput) {
- const auto BOX = CBox{pos, surf->current.size};
+ const auto BOX = CBox{pos, surf->m_current.size};
if (BOX.containsPoint(localCoords))
return {surf, localCoords - pos};
} else {
- const auto REGION = surf->current.input.copy().intersect(CBox{{}, surf->current.size}).translate(pos);
+ const auto REGION = surf->m_current.input.copy().intersect(CBox{{}, surf->m_current.size}).translate(pos);
if (REGION.containsPoint(localCoords))
return {surf, localCoords - pos};
}
@@ -426,26 +426,26 @@ std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2
}
uint32_t CWLSurfaceResource::id() {
- return wl_resource_get_id(resource->resource());
+ return wl_resource_get_id(m_resource->resource());
}
void CWLSurfaceResource::map() {
- if UNLIKELY (mapped)
+ if UNLIKELY (m_mapped)
return;
- mapped = true;
+ m_mapped = true;
frame(Time::steadyNow());
- current.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
- pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
+ m_current.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
+ m_pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
}
void CWLSurfaceResource::unmap() {
- if UNLIKELY (!mapped)
+ if UNLIKELY (!m_mapped)
return;
- mapped = false;
+ m_mapped = false;
// release the buffers.
// this is necessary for XWayland to function correctly,
@@ -460,66 +460,66 @@ void CWLSurfaceResource::releaseBuffers(bool onlyCurrent) {
}
void CWLSurfaceResource::error(int code, const std::string& str) {
- resource->error(code, str);
+ m_resource->error(code, str);
}
SP<CWlSurface> CWLSurfaceResource::getResource() {
- return resource;
+ return m_resource;
}
CBox CWLSurfaceResource::extends() {
- CRegion full = CBox{{}, current.size};
+ CRegion full = CBox{{}, m_current.size};
breadthfirst(
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* d) {
- if (surf->role->role() != SURFACE_ROLE_SUBSURFACE)
+ if (surf->m_role->role() != SURFACE_ROLE_SUBSURFACE)
return;
- ((CRegion*)d)->add(CBox{offset, surf->current.size});
+ ((CRegion*)d)->add(CBox{offset, surf->m_current.size});
},
&full);
return full.getExtents();
}
void CWLSurfaceResource::commitState(SSurfaceState& state) {
- auto lastTexture = current.texture;
- current.updateFrom(state);
+ auto lastTexture = m_current.texture;
+ m_current.updateFrom(state);
- if (current.buffer) {
- if (current.buffer->isSynchronous())
- current.updateSynchronousTexture(lastTexture);
+ if (m_current.buffer) {
+ if (m_current.buffer->isSynchronous())
+ m_current.updateSynchronousTexture(lastTexture);
// if the surface is a cursor, update the shm buffer
// TODO: don't update the entire texture
- if (role->role() == SURFACE_ROLE_CURSOR)
- updateCursorShm(current.accumulateBufferDamage());
+ if (m_role->role() == SURFACE_ROLE_CURSOR)
+ updateCursorShm(m_current.accumulateBufferDamage());
}
- if (current.texture)
- current.texture->m_eTransform = wlTransformToHyprutils(current.transform);
+ if (m_current.texture)
+ m_current.texture->m_eTransform = wlTransformToHyprutils(m_current.transform);
- if (role->role() == SURFACE_ROLE_SUBSURFACE) {
- auto subsurface = ((CSubsurfaceRole*)role.get())->subsurface.lock();
- if (subsurface->sync)
+ if (m_role->role() == SURFACE_ROLE_SUBSURFACE) {
+ auto subsurface = ((CSubsurfaceRole*)m_role.get())->m_subsurface.lock();
+ if (subsurface->m_sync)
return;
- events.commit.emit();
+ m_events.commit.emit();
} else {
// send commit to all synced surfaces in this tree.
breadthfirst(
[](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) {
- if (surf->role->role() == SURFACE_ROLE_SUBSURFACE) {
- auto subsurface = ((CSubsurfaceRole*)surf->role.get())->subsurface.lock();
- if (!subsurface->sync)
+ if (surf->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
+ auto subsurface = ((CSubsurfaceRole*)surf->m_role.get())->m_subsurface.lock();
+ if (!subsurface->m_sync)
return;
}
- surf->events.commit.emit();
+ surf->m_events.commit.emit();
},
nullptr);
}
// release the buffer if it's synchronous (SHM) as updateSynchronousTexture() has copied the buffer data to a GPU tex
// if it doesn't have a role, we can't release it yet, in case it gets turned into a cursor.
- if (current.buffer && current.buffer->isSynchronous() && role->role() != SURFACE_ROLE_UNASSIGNED)
+ if (m_current.buffer && m_current.buffer->isSynchronous() && m_role->role() != SURFACE_ROLE_UNASSIGNED)
dropCurrentBuffer();
}
@@ -527,12 +527,12 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) {
if (damage.empty())
return;
- auto buf = current.buffer ? current.buffer : SP<IHLBuffer>{};
+ auto buf = m_current.buffer ? m_current.buffer : SP<IHLBuffer>{};
if UNLIKELY (!buf)
return;
- auto& shmData = CCursorSurfaceRole::cursorPixelData(self.lock());
+ auto& shmData = CCursorSurfaceRole::cursorPixelData(m_self.lock());
auto shmAttrs = buf->shm();
if (!shmAttrs.success) {
@@ -563,7 +563,7 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) {
void CWLSurfaceResource::presentFeedback(const Time::steady_tp& when, PHLMONITOR pMonitor, bool discarded) {
frame(when);
- auto FEEDBACK = makeShared<CQueuedPresentationData>(self.lock());
+ auto FEEDBACK = makeShared<CQueuedPresentationData>(m_self.lock());
FEEDBACK->attachMonitor(pMonitor);
if (discarded)
FEEDBACK->discarded();
@@ -572,45 +572,45 @@ void CWLSurfaceResource::presentFeedback(const Time::steady_tp& when, PHLMONITOR
PROTO::presentation->queueData(FEEDBACK);
}
-CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : resource(resource_) {
+CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlCompositor* r) { PROTO::compositor->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlCompositor* r) { PROTO::compositor->destroyResource(this); });
- resource->setCreateSurface([](CWlCompositor* r, uint32_t id) {
- const auto RESOURCE = PROTO::compositor->m_vSurfaces.emplace_back(makeShared<CWLSurfaceResource>(makeShared<CWlSurface>(r->client(), r->version(), id)));
+ m_resource->setCreateSurface([](CWlCompositor* r, uint32_t id) {
+ const auto RESOURCE = PROTO::compositor->m_surfaces.emplace_back(makeShared<CWLSurfaceResource>(makeShared<CWlSurface>(r->client(), r->version(), id)));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::compositor->m_vSurfaces.pop_back();
+ PROTO::compositor->m_surfaces.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
LOGM(LOG, "New wl_surface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
- PROTO::compositor->events.newSurface.emit(RESOURCE);
+ PROTO::compositor->m_events.newSurface.emit(RESOURCE);
});
- resource->setCreateRegion([](CWlCompositor* r, uint32_t id) {
- const auto RESOURCE = PROTO::compositor->m_vRegions.emplace_back(makeShared<CWLRegionResource>(makeShared<CWlRegion>(r->client(), r->version(), id)));
+ m_resource->setCreateRegion([](CWlCompositor* r, uint32_t id) {
+ const auto RESOURCE = PROTO::compositor->m_regions.emplace_back(makeShared<CWLRegionResource>(makeShared<CWlRegion>(r->client(), r->version(), id)));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::compositor->m_vRegions.pop_back();
+ PROTO::compositor->m_regions.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
LOGM(LOG, "New wl_region with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
});
}
bool CWLCompositorResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
CWLCompositorProtocol::CWLCompositorProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
@@ -618,29 +618,29 @@ CWLCompositorProtocol::CWLCompositorProtocol(const wl_interface* iface, const in
}
void CWLCompositorProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto RESOURCE = m_vManagers.emplace_back(makeShared<CWLCompositorResource>(makeShared<CWlCompositor>(client, ver, id)));
+ const auto RESOURCE = m_managers.emplace_back(makeShared<CWLCompositorResource>(makeShared<CWlCompositor>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vManagers.pop_back();
+ m_managers.pop_back();
return;
}
}
void CWLCompositorProtocol::destroyResource(CWLCompositorResource* resource) {
- std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_managers, [&](const auto& other) { return other.get() == resource; });
}
void CWLCompositorProtocol::destroyResource(CWLSurfaceResource* resource) {
- std::erase_if(m_vSurfaces, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_surfaces, [&](const auto& other) { return other.get() == resource; });
}
void CWLCompositorProtocol::destroyResource(CWLRegionResource* resource) {
- std::erase_if(m_vRegions, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_regions, [&](const auto& other) { return other.get() == resource; });
}
void CWLCompositorProtocol::forEachSurface(std::function<void(SP<CWLSurfaceResource>)> fn) {
- for (auto& surf : m_vSurfaces) {
+ for (auto& surf : m_surfaces) {
fn(surf);
}
}
diff --git a/src/protocols/core/Compositor.hpp b/src/protocols/core/Compositor.hpp
index 7415b4f5..90fac35d 100644
--- a/src/protocols/core/Compositor.hpp
+++ b/src/protocols/core/Compositor.hpp
@@ -40,7 +40,7 @@ class CWLCallbackResource {
void send(const Time::steady_tp& now);
private:
- SP<CWlCallback> resource;
+ SP<CWlCallback> m_resource;
};
class CWLRegionResource {
@@ -50,11 +50,11 @@ class CWLRegionResource {
bool good();
- CRegion region;
- WP<CWLRegionResource> self;
+ CRegion m_region;
+ WP<CWLRegionResource> m_self;
private:
- SP<CWlRegion> resource;
+ SP<CWlRegion> m_resource;
};
class CWLSurfaceResource {
@@ -86,22 +86,22 @@ class CWLSurfaceResource {
CSignal unmap;
CSignal newSubsurface;
CSignal destroy;
- } events;
-
- SSurfaceState current, pending;
- std::queue<UP<SSurfaceState>> pendingStates;
-
- std::vector<SP<CWLCallbackResource>> callbacks;
- WP<CWLSurfaceResource> self;
- WP<CWLSurface> hlSurface;
- std::vector<PHLMONITORREF> enteredOutputs;
- bool mapped = false;
- std::vector<WP<CWLSubsurfaceResource>> subsurfaces;
- SP<ISurfaceRole> role;
- WP<CViewportResource> viewportResource;
- WP<CDRMSyncobjSurfaceResource> syncobj; // may not be present
- WP<CColorManagementSurface> colorManagement;
- WP<CContentType> contentType;
+ } m_events;
+
+ SSurfaceState m_current;
+ SSurfaceState m_pending;
+ std::queue<UP<SSurfaceState>> m_pendingStates;
+
+ std::vector<SP<CWLCallbackResource>> m_callbacks;
+ WP<CWLSurfaceResource> m_self;
+ WP<CWLSurface> m_hlSurface;
+ std::vector<PHLMONITORREF> m_enteredOutputs;
+ bool m_mapped = false;
+ std::vector<WP<CWLSubsurfaceResource>> m_subsurfaces;
+ SP<ISurfaceRole> m_role;
+ WP<CDRMSyncobjSurfaceResource> m_syncobj; // may not be present
+ WP<CColorManagementSurface> m_colorManagement;
+ WP<CContentType> m_contentType;
void breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
SP<CWLSurfaceResource> findFirstPreorder(std::function<bool(SP<CWLSurfaceResource>)> fn);
@@ -113,8 +113,8 @@ class CWLSurfaceResource {
std::pair<SP<CWLSurfaceResource>, Vector2D> at(const Vector2D& localCoords, bool allowsInput = false);
private:
- SP<CWlSurface> resource;
- wl_client* pClient = nullptr;
+ SP<CWlSurface> m_resource;
+ wl_client* m_client = nullptr;
void destroy();
void releaseBuffers(bool onlyCurrent = true);
@@ -134,7 +134,7 @@ class CWLCompositorResource {
bool good();
private:
- SP<CWlCompositor> resource;
+ SP<CWlCompositor> m_resource;
};
class CWLCompositorProtocol : public IWaylandProtocol {
@@ -147,7 +147,7 @@ class CWLCompositorProtocol : public IWaylandProtocol {
struct {
CSignal newSurface; // SP<CWLSurfaceResource>
- } events;
+ } m_events;
private:
void destroyResource(CWLCompositorResource* resource);
@@ -155,9 +155,9 @@ class CWLCompositorProtocol : public IWaylandProtocol {
void destroyResource(CWLRegionResource* resource);
//
- std::vector<SP<CWLCompositorResource>> m_vManagers;
- std::vector<SP<CWLSurfaceResource>> m_vSurfaces;
- std::vector<SP<CWLRegionResource>> m_vRegions;
+ std::vector<SP<CWLCompositorResource>> m_managers;
+ std::vector<SP<CWLSurfaceResource>> m_surfaces;
+ std::vector<SP<CWLRegionResource>> m_regions;
friend class CWLSurfaceResource;
friend class CWLCompositorResource;
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index fda46980..a54ae7e1 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -16,60 +16,60 @@
#include "../../xwayland/Dnd.hpp"
using namespace Hyprutils::OS;
-CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
+CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_) : m_source(source_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); });
- resource->setOnDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); });
+ m_resource->setDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); });
- resource->setAccept([this](CWlDataOffer* r, uint32_t serial, const char* mime) {
- if (!source) {
+ m_resource->setAccept([this](CWlDataOffer* r, uint32_t serial, const char* mime) {
+ if (!m_source) {
LOGM(WARN, "Possible bug: Accept on an offer w/o a source");
return;
}
- if (dead) {
+ if (m_dead) {
LOGM(WARN, "Possible bug: Accept on an offer that's dead");
return;
}
- LOGM(LOG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)source.get(), mime ? mime : "null");
+ LOGM(LOG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)m_source.get(), mime ? mime : "null");
- source->accepted(mime ? mime : "");
- accepted = mime;
+ m_source->accepted(mime ? mime : "");
+ m_accepted = mime;
});
- resource->setReceive([this](CWlDataOffer* r, const char* mime, int fd) {
+ m_resource->setReceive([this](CWlDataOffer* r, const char* mime, int fd) {
CFileDescriptor sendFd{fd};
- if (!source) {
+ if (!m_source) {
LOGM(WARN, "Possible bug: Receive on an offer w/o a source");
return;
}
- if (dead) {
+ if (m_dead) {
LOGM(WARN, "Possible bug: Receive on an offer that's dead");
return;
}
- LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)source.get());
+ LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get());
- if (!accepted) {
+ if (!m_accepted) {
LOGM(WARN, "Offer was never accepted, sending accept first");
- source->accepted(mime ? mime : "");
+ m_source->accepted(mime ? mime : "");
}
- source->send(mime ? mime : "", std::move(sendFd));
+ m_source->send(mime ? mime : "", std::move(sendFd));
- recvd = true;
+ m_recvd = true;
// if (source->hasDnd())
// PROTO::data->completeDrag();
});
- resource->setFinish([this](CWlDataOffer* r) {
- dead = true;
- if (!source || !recvd || !accepted)
+ m_resource->setFinish([this](CWlDataOffer* r) {
+ m_dead = true;
+ if (!m_source || !m_recvd || !m_accepted)
PROTO::data->abortDrag();
else
PROTO::data->completeDrag();
@@ -77,37 +77,37 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS
}
CWLDataOfferResource::~CWLDataOfferResource() {
- if (!source || !source->hasDnd() || dead)
+ if (!m_source || !m_source->hasDnd() || m_dead)
return;
- source->sendDndFinished();
+ m_source->sendDndFinished();
}
bool CWLDataOfferResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLDataOfferResource::sendData() {
- if (!source)
+ if (!m_source)
return;
- const auto SOURCEACTIONS = source->actions();
+ const auto SOURCEACTIONS = m_source->actions();
- if (resource->version() >= 3 && SOURCEACTIONS > 0) {
- resource->sendSourceActions(SOURCEACTIONS);
+ if (m_resource->version() >= 3 && SOURCEACTIONS > 0) {
+ m_resource->sendSourceActions(SOURCEACTIONS);
if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
- resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
+ m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
else if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
- resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
+ m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
else {
LOGM(ERR, "Client bug? dnd source has no action move or copy. Sending move, f this.");
- resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
+ m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
}
}
- for (auto const& m : source->mimes()) {
+ for (auto const& m : m_source->mimes()) {
LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
- resource->sendOffer(m.c_str());
+ m_resource->sendOffer(m.c_str());
}
}
@@ -116,7 +116,7 @@ eDataSourceType CWLDataOfferResource::type() {
}
SP<CWLDataOfferResource> CWLDataOfferResource::getWayland() {
- return self.lock();
+ return m_self.lock();
}
SP<CX11DataOffer> CWLDataOfferResource::getX11() {
@@ -124,127 +124,127 @@ SP<CX11DataOffer> CWLDataOfferResource::getX11() {
}
SP<IDataSource> CWLDataOfferResource::getSource() {
- return source.lock();
+ return m_source.lock();
}
-CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWLDataDeviceResource> device_) : device(device_), resource(resource_) {
+CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWLDataDeviceResource> device_) : m_device(device_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setData(this);
+ m_resource->setData(this);
- resource->setDestroy([this](CWlDataSource* r) {
+ m_resource->setDestroy([this](CWlDataSource* r) {
events.destroy.emit();
- PROTO::data->onDestroyDataSource(self);
+ PROTO::data->onDestroyDataSource(m_self);
PROTO::data->destroyResource(this);
});
- resource->setOnDestroy([this](CWlDataSource* r) {
+ m_resource->setOnDestroy([this](CWlDataSource* r) {
events.destroy.emit();
- PROTO::data->onDestroyDataSource(self);
+ PROTO::data->onDestroyDataSource(m_self);
PROTO::data->destroyResource(this);
});
- resource->setOffer([this](CWlDataSource* r, const char* mime) { mimeTypes.emplace_back(mime); });
- resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
+ m_resource->setOffer([this](CWlDataSource* r, const char* mime) { m_mimeTypes.emplace_back(mime); });
+ m_resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a);
- supportedActions = a;
+ m_supportedActions = a;
});
}
CWLDataSourceResource::~CWLDataSourceResource() {
events.destroy.emit();
- PROTO::data->onDestroyDataSource(self);
+ PROTO::data->onDestroyDataSource(m_self);
}
SP<CWLDataSourceResource> CWLDataSourceResource::fromResource(wl_resource* res) {
auto data = (CWLDataSourceResource*)(((CWlDataSource*)wl_resource_get_user_data(res))->data());
- return data ? data->self.lock() : nullptr;
+ return data ? data->m_self.lock() : nullptr;
}
bool CWLDataSourceResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLDataSourceResource::accepted(const std::string& mime) {
if (mime.empty()) {
- resource->sendTarget(nullptr);
+ m_resource->sendTarget(nullptr);
return;
}
- if (std::find(mimeTypes.begin(), mimeTypes.end(), mime) == mimeTypes.end()) {
+ if (std::find(m_mimeTypes.begin(), m_mimeTypes.end(), mime) == m_mimeTypes.end()) {
LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAccepted with non-existent mime");
return;
}
- resource->sendTarget(mime.c_str());
+ m_resource->sendTarget(mime.c_str());
}
std::vector<std::string> CWLDataSourceResource::mimes() {
- return mimeTypes;
+ return m_mimeTypes;
}
void CWLDataSourceResource::send(const std::string& mime, CFileDescriptor fd) {
- if (std::find(mimeTypes.begin(), mimeTypes.end(), mime) == mimeTypes.end()) {
+ if (std::find(m_mimeTypes.begin(), m_mimeTypes.end(), mime) == m_mimeTypes.end()) {
LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAskSend with non-existent mime");
return;
}
- resource->sendSend(mime.c_str(), fd.get());
+ m_resource->sendSend(mime.c_str(), fd.get());
}
void CWLDataSourceResource::cancelled() {
- resource->sendCancelled();
+ m_resource->sendCancelled();
}
bool CWLDataSourceResource::hasDnd() {
- return dnd;
+ return m_dnd;
}
bool CWLDataSourceResource::dndDone() {
- return dndSuccess;
+ return m_dndSuccess;
}
void CWLDataSourceResource::error(uint32_t code, const std::string& msg) {
- resource->error(code, msg);
+ m_resource->error(code, msg);
}
void CWLDataSourceResource::sendDndDropPerformed() {
- if (resource->version() < 3)
+ if (m_resource->version() < 3)
return;
- resource->sendDndDropPerformed();
- dropped = true;
+ m_resource->sendDndDropPerformed();
+ m_dropped = true;
}
void CWLDataSourceResource::sendDndFinished() {
- if (resource->version() < 3)
+ if (m_resource->version() < 3)
return;
- resource->sendDndFinished();
+ m_resource->sendDndFinished();
}
void CWLDataSourceResource::sendDndAction(wl_data_device_manager_dnd_action a) {
- if (resource->version() < 3)
+ if (m_resource->version() < 3)
return;
- resource->sendAction(a);
+ m_resource->sendAction(a);
}
uint32_t CWLDataSourceResource::actions() {
- return supportedActions;
+ return m_supportedActions;
}
eDataSourceType CWLDataSourceResource::type() {
return DATA_SOURCE_TYPE_WAYLAND;
}
-CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : resource(resource_) {
+CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setRelease([this](CWlDataDevice* r) { PROTO::data->destroyResource(this); });
- resource->setOnDestroy([this](CWlDataDevice* r) { PROTO::data->destroyResource(this); });
+ m_resource->setRelease([this](CWlDataDevice* r) { PROTO::data->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlDataDevice* r) { PROTO::data->destroyResource(this); });
- pClient = resource->client();
+ m_client = m_resource->client();
- resource->setSetSelection([](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) {
+ m_resource->setSetSelection([](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) {
auto source = sourceR ? CWLDataSourceResource::fromResource(sourceR) : CSharedPointer<CWLDataSourceResource>{};
if (!source) {
LOGM(LOG, "Reset selection received");
@@ -252,7 +252,7 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : reso
return;
}
- if (source && source->used)
+ if (source && source->m_used)
LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
source->markUsed();
@@ -260,63 +260,63 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : reso
g_pSeatManager->setCurrentSelection(source);
});
- resource->setStartDrag([](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) {
+ m_resource->setStartDrag([](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) {
auto source = CWLDataSourceResource::fromResource(sourceR);
if (!source) {
LOGM(ERR, "No source in drag");
return;
}
- if (source && source->used)
+ if (source && source->m_used)
LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this.");
source->markUsed();
- source->dnd = true;
+ source->m_dnd = true;
PROTO::data->initiateDrag(source, icon ? CWLSurfaceResource::fromResource(icon) : nullptr, CWLSurfaceResource::fromResource(origin));
});
}
bool CWLDataDeviceResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
wl_client* CWLDataDeviceResource::client() {
- return pClient;
+ return m_client;
}
void CWLDataDeviceResource::sendDataOffer(SP<IDataOffer> offer) {
if (!offer)
- resource->sendDataOfferRaw(nullptr);
+ m_resource->sendDataOfferRaw(nullptr);
else if (const auto WL = offer->getWayland(); WL)
- resource->sendDataOffer(WL->resource.get());
+ m_resource->sendDataOffer(WL->m_resource.get());
//FIXME: X11
}
void CWLDataDeviceResource::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& local, SP<IDataOffer> offer) {
if (const auto WL = offer->getWayland(); WL)
- resource->sendEnterRaw(serial, surf->getResource()->resource(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y), WL->resource->resource());
+ m_resource->sendEnterRaw(serial, surf->getResource()->resource(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y), WL->m_resource->resource());
// FIXME: X11
}
void CWLDataDeviceResource::sendLeave() {
- resource->sendLeave();
+ m_resource->sendLeave();
}
void CWLDataDeviceResource::sendMotion(uint32_t timeMs, const Vector2D& local) {
- resource->sendMotion(timeMs, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
+ m_resource->sendMotion(timeMs, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
}
void CWLDataDeviceResource::sendDrop() {
- resource->sendDrop();
+ m_resource->sendDrop();
}
void CWLDataDeviceResource::sendSelection(SP<IDataOffer> offer) {
if (!offer)
- resource->sendSelectionRaw(nullptr);
+ m_resource->sendSelectionRaw(nullptr);
else if (const auto WL = offer->getWayland(); WL)
- resource->sendSelection(WL->resource.get());
+ m_resource->sendSelection(WL->m_resource.get());
}
eDataSourceType CWLDataDeviceResource::type() {
@@ -324,55 +324,55 @@ eDataSourceType CWLDataDeviceResource::type() {
}
SP<CWLDataDeviceResource> CWLDataDeviceResource::getWayland() {
- return self.lock();
+ return m_self.lock();
}
SP<CX11DataDevice> CWLDataDeviceResource::getX11() {
return nullptr;
}
-CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManager> resource_) : resource(resource_) {
+CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManager> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlDataDeviceManager* r) { PROTO::data->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlDataDeviceManager* r) { PROTO::data->destroyResource(this); });
- resource->setCreateDataSource([this](CWlDataDeviceManager* r, uint32_t id) {
- std::erase_if(sources, [](const auto& e) { return e.expired(); });
+ m_resource->setCreateDataSource([this](CWlDataDeviceManager* r, uint32_t id) {
+ std::erase_if(m_sources, [](const auto& e) { return e.expired(); });
- const auto RESOURCE = PROTO::data->m_vSources.emplace_back(makeShared<CWLDataSourceResource>(makeShared<CWlDataSource>(r->client(), r->version(), id), device.lock()));
+ const auto RESOURCE = PROTO::data->m_sources.emplace_back(makeShared<CWLDataSourceResource>(makeShared<CWlDataSource>(r->client(), r->version(), id), m_device.lock()));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::data->m_vSources.pop_back();
+ PROTO::data->m_sources.pop_back();
return;
}
- if (!device)
+ if (!m_device)
LOGM(WARN, "New data source before a device was created");
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
- sources.emplace_back(RESOURCE);
+ m_sources.emplace_back(RESOURCE);
LOGM(LOG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
- resource->setGetDataDevice([this](CWlDataDeviceManager* r, uint32_t id, wl_resource* seat) {
- const auto RESOURCE = PROTO::data->m_vDevices.emplace_back(makeShared<CWLDataDeviceResource>(makeShared<CWlDataDevice>(r->client(), r->version(), id)));
+ m_resource->setGetDataDevice([this](CWlDataDeviceManager* r, uint32_t id, wl_resource* seat) {
+ const auto RESOURCE = PROTO::data->m_devices.emplace_back(makeShared<CWLDataDeviceResource>(makeShared<CWlDataDevice>(r->client(), r->version(), id)));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::data->m_vDevices.pop_back();
+ PROTO::data->m_devices.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
- for (auto const& s : sources) {
+ for (auto const& s : m_sources) {
if (!s)
continue;
- s->device = RESOURCE;
+ s->m_device = RESOURCE;
}
LOGM(LOG, "New data device bound at {:x}", (uintptr_t)RESOURCE.get());
@@ -380,22 +380,22 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag
}
bool CWLDataDeviceManagerResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
CWLDataDeviceProtocol::CWLDataDeviceProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
g_pEventLoopManager->doLater([this]() {
- listeners.onKeyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.registerListener([this](std::any d) { onKeyboardFocus(); });
- listeners.onDndPointerFocusChange = g_pSeatManager->m_events.dndPointerFocusChange.registerListener([this](std::any d) { onDndPointerFocus(); });
+ m_listeners.onKeyboardFocusChange = g_pSeatManager->m_events.keyboardFocusChange.registerListener([this](std::any d) { onKeyboardFocus(); });
+ m_listeners.onDndPointerFocusChange = g_pSeatManager->m_events.dndPointerFocusChange.registerListener([this](std::any d) { onDndPointerFocus(); });
});
}
void CWLDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto RESOURCE = m_vManagers.emplace_back(makeShared<CWLDataDeviceManagerResource>(makeShared<CWlDataDeviceManager>(client, ver, id)));
+ const auto RESOURCE = m_managers.emplace_back(makeShared<CWLDataDeviceManagerResource>(makeShared<CWlDataDeviceManager>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vManagers.pop_back();
+ m_managers.pop_back();
return;
}
@@ -403,19 +403,19 @@ void CWLDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t
}
void CWLDataDeviceProtocol::destroyResource(CWLDataDeviceManagerResource* seat) {
- std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == seat; });
+ std::erase_if(m_managers, [&](const auto& other) { return other.get() == seat; });
}
void CWLDataDeviceProtocol::destroyResource(CWLDataDeviceResource* resource) {
- std::erase_if(m_vDevices, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_devices, [&](const auto& other) { return other.get() == resource; });
}
void CWLDataDeviceProtocol::destroyResource(CWLDataSourceResource* resource) {
- std::erase_if(m_vSources, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_sources, [&](const auto& other) { return other.get() == resource; });
}
void CWLDataDeviceProtocol::destroyResource(CWLDataOfferResource* resource) {
- std::erase_if(m_vOffers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_offers, [&](const auto& other) { return other.get() == resource; });
}
SP<IDataDevice> CWLDataDeviceProtocol::dataDeviceForClient(wl_client* c) {
@@ -424,8 +424,8 @@ SP<IDataDevice> CWLDataDeviceProtocol::dataDeviceForClient(wl_client* c) {
return g_pXWayland->pWM->getDataDevice();
#endif
- auto it = std::find_if(m_vDevices.begin(), m_vDevices.end(), [c](const auto& e) { return e->client() == c; });
- if (it == m_vDevices.end())
+ auto it = std::find_if(m_devices.begin(), m_devices.end(), [c](const auto& e) { return e->client() == c; });
+ if (it == m_devices.end())
return nullptr;
return *it;
}
@@ -439,15 +439,15 @@ void CWLDataDeviceProtocol::sendSelectionToDevice(SP<IDataDevice> dev, SP<IDataS
SP<IDataOffer> offer;
if (const auto WL = dev->getWayland(); WL) {
- const auto OFFER = m_vOffers.emplace_back(makeShared<CWLDataOfferResource>(makeShared<CWlDataOffer>(WL->resource->client(), WL->resource->version(), 0), sel));
+ const auto OFFER = m_offers.emplace_back(makeShared<CWLDataOfferResource>(makeShared<CWlDataOffer>(WL->m_resource->client(), WL->m_resource->version(), 0), sel));
if UNLIKELY (!OFFER->good()) {
- WL->resource->noMemory();
- m_vOffers.pop_back();
+ WL->m_resource->noMemory();
+ m_offers.pop_back();
return;
}
- OFFER->source = sel;
- OFFER->self = OFFER;
- offer = OFFER;
+ OFFER->m_source = sel;
+ OFFER->m_self = OFFER;
+ offer = OFFER;
}
#ifndef NO_XWAYLAND
else if (const auto X11 = dev->getX11(); X11)
@@ -468,15 +468,15 @@ void CWLDataDeviceProtocol::sendSelectionToDevice(SP<IDataDevice> dev, SP<IDataS
}
void CWLDataDeviceProtocol::onDestroyDataSource(WP<CWLDataSourceResource> source) {
- if (dnd.currentSource == source)
+ if (m_dnd.currentSource == source)
abortDrag();
}
void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) {
- for (auto const& o : m_vOffers) {
- if (o->source && o->source->hasDnd())
+ for (auto const& o : m_offers) {
+ if (o->m_source && o->m_source->hasDnd())
continue;
- o->dead = true;
+ o->m_dead = true;
}
if (!source) {
@@ -527,20 +527,20 @@ void CWLDataDeviceProtocol::updateSelection() {
}
void CWLDataDeviceProtocol::onKeyboardFocus() {
- for (auto const& o : m_vOffers) {
- if (o->source && o->source->hasDnd())
+ for (auto const& o : m_offers) {
+ if (o->m_source && o->m_source->hasDnd())
continue;
- o->dead = true;
+ o->m_dead = true;
}
updateSelection();
}
void CWLDataDeviceProtocol::onDndPointerFocus() {
- for (auto const& o : m_vOffers) {
- if (o->source && !o->source->hasDnd())
+ for (auto const& o : m_offers) {
+ if (o->m_source && !o->m_source->hasDnd())
continue;
- o->dead = true;
+ o->m_dead = true;
}
updateDrag();
@@ -548,37 +548,37 @@ void CWLDataDeviceProtocol::onDndPointerFocus() {
void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource, SP<CWLSurfaceResource> dragSurface, SP<CWLSurfaceResource> origin) {
- if (dnd.currentSource) {
+ if (m_dnd.currentSource) {
LOGM(WARN, "New drag started while old drag still active??");
abortDrag();
}
g_pInputManager->setCursorImageUntilUnset("grabbing");
- dnd.overriddenCursor = true;
+ m_dnd.overriddenCursor = true;
LOGM(LOG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin);
- currentSource->used = true;
+ currentSource->m_used = true;
- dnd.currentSource = currentSource;
- dnd.originSurface = origin;
- dnd.dndSurface = dragSurface;
+ m_dnd.currentSource = currentSource;
+ m_dnd.originSurface = origin;
+ m_dnd.dndSurface = dragSurface;
if (dragSurface) {
- dnd.dndSurfaceDestroy = dragSurface->events.destroy.registerListener([this](std::any d) { abortDrag(); });
- dnd.dndSurfaceCommit = dragSurface->events.commit.registerListener([this](std::any d) {
- if (dnd.dndSurface->current.texture && !dnd.dndSurface->mapped) {
- dnd.dndSurface->map();
+ m_dnd.dndSurfaceDestroy = dragSurface->m_events.destroy.registerListener([this](std::any d) { abortDrag(); });
+ m_dnd.dndSurfaceCommit = dragSurface->m_events.commit.registerListener([this](std::any d) {
+ if (m_dnd.dndSurface->m_current.texture && !m_dnd.dndSurface->m_mapped) {
+ m_dnd.dndSurface->map();
return;
}
- if (dnd.dndSurface->current.texture <= 0 && dnd.dndSurface->mapped) {
- dnd.dndSurface->unmap();
+ if (m_dnd.dndSurface->m_current.texture <= 0 && m_dnd.dndSurface->m_mapped) {
+ m_dnd.dndSurface->unmap();
return;
}
});
}
- dnd.mouseButton = g_pHookSystem->hookDynamic("mouseButton", [this](void* self, SCallbackInfo& info, std::any e) {
+ m_dnd.mouseButton = g_pHookSystem->hookDynamic("mouseButton", [this](void* self, SCallbackInfo& info, std::any e) {
auto E = std::any_cast<IPointer::SButtonEvent>(e);
if (E.state == WL_POINTER_BUTTON_STATE_RELEASED) {
LOGM(LOG, "Dropping drag on mouseUp");
@@ -586,14 +586,14 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
}
});
- dnd.touchUp = g_pHookSystem->hookDynamic("touchUp", [this](void* self, SCallbackInfo& info, std::any e) {
+ m_dnd.touchUp = g_pHookSystem->hookDynamic("touchUp", [this](void* self, SCallbackInfo& info, std::any e) {
LOGM(LOG, "Dropping drag on touchUp");
dropDrag();
});
- dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
+ m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
auto V = std::any_cast<const Vector2D>(e);
- if (dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
+ if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
auto surf = CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
if (!surf)
@@ -604,14 +604,14 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
if (!box.has_value())
return;
- dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), V - box->pos());
+ m_dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), V - box->pos());
LOGM(LOG, "Drag motion {}", V - box->pos());
}
});
- dnd.touchMove = g_pHookSystem->hookDynamic("touchMove", [this](void* self, SCallbackInfo& info, std::any e) {
+ m_dnd.touchMove = g_pHookSystem->hookDynamic("touchMove", [this](void* self, SCallbackInfo& info, std::any e) {
auto E = std::any_cast<ITouch::SMotionEvent>(e);
- if (dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
+ if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
auto surf = CWLSurface::fromResource(g_pSeatManager->m_state.dndPointerFocus.lock());
if (!surf)
@@ -622,7 +622,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
if (!box.has_value())
return;
- dnd.focusedDevice->sendMotion(E.timeMs, E.pos);
+ m_dnd.focusedDevice->sendMotion(E.timeMs, E.pos);
LOGM(LOG, "Drag motion {}", E.pos);
}
});
@@ -642,34 +642,34 @@ void CWLDataDeviceProtocol::updateDrag() {
if (!dndActive())
return;
- if (dnd.focusedDevice)
- dnd.focusedDevice->sendLeave();
+ if (m_dnd.focusedDevice)
+ m_dnd.focusedDevice->sendLeave();
if (!g_pSeatManager->m_state.dndPointerFocus)
return;
- dnd.focusedDevice = dataDeviceForClient(g_pSeatManager->m_state.dndPointerFocus->client());
+ m_dnd.focusedDevice = dataDeviceForClient(g_pSeatManager->m_state.dndPointerFocus->client());
- if (!dnd.focusedDevice)
+ if (!m_dnd.focusedDevice)
return;
SP<IDataOffer> offer;
- if (const auto WL = dnd.focusedDevice->getWayland(); WL) {
+ if (const auto WL = m_dnd.focusedDevice->getWayland(); WL) {
const auto OFFER =
- m_vOffers.emplace_back(makeShared<CWLDataOfferResource>(makeShared<CWlDataOffer>(WL->resource->client(), WL->resource->version(), 0), dnd.currentSource.lock()));
+ m_offers.emplace_back(makeShared<CWLDataOfferResource>(makeShared<CWlDataOffer>(WL->m_resource->client(), WL->m_resource->version(), 0), m_dnd.currentSource.lock()));
if (!OFFER->good()) {
- WL->resource->noMemory();
- m_vOffers.pop_back();
+ WL->m_resource->noMemory();
+ m_offers.pop_back();
return;
}
- OFFER->source = dnd.currentSource;
- OFFER->self = OFFER;
- offer = OFFER;
+ OFFER->m_source = m_dnd.currentSource;
+ OFFER->m_self = OFFER;
+ offer = OFFER;
}
#ifndef NO_XWAYLAND
- else if (const auto X11 = dnd.focusedDevice->getX11(); X11)
- offer = g_pXWayland->pWM->createX11DataOffer(g_pSeatManager->m_state.keyboardFocus.lock(), dnd.currentSource.lock());
+ else if (const auto X11 = m_dnd.focusedDevice->getX11(); X11)
+ offer = g_pXWayland->pWM->createX11DataOffer(g_pSeatManager->m_state.keyboardFocus.lock(), m_dnd.currentSource.lock());
#endif
if (!offer) {
@@ -678,28 +678,28 @@ void CWLDataDeviceProtocol::updateDrag() {
}
LOGM(LOG, "New {} dnd offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(),
- (uintptr_t)dnd.currentSource.get());
+ (uintptr_t)m_dnd.currentSource.get());
- dnd.focusedDevice->sendDataOffer(offer);
+ m_dnd.focusedDevice->sendDataOffer(offer);
if (const auto WL = offer->getWayland(); WL)
WL->sendData();
- dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), g_pSeatManager->m_state.dndPointerFocus.lock(),
- g_pSeatManager->m_state.dndPointerFocus->current.size / 2.F, offer);
+ m_dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), g_pSeatManager->m_state.dndPointerFocus.lock(),
+ g_pSeatManager->m_state.dndPointerFocus->m_current.size / 2.F, offer);
}
void CWLDataDeviceProtocol::cleanupDndState(bool resetDevice, bool resetSource, bool simulateInput) {
- dnd.dndSurface.reset();
- dnd.dndSurfaceCommit.reset();
- dnd.dndSurfaceDestroy.reset();
- dnd.mouseButton.reset();
- dnd.mouseMove.reset();
- dnd.touchUp.reset();
- dnd.touchMove.reset();
+ m_dnd.dndSurface.reset();
+ m_dnd.dndSurfaceCommit.reset();
+ m_dnd.dndSurfaceDestroy.reset();
+ m_dnd.mouseButton.reset();
+ m_dnd.mouseMove.reset();
+ m_dnd.touchUp.reset();
+ m_dnd.touchMove.reset();
if (resetDevice)
- dnd.focusedDevice.reset();
+ m_dnd.focusedDevice.reset();
if (resetSource)
- dnd.currentSource.reset();
+ m_dnd.currentSource.reset();
if (simulateInput) {
g_pInputManager->simulateMouseMovement();
@@ -708,8 +708,8 @@ void CWLDataDeviceProtocol::cleanupDndState(bool resetDevice, bool resetSource,
}
void CWLDataDeviceProtocol::dropDrag() {
- if (!dnd.focusedDevice || !dnd.currentSource) {
- if (dnd.currentSource)
+ if (!m_dnd.focusedDevice || !m_dnd.currentSource) {
+ if (m_dnd.currentSource)
abortDrag();
return;
}
@@ -719,40 +719,40 @@ void CWLDataDeviceProtocol::dropDrag() {
return;
}
- dnd.focusedDevice->sendDrop();
+ m_dnd.focusedDevice->sendDrop();
#ifndef NO_XWAYLAND
- if (dnd.focusedDevice->getX11()) {
- dnd.focusedDevice->sendLeave();
- if (dnd.overriddenCursor)
+ if (m_dnd.focusedDevice->getX11()) {
+ m_dnd.focusedDevice->sendLeave();
+ if (m_dnd.overriddenCursor)
g_pInputManager->unsetCursorImage();
- dnd.overriddenCursor = false;
+ m_dnd.overriddenCursor = false;
cleanupDndState(true, true, true);
return;
}
#endif
- dnd.focusedDevice->sendLeave();
- if (dnd.overriddenCursor)
+ m_dnd.focusedDevice->sendLeave();
+ if (m_dnd.overriddenCursor)
g_pInputManager->unsetCursorImage();
- dnd.overriddenCursor = false;
+ m_dnd.overriddenCursor = false;
cleanupDndState(false, false, false);
}
bool CWLDataDeviceProtocol::wasDragSuccessful() {
- if (!dnd.currentSource)
+ if (!m_dnd.currentSource)
return false;
- for (auto const& o : m_vOffers) {
- if (o->dead || o->source != dnd.currentSource)
+ for (auto const& o : m_offers) {
+ if (o->m_dead || o->m_source != m_dnd.currentSource)
continue;
- if (o->recvd || o->accepted)
+ if (o->m_recvd || o->m_accepted)
return true;
}
#ifndef NO_XWAYLAND
- if (dnd.focusedDevice->getX11())
+ if (m_dnd.focusedDevice->getX11())
return true;
#endif
@@ -760,12 +760,12 @@ bool CWLDataDeviceProtocol::wasDragSuccessful() {
}
void CWLDataDeviceProtocol::completeDrag() {
- if (!dnd.focusedDevice && !dnd.currentSource)
+ if (!m_dnd.focusedDevice && !m_dnd.currentSource)
return;
- if (dnd.currentSource) {
- dnd.currentSource->sendDndDropPerformed();
- dnd.currentSource->sendDndFinished();
+ if (m_dnd.currentSource) {
+ m_dnd.currentSource->sendDndDropPerformed();
+ m_dnd.currentSource->sendDndFinished();
}
cleanupDndState(true, true, true);
@@ -774,56 +774,56 @@ void CWLDataDeviceProtocol::completeDrag() {
void CWLDataDeviceProtocol::abortDrag() {
cleanupDndState(false, false, false);
- if (dnd.overriddenCursor)
+ if (m_dnd.overriddenCursor)
g_pInputManager->unsetCursorImage();
- dnd.overriddenCursor = false;
+ m_dnd.overriddenCursor = false;
- if (!dnd.focusedDevice && !dnd.currentSource)
+ if (!m_dnd.focusedDevice && !m_dnd.currentSource)
return;
- if (dnd.focusedDevice) {
+ if (m_dnd.focusedDevice) {
#ifndef NO_XWAYLAND
- if (auto x11Device = dnd.focusedDevice->getX11(); x11Device)
+ if (auto x11Device = m_dnd.focusedDevice->getX11(); x11Device)
x11Device->forceCleanupDnd();
#endif
- dnd.focusedDevice->sendLeave();
+ m_dnd.focusedDevice->sendLeave();
}
- if (dnd.currentSource)
- dnd.currentSource->cancelled();
+ if (m_dnd.currentSource)
+ m_dnd.currentSource->cancelled();
- dnd.focusedDevice.reset();
- dnd.currentSource.reset();
+ m_dnd.focusedDevice.reset();
+ m_dnd.currentSource.reset();
g_pInputManager->simulateMouseMovement();
g_pSeatManager->resendEnterEvents();
}
void CWLDataDeviceProtocol::renderDND(PHLMONITOR pMonitor, const Time::steady_tp& when) {
- if (!dnd.dndSurface || !dnd.dndSurface->current.texture)
+ if (!m_dnd.dndSurface || !m_dnd.dndSurface->m_current.texture)
return;
const auto POS = g_pInputManager->getMouseCoordsInternal();
Vector2D surfacePos = POS;
- surfacePos += dnd.dndSurface->current.offset;
+ surfacePos += m_dnd.dndSurface->m_current.offset;
- CBox box = CBox{surfacePos, dnd.dndSurface->current.size}.translate(-pMonitor->m_position).scale(pMonitor->m_scale);
+ CBox box = CBox{surfacePos, m_dnd.dndSurface->m_current.size}.translate(-pMonitor->m_position).scale(pMonitor->m_scale);
CTexPassElement::SRenderData data;
- data.tex = dnd.dndSurface->current.texture;
+ data.tex = m_dnd.dndSurface->m_current.texture;
data.box = box;
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
- CBox damageBox = CBox{surfacePos, dnd.dndSurface->current.size}.expand(5);
+ CBox damageBox = CBox{surfacePos, m_dnd.dndSurface->m_current.size}.expand(5);
g_pHyprRenderer->damageBox(damageBox);
- dnd.dndSurface->frame(when);
+ m_dnd.dndSurface->frame(when);
}
bool CWLDataDeviceProtocol::dndActive() {
- return dnd.currentSource;
+ return m_dnd.currentSource;
}
void CWLDataDeviceProtocol::abortDndIfPresent() {
diff --git a/src/protocols/core/DataDevice.hpp b/src/protocols/core/DataDevice.hpp
index 0c53111b..d54927d2 100644
--- a/src/protocols/core/DataDevice.hpp
+++ b/src/protocols/core/DataDevice.hpp
@@ -40,17 +40,15 @@ class CWLDataOfferResource : public IDataOffer {
virtual SP<CX11DataOffer> getX11();
virtual SP<IDataSource> getSource();
- WP<IDataSource> source;
- WP<CWLDataOfferResource> self;
+ WP<IDataSource> m_source;
+ WP<CWLDataOfferResource> m_self;
- bool dead = false;
- bool accepted = false;
- bool recvd = false;
-
- uint32_t actions = 0;
+ bool m_dead = false;
+ bool m_accepted = false;
+ bool m_recvd = false;
private:
- SP<CWlDataOffer> resource;
+ SP<CWlDataOffer> m_resource;
friend class CWLDataDeviceResource;
};
@@ -76,19 +74,19 @@ class CWLDataSourceResource : public IDataSource {
virtual void sendDndDropPerformed();
virtual void sendDndAction(wl_data_device_manager_dnd_action a);
- bool used = false;
- bool dnd = false;
- bool dndSuccess = false;
- bool dropped = false;
+ bool m_used = false;
+ bool m_dnd = false;
+ bool m_dndSuccess = false;
+ bool m_dropped = false;
- WP<CWLDataDeviceResource> device;
- WP<CWLDataSourceResource> self;
+ WP<CWLDataDeviceResource> m_device;
+ WP<CWLDataSourceResource> m_self;
- std::vector<std::string> mimeTypes;
- uint32_t supportedActions = 0;
+ std::vector<std::string> m_mimeTypes;
+ uint32_t m_supportedActions = 0;
private:
- SP<CWlDataSource> resource;
+ SP<CWlDataSource> m_resource;
friend class CWLDataDeviceProtocol;
};
@@ -110,11 +108,11 @@ class CWLDataDeviceResource : public IDataDevice {
virtual void sendSelection(SP<IDataOffer> offer);
virtual eDataSourceType type();
- WP<CWLDataDeviceResource> self;
+ WP<CWLDataDeviceResource> m_self;
private:
- SP<CWlDataDevice> resource;
- wl_client* pClient = nullptr;
+ SP<CWlDataDevice> m_resource;
+ wl_client* m_client = nullptr;
friend class CWLDataDeviceProtocol;
};
@@ -125,11 +123,11 @@ class CWLDataDeviceManagerResource {
bool good();
- WP<CWLDataDeviceResource> device;
- std::vector<WP<CWLDataSourceResource>> sources;
+ WP<CWLDataDeviceResource> m_device;
+ std::vector<WP<CWLDataSourceResource>> m_sources;
private:
- SP<CWlDataDeviceManager> resource;
+ SP<CWlDataDeviceManager> m_resource;
};
class CWLDataDeviceProtocol : public IWaylandProtocol {
@@ -154,10 +152,10 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
void destroyResource(CWLDataOfferResource* resource);
//
- std::vector<SP<CWLDataDeviceManagerResource>> m_vManagers;
- std::vector<SP<CWLDataDeviceResource>> m_vDevices;
- std::vector<SP<CWLDataSourceResource>> m_vSources;
- std::vector<SP<CWLDataOfferResource>> m_vOffers;
+ std::vector<SP<CWLDataDeviceManagerResource>> m_managers;
+ std::vector<SP<CWLDataDeviceResource>> m_devices;
+ std::vector<SP<CWLDataSourceResource>> m_sources;
+ std::vector<SP<CWLDataOfferResource>> m_offers;
//
@@ -182,7 +180,7 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
SP<HOOK_CALLBACK_FN> mouseButton;
SP<HOOK_CALLBACK_FN> touchUp;
SP<HOOK_CALLBACK_FN> touchMove;
- } dnd;
+ } m_dnd;
void abortDrag();
void initiateDrag(WP<CWLDataSourceResource> currentSource, SP<CWLSurfaceResource> dragSurface, SP<CWLSurfaceResource> origin);
@@ -204,7 +202,7 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
struct {
CHyprSignalListener onKeyboardFocusChange;
CHyprSignalListener onDndPointerFocusChange;
- } listeners;
+ } m_listeners;
};
namespace PROTO {
diff --git a/src/protocols/core/Output.cpp b/src/protocols/core/Output.cpp
index dfb89ba7..5db2f678 100644
--- a/src/protocols/core/Output.cpp
+++ b/src/protocols/core/Output.cpp
@@ -3,29 +3,29 @@
#include "../../Compositor.hpp"
#include "../../helpers/Monitor.hpp"
-CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonitor) : monitor(pMonitor), resource(resource_) {
+CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonitor) : m_monitor(pMonitor), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setData(this);
+ m_resource->setData(this);
- pClient = resource->client();
+ m_client = m_resource->client();
- if (!monitor)
+ if (!m_monitor)
return;
- resource->setOnDestroy([this](CWlOutput* r) {
- if (monitor && PROTO::outputs.contains(monitor->m_name))
- PROTO::outputs.at(monitor->m_name)->destroyResource(this);
+ m_resource->setOnDestroy([this](CWlOutput* r) {
+ if (m_monitor && PROTO::outputs.contains(m_monitor->m_name))
+ PROTO::outputs.at(m_monitor->m_name)->destroyResource(this);
});
- resource->setRelease([this](CWlOutput* r) {
- if (monitor && PROTO::outputs.contains(monitor->m_name))
- PROTO::outputs.at(monitor->m_name)->destroyResource(this);
+ m_resource->setRelease([this](CWlOutput* r) {
+ if (m_monitor && PROTO::outputs.contains(m_monitor->m_name))
+ PROTO::outputs.at(m_monitor->m_name)->destroyResource(this);
});
- if (resource->version() >= 4) {
- resource->sendName(monitor->m_name.c_str());
- resource->sendDescription(monitor->m_description.c_str());
+ if (m_resource->version() >= 4) {
+ m_resource->sendName(m_monitor->m_name.c_str());
+ m_resource->sendDescription(m_monitor->m_description.c_str());
}
updateState();
@@ -52,72 +52,72 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
SP<CWLOutputResource> CWLOutputResource::fromResource(wl_resource* res) {
auto data = (CWLOutputResource*)(((CWlOutput*)wl_resource_get_user_data(res))->data());
- return data ? data->self.lock() : nullptr;
+ return data ? data->m_self.lock() : nullptr;
}
bool CWLOutputResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
wl_client* CWLOutputResource::client() {
- return pClient;
+ return m_client;
}
SP<CWlOutput> CWLOutputResource::getResource() {
- return resource;
+ return m_resource;
}
void CWLOutputResource::updateState() {
- if (!monitor || (owner && owner->defunct))
+ if (!m_monitor || (m_owner && m_owner->m_defunct))
return;
- if (resource->version() >= 2)
- resource->sendScale(std::ceil(monitor->m_scale));
+ if (m_resource->version() >= 2)
+ m_resource->sendScale(std::ceil(m_monitor->m_scale));
- resource->sendMode((wl_output_mode)(WL_OUTPUT_MODE_CURRENT), monitor->m_pixelSize.x, monitor->m_pixelSize.y, monitor->m_refreshRate * 1000.0);
+ m_resource->sendMode((wl_output_mode)(WL_OUTPUT_MODE_CURRENT), m_monitor->m_pixelSize.x, m_monitor->m_pixelSize.y, m_monitor->m_refreshRate * 1000.0);
- resource->sendGeometry(0, 0, monitor->m_output->physicalSize.x, monitor->m_output->physicalSize.y, (wl_output_subpixel)monitor->m_output->subpixel,
- monitor->m_output->make.c_str(), monitor->m_output->model.c_str(), monitor->m_transform);
+ m_resource->sendGeometry(0, 0, m_monitor->m_output->physicalSize.x, m_monitor->m_output->physicalSize.y, (wl_output_subpixel)m_monitor->m_output->subpixel,
+ m_monitor->m_output->make.c_str(), m_monitor->m_output->model.c_str(), m_monitor->m_transform);
- if (resource->version() >= 2)
- resource->sendDone();
+ if (m_resource->version() >= 2)
+ m_resource->sendDone();
}
CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, PHLMONITOR pMonitor) :
- IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->m_name) {
+ IWaylandProtocol(iface, ver, name), m_monitor(pMonitor), m_name(pMonitor->m_name) {
- listeners.modeChanged = monitor->m_events.modeChanged.registerListener([this](std::any d) {
- for (auto const& o : m_vOutputs) {
+ m_listeners.modeChanged = m_monitor->m_events.modeChanged.registerListener([this](std::any d) {
+ for (auto const& o : m_outputs) {
o->updateState();
}
});
}
void CWLOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- if UNLIKELY (defunct)
+ if UNLIKELY (m_defunct)
Debug::log(WARN, "[wl_output] Binding a wl_output that's inert?? Possible client bug.");
- const auto RESOURCE = m_vOutputs.emplace_back(makeShared<CWLOutputResource>(makeShared<CWlOutput>(client, ver, id), monitor.lock()));
+ const auto RESOURCE = m_outputs.emplace_back(makeShared<CWLOutputResource>(makeShared<CWlOutput>(client, ver, id), m_monitor.lock()));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vOutputs.pop_back();
+ m_outputs.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
- RESOURCE->owner = self;
+ RESOURCE->m_self = RESOURCE;
+ RESOURCE->m_owner = m_self;
}
void CWLOutputProtocol::destroyResource(CWLOutputResource* resource) {
- std::erase_if(m_vOutputs, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_outputs, [&](const auto& other) { return other.get() == resource; });
- if (m_vOutputs.empty() && defunct)
- PROTO::outputs.erase(szName);
+ if (m_outputs.empty() && m_defunct)
+ PROTO::outputs.erase(m_name);
}
SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) {
- for (auto const& r : m_vOutputs) {
+ for (auto const& r : m_outputs) {
if (r->client() != client)
continue;
@@ -128,22 +128,22 @@ SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) {
}
void CWLOutputProtocol::remove() {
- if UNLIKELY (defunct)
+ if UNLIKELY (m_defunct)
return;
- defunct = true;
+ m_defunct = true;
removeGlobal();
}
bool CWLOutputProtocol::isDefunct() {
- return defunct;
+ return m_defunct;
}
void CWLOutputProtocol::sendDone() {
- if UNLIKELY (defunct)
+ if UNLIKELY (m_defunct)
return;
- for (auto const& r : m_vOutputs) {
- r->resource->sendDone();
+ for (auto const& r : m_outputs) {
+ r->m_resource->sendDone();
}
}
diff --git a/src/protocols/core/Output.hpp b/src/protocols/core/Output.hpp
index 8ade5178..9f14289e 100644
--- a/src/protocols/core/Output.hpp
+++ b/src/protocols/core/Output.hpp
@@ -19,13 +19,13 @@ class CWLOutputResource {
SP<CWlOutput> getResource();
void updateState();
- PHLMONITORREF monitor;
- WP<CWLOutputProtocol> owner;
- WP<CWLOutputResource> self;
+ PHLMONITORREF m_monitor;
+ WP<CWLOutputProtocol> m_owner;
+ WP<CWLOutputResource> m_self;
private:
- SP<CWlOutput> resource;
- wl_client* pClient = nullptr;
+ SP<CWlOutput> m_resource;
+ wl_client* m_client = nullptr;
friend class CWLOutputProtocol;
};
@@ -39,8 +39,8 @@ class CWLOutputProtocol : public IWaylandProtocol {
SP<CWLOutputResource> outputResourceFrom(wl_client* client);
void sendDone();
- PHLMONITORREF monitor;
- WP<CWLOutputProtocol> self;
+ PHLMONITORREF m_monitor;
+ WP<CWLOutputProtocol> m_self;
// will mark the protocol for removal, will be removed when no. of bound outputs is 0 (or when overwritten by a new global)
void remove();
@@ -50,13 +50,13 @@ class CWLOutputProtocol : public IWaylandProtocol {
void destroyResource(CWLOutputResource* resource);
//
- std::vector<SP<CWLOutputResource>> m_vOutputs;
- bool defunct = false;
- std::string szName = "";
+ std::vector<SP<CWLOutputResource>> m_outputs;
+ bool m_defunct = false;
+ std::string m_name = "";
struct {
CHyprSignalListener modeChanged;
- } listeners;
+ } m_listeners;
friend class CWLOutputResource;
};
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp
index 6dbed8fd..bc224043 100644
--- a/src/protocols/core/Seat.cpp
+++ b/src/protocols/core/Seat.cpp
@@ -10,292 +10,292 @@
#include <fcntl.h>
-CWLTouchResource::CWLTouchResource(SP<CWlTouch> resource_, SP<CWLSeatResource> owner_) : owner(owner_), resource(resource_) {
+CWLTouchResource::CWLTouchResource(SP<CWlTouch> resource_, SP<CWLSeatResource> owner_) : m_owner(owner_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setRelease([this](CWlTouch* r) { PROTO::seat->destroyResource(this); });
- resource->setOnDestroy([this](CWlTouch* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setRelease([this](CWlTouch* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlTouch* r) { PROTO::seat->destroyResource(this); });
}
bool CWLTouchResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLTouchResource::sendDown(SP<CWLSurfaceResource> surface, uint32_t timeMs, int32_t id, const Vector2D& local) {
- if (!owner || !surface || !surface->getResource()->resource())
+ if (!m_owner || !surface || !surface->getResource()->resource())
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- ASSERT(surface->client() == owner->client());
+ ASSERT(surface->client() == m_owner->client());
- currentSurface = surface;
- listeners.destroySurface = surface->events.destroy.registerListener([this, timeMs, id](std::any d) { sendUp(timeMs + 10 /* hack */, id); });
+ m_currentSurface = surface;
+ m_listeners.destroySurface = surface->m_events.destroy.registerListener([this, timeMs, id](std::any d) { sendUp(timeMs + 10 /* hack */, id); });
- resource->sendDown(g_pSeatManager->nextSerial(owner.lock()), timeMs, surface->getResource().get(), id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
+ m_resource->sendDown(g_pSeatManager->nextSerial(m_owner.lock()), timeMs, surface->getResource().get(), id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
- fingers++;
+ m_fingers++;
}
void CWLTouchResource::sendUp(uint32_t timeMs, int32_t id) {
- if (!owner)
+ if (!m_owner)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendUp(g_pSeatManager->nextSerial(owner.lock()), timeMs, id);
- fingers--;
- if (fingers <= 0) {
- currentSurface.reset();
- listeners.destroySurface.reset();
- fingers = 0;
+ m_resource->sendUp(g_pSeatManager->nextSerial(m_owner.lock()), timeMs, id);
+ m_fingers--;
+ if (m_fingers <= 0) {
+ m_currentSurface.reset();
+ m_listeners.destroySurface.reset();
+ m_fingers = 0;
}
}
void CWLTouchResource::sendMotion(uint32_t timeMs, int32_t id, const Vector2D& local) {
- if (!owner)
+ if (!m_owner)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendMotion(timeMs, id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
+ m_resource->sendMotion(timeMs, id, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
}
void CWLTouchResource::sendFrame() {
- if (!owner)
+ if (!m_owner)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendFrame();
+ m_resource->sendFrame();
}
void CWLTouchResource::sendCancel() {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendCancel();
+ m_resource->sendCancel();
}
void CWLTouchResource::sendShape(int32_t id, const Vector2D& shape) {
- if (!owner || !currentSurface || resource->version() < 6)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 6)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendShape(id, wl_fixed_from_double(shape.x), wl_fixed_from_double(shape.y));
+ m_resource->sendShape(id, wl_fixed_from_double(shape.x), wl_fixed_from_double(shape.y));
}
void CWLTouchResource::sendOrientation(int32_t id, double angle) {
- if (!owner || !currentSurface || resource->version() < 6)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 6)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH))
return;
- resource->sendOrientation(id, wl_fixed_from_double(angle));
+ m_resource->sendOrientation(id, wl_fixed_from_double(angle));
}
-CWLPointerResource::CWLPointerResource(SP<CWlPointer> resource_, SP<CWLSeatResource> owner_) : owner(owner_), resource(resource_) {
+CWLPointerResource::CWLPointerResource(SP<CWlPointer> resource_, SP<CWLSeatResource> owner_) : m_owner(owner_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setRelease([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
- resource->setOnDestroy([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setRelease([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
- resource->setSetCursor([this](CWlPointer* r, uint32_t serial, wl_resource* surf, int32_t hotX, int32_t hotY) {
- if (!owner) {
+ m_resource->setSetCursor([this](CWlPointer* r, uint32_t serial, wl_resource* surf, int32_t hotX, int32_t hotY) {
+ if (!m_owner) {
LOGM(ERR, "Client bug: setCursor when seatClient is already dead");
return;
}
auto surfResource = surf ? CWLSurfaceResource::fromResource(surf) : nullptr;
- if (surfResource && surfResource->role->role() != SURFACE_ROLE_CURSOR && surfResource->role->role() != SURFACE_ROLE_UNASSIGNED) {
+ if (surfResource && surfResource->m_role->role() != SURFACE_ROLE_CURSOR && surfResource->m_role->role() != SURFACE_ROLE_UNASSIGNED) {
r->error(-1, "Cursor surface already has a different role");
return;
}
- if (surfResource && surfResource->role->role() != SURFACE_ROLE_CURSOR) {
- surfResource->role = makeShared<CCursorSurfaceRole>();
+ if (surfResource && surfResource->m_role->role() != SURFACE_ROLE_CURSOR) {
+ surfResource->m_role = makeShared<CCursorSurfaceRole>();
surfResource->updateCursorShm();
}
- g_pSeatManager->onSetCursor(owner.lock(), serial, surfResource, {hotX, hotY});
+ g_pSeatManager->onSetCursor(m_owner.lock(), serial, surfResource, {hotX, hotY});
});
- if (g_pSeatManager->m_state.pointerFocus && g_pSeatManager->m_state.pointerFocus->client() == resource->client())
+ if (g_pSeatManager->m_state.pointerFocus && g_pSeatManager->m_state.pointerFocus->client() == m_resource->client())
sendEnter(g_pSeatManager->m_state.pointerFocus.lock(), {-1, -1} /* Coords don't really matter that much, they will be updated next move */);
}
int CWLPointerResource::version() {
- return resource->version();
+ return m_resource->version();
}
bool CWLPointerResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLPointerResource::sendEnter(SP<CWLSurfaceResource> surface, const Vector2D& local) {
- if (!owner || currentSurface == surface || !surface->getResource()->resource())
+ if (!m_owner || m_currentSurface == surface || !surface->getResource()->resource())
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- if (currentSurface) {
+ if (m_currentSurface) {
LOGM(WARN, "requested CWLPointerResource::sendEnter without sendLeave first.");
sendLeave();
}
- ASSERT(surface->client() == owner->client());
+ ASSERT(surface->client() == m_owner->client());
- currentSurface = surface;
- listeners.destroySurface = surface->events.destroy.registerListener([this](std::any d) { sendLeave(); });
+ m_currentSurface = surface;
+ m_listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) { sendLeave(); });
- resource->sendEnter(g_pSeatManager->nextSerial(owner.lock()), surface->getResource().get(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
+ m_resource->sendEnter(g_pSeatManager->nextSerial(m_owner.lock()), surface->getResource().get(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
}
void CWLPointerResource::sendLeave() {
- if (!owner || !currentSurface || !currentSurface->getResource()->resource())
+ if (!m_owner || !m_currentSurface || !m_currentSurface->getResource()->resource())
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
// release all buttons unless we have a dnd going on in which case
// the events shall be lost.
if (!PROTO::data->dndActive()) {
- for (auto const& b : pressedButtons) {
+ for (auto const& b : m_pressedButtons) {
sendButton(Time::millis(Time::steadyNow()), b, WL_POINTER_BUTTON_STATE_RELEASED);
}
}
- pressedButtons.clear();
+ m_pressedButtons.clear();
- resource->sendLeave(g_pSeatManager->nextSerial(owner.lock()), currentSurface->getResource().get());
- currentSurface.reset();
- listeners.destroySurface.reset();
+ m_resource->sendLeave(g_pSeatManager->nextSerial(m_owner.lock()), m_currentSurface->getResource().get());
+ m_currentSurface.reset();
+ m_listeners.destroySurface.reset();
}
void CWLPointerResource::sendMotion(uint32_t timeMs, const Vector2D& local) {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendMotion(timeMs, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
+ m_resource->sendMotion(timeMs, wl_fixed_from_double(local.x), wl_fixed_from_double(local.y));
}
void CWLPointerResource::sendButton(uint32_t timeMs, uint32_t button, wl_pointer_button_state state) {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- if (state == WL_POINTER_BUTTON_STATE_RELEASED && std::find(pressedButtons.begin(), pressedButtons.end(), button) == pressedButtons.end()) {
+ if (state == WL_POINTER_BUTTON_STATE_RELEASED && std::find(m_pressedButtons.begin(), m_pressedButtons.end(), button) == m_pressedButtons.end()) {
LOGM(ERR, "sendButton release on a non-pressed button");
return;
- } else if (state == WL_POINTER_BUTTON_STATE_PRESSED && std::find(pressedButtons.begin(), pressedButtons.end(), button) != pressedButtons.end()) {
+ } else if (state == WL_POINTER_BUTTON_STATE_PRESSED && std::find(m_pressedButtons.begin(), m_pressedButtons.end(), button) != m_pressedButtons.end()) {
LOGM(ERR, "sendButton press on a non-pressed button");
return;
}
if (state == WL_POINTER_BUTTON_STATE_RELEASED)
- std::erase(pressedButtons, button);
+ std::erase(m_pressedButtons, button);
else if (state == WL_POINTER_BUTTON_STATE_PRESSED)
- pressedButtons.emplace_back(button);
+ m_pressedButtons.emplace_back(button);
- resource->sendButton(g_pSeatManager->nextSerial(owner.lock()), timeMs, button, state);
+ m_resource->sendButton(g_pSeatManager->nextSerial(m_owner.lock()), timeMs, button, state);
}
void CWLPointerResource::sendAxis(uint32_t timeMs, wl_pointer_axis axis, double value) {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxis(timeMs, axis, wl_fixed_from_double(value));
+ m_resource->sendAxis(timeMs, axis, wl_fixed_from_double(value));
}
void CWLPointerResource::sendFrame() {
- if (!owner || resource->version() < 5)
+ if (!m_owner || m_resource->version() < 5)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendFrame();
+ m_resource->sendFrame();
}
void CWLPointerResource::sendAxisSource(wl_pointer_axis_source source) {
- if (!owner || !currentSurface || resource->version() < 5)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 5)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxisSource(source);
+ m_resource->sendAxisSource(source);
}
void CWLPointerResource::sendAxisStop(uint32_t timeMs, wl_pointer_axis axis) {
- if (!owner || !currentSurface || resource->version() < 5)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 5)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxisStop(timeMs, axis);
+ m_resource->sendAxisStop(timeMs, axis);
}
void CWLPointerResource::sendAxisDiscrete(wl_pointer_axis axis, int32_t discrete) {
- if (!owner || !currentSurface || resource->version() < 5)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 5)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxisDiscrete(axis, discrete);
+ m_resource->sendAxisDiscrete(axis, discrete);
}
void CWLPointerResource::sendAxisValue120(wl_pointer_axis axis, int32_t value120) {
- if (!owner || !currentSurface || resource->version() < 8)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 8)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxisValue120(axis, value120);
+ m_resource->sendAxisValue120(axis, value120);
}
void CWLPointerResource::sendAxisRelativeDirection(wl_pointer_axis axis, wl_pointer_axis_relative_direction direction) {
- if (!owner || !currentSurface || resource->version() < 9)
+ if (!m_owner || !m_currentSurface || m_resource->version() < 9)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_POINTER))
return;
- resource->sendAxisRelativeDirection(axis, direction);
+ m_resource->sendAxisRelativeDirection(axis, direction);
}
-CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatResource> owner_) : owner(owner_), resource(resource_) {
+CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatResource> owner_) : m_owner(owner_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setRelease([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); });
- resource->setOnDestroy([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setRelease([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); });
if (!g_pSeatManager->m_keyboard) {
LOGM(ERR, "No keyboard on bound wl_keyboard??");
@@ -305,160 +305,160 @@ CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatRe
sendKeymap(g_pSeatManager->m_keyboard.lock());
repeatInfo(g_pSeatManager->m_keyboard->m_repeatRate, g_pSeatManager->m_keyboard->m_repeatDelay);
- if (g_pSeatManager->m_state.keyboardFocus && g_pSeatManager->m_state.keyboardFocus->client() == resource->client())
+ if (g_pSeatManager->m_state.keyboardFocus && g_pSeatManager->m_state.keyboardFocus->client() == m_resource->client())
sendEnter(g_pSeatManager->m_state.keyboardFocus.lock());
}
bool CWLKeyboardResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
void CWLKeyboardResource::sendKeymap(SP<IKeyboard> keyboard) {
if (!keyboard)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
std::string_view keymap = keyboard->m_xkbKeymapString;
Hyprutils::OS::CFileDescriptor& fd = keyboard->m_xkbKeymapFD;
uint32_t size = keyboard->m_xkbKeymapString.length() + 1;
- if (keymap == lastKeymap)
+ if (keymap == m_lastKeymap)
return;
- lastKeymap = keymap;
+ m_lastKeymap = keymap;
const wl_keyboard_keymap_format format = keyboard ? WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 : WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP;
- resource->sendKeymap(format, fd.get(), size);
+ m_resource->sendKeymap(format, fd.get(), size);
}
void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface) {
- if (!owner || currentSurface == surface || !surface->getResource()->resource())
+ if (!m_owner || m_currentSurface == surface || !surface->getResource()->resource())
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- if (currentSurface) {
+ if (m_currentSurface) {
LOGM(WARN, "requested CWLKeyboardResource::sendEnter without sendLeave first.");
sendLeave();
}
- ASSERT(surface->client() == owner->client());
+ ASSERT(surface->client() == m_owner->client());
- currentSurface = surface;
- listeners.destroySurface = surface->events.destroy.registerListener([this](std::any d) { sendLeave(); });
+ m_currentSurface = surface;
+ m_listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) { sendLeave(); });
wl_array arr;
wl_array_init(&arr);
- resource->sendEnter(g_pSeatManager->nextSerial(owner.lock()), surface->getResource().get(), &arr);
+ m_resource->sendEnter(g_pSeatManager->nextSerial(m_owner.lock()), surface->getResource().get(), &arr);
wl_array_release(&arr);
}
void CWLKeyboardResource::sendLeave() {
- if (!owner || !currentSurface || !currentSurface->getResource()->resource())
+ if (!m_owner || !m_currentSurface || !m_currentSurface->getResource()->resource())
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- resource->sendLeave(g_pSeatManager->nextSerial(owner.lock()), currentSurface->getResource().get());
- currentSurface.reset();
- listeners.destroySurface.reset();
+ m_resource->sendLeave(g_pSeatManager->nextSerial(m_owner.lock()), m_currentSurface->getResource().get());
+ m_currentSurface.reset();
+ m_listeners.destroySurface.reset();
}
void CWLKeyboardResource::sendKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state) {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- resource->sendKey(g_pSeatManager->nextSerial(owner.lock()), timeMs, key, state);
+ m_resource->sendKey(g_pSeatManager->nextSerial(m_owner.lock()), timeMs, key, state);
}
void CWLKeyboardResource::sendMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) {
- if (!owner || !currentSurface)
+ if (!m_owner || !m_currentSurface)
return;
- if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(PROTO::seat->m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- resource->sendModifiers(g_pSeatManager->nextSerial(owner.lock()), depressed, latched, locked, group);
+ m_resource->sendModifiers(g_pSeatManager->nextSerial(m_owner.lock()), depressed, latched, locked, group);
}
void CWLKeyboardResource::repeatInfo(uint32_t rate, uint32_t delayMs) {
- if (!owner || resource->version() < 4 || (rate == lastRate && delayMs == lastDelayMs))
+ if (!m_owner || m_resource->version() < 4 || (rate == m_lastRate && delayMs == m_lastDelayMs))
return;
- lastRate = rate;
- lastDelayMs = delayMs;
+ m_lastRate = rate;
+ m_lastDelayMs = delayMs;
- resource->sendRepeatInfo(rate, delayMs);
+ m_resource->sendRepeatInfo(rate, delayMs);
}
-CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : resource(resource_) {
+CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlSeat* r) {
- events.destroy.emit();
+ m_resource->setOnDestroy([this](CWlSeat* r) {
+ m_events.destroy.emit();
PROTO::seat->destroyResource(this);
});
- resource->setRelease([this](CWlSeat* r) {
- events.destroy.emit();
+ m_resource->setRelease([this](CWlSeat* r) {
+ m_events.destroy.emit();
PROTO::seat->destroyResource(this);
});
- pClient = resource->client();
+ m_client = m_resource->client();
- resource->setGetKeyboard([this](CWlSeat* r, uint32_t id) {
- const auto RESOURCE = PROTO::seat->m_vKeyboards.emplace_back(makeShared<CWLKeyboardResource>(makeShared<CWlKeyboard>(r->client(), r->version(), id), self.lock()));
+ m_resource->setGetKeyboard([this](CWlSeat* r, uint32_t id) {
+ const auto RESOURCE = PROTO::seat->m_keyboards.emplace_back(makeShared<CWLKeyboardResource>(makeShared<CWlKeyboard>(r->client(), r->version(), id), m_self.lock()));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::seat->m_vKeyboards.pop_back();
+ PROTO::seat->m_keyboards.pop_back();
return;
}
- keyboards.emplace_back(RESOURCE);
+ m_keyboards.emplace_back(RESOURCE);
});
- resource->setGetPointer([this](CWlSeat* r, uint32_t id) {
- const auto RESOURCE = PROTO::seat->m_vPointers.emplace_back(makeShared<CWLPointerResource>(makeShared<CWlPointer>(r->client(), r->version(), id), self.lock()));
+ m_resource->setGetPointer([this](CWlSeat* r, uint32_t id) {
+ const auto RESOURCE = PROTO::seat->m_pointers.emplace_back(makeShared<CWLPointerResource>(makeShared<CWlPointer>(r->client(), r->version(), id), m_self.lock()));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::seat->m_vPointers.pop_back();
+ PROTO::seat->m_pointers.pop_back();
return;
}
- pointers.emplace_back(RESOURCE);
+ m_pointers.emplace_back(RESOURCE);
});
- resource->setGetTouch([this](CWlSeat* r, uint32_t id) {
- const auto RESOURCE = PROTO::seat->m_vTouches.emplace_back(makeShared<CWLTouchResource>(makeShared<CWlTouch>(r->client(), r->version(), id), self.lock()));
+ m_resource->setGetTouch([this](CWlSeat* r, uint32_t id) {
+ const auto RESOURCE = PROTO::seat->m_touches.emplace_back(makeShared<CWLTouchResource>(makeShared<CWlTouch>(r->client(), r->version(), id), m_self.lock()));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::seat->m_vTouches.pop_back();
+ PROTO::seat->m_touches.pop_back();
return;
}
- touches.emplace_back(RESOURCE);
+ m_touches.emplace_back(RESOURCE);
});
- if (resource->version() >= 2)
- resource->sendName(HL_SEAT_NAME);
+ if (m_resource->version() >= 2)
+ m_resource->sendName(HL_SEAT_NAME);
- sendCapabilities(PROTO::seat->currentCaps);
+ sendCapabilities(PROTO::seat->m_currentCaps);
}
CWLSeatResource::~CWLSeatResource() {
- events.destroy.emit();
+ m_events.destroy.emit();
}
void CWLSeatResource::sendCapabilities(uint32_t caps) {
@@ -470,15 +470,15 @@ void CWLSeatResource::sendCapabilities(uint32_t caps) {
if (caps & eHIDCapabilityType::HID_INPUT_CAPABILITY_TOUCH)
wlCaps |= WL_SEAT_CAPABILITY_TOUCH;
- resource->sendCapabilities((wl_seat_capability)wlCaps);
+ m_resource->sendCapabilities((wl_seat_capability)wlCaps);
}
bool CWLSeatResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
wl_client* CWLSeatResource::client() {
- return pClient;
+ return m_client;
}
CWLSeatProtocol::CWLSeatProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
@@ -486,68 +486,68 @@ CWLSeatProtocol::CWLSeatProtocol(const wl_interface* iface, const int& ver, cons
}
void CWLSeatProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto RESOURCE = m_vSeatResources.emplace_back(makeShared<CWLSeatResource>(makeShared<CWlSeat>(client, ver, id)));
+ const auto RESOURCE = m_seatResources.emplace_back(makeShared<CWLSeatResource>(makeShared<CWlSeat>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vSeatResources.pop_back();
+ m_seatResources.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
LOGM(LOG, "New seat resource bound at {:x}", (uintptr_t)RESOURCE.get());
- events.newSeatResource.emit(RESOURCE);
+ m_events.newSeatResource.emit(RESOURCE);
}
void CWLSeatProtocol::destroyResource(CWLSeatResource* seat) {
- std::erase_if(m_vSeatResources, [&](const auto& other) { return other.get() == seat; });
+ std::erase_if(m_seatResources, [&](const auto& other) { return other.get() == seat; });
}
void CWLSeatProtocol::destroyResource(CWLKeyboardResource* resource) {
- std::erase_if(m_vKeyboards, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_keyboards, [&](const auto& other) { return other.get() == resource; });
}
void CWLSeatProtocol::destroyResource(CWLPointerResource* resource) {
- std::erase_if(m_vPointers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_pointers, [&](const auto& other) { return other.get() == resource; });
}
void CWLSeatProtocol::destroyResource(CWLTouchResource* resource) {
- std::erase_if(m_vTouches, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_touches, [&](const auto& other) { return other.get() == resource; });
}
void CWLSeatProtocol::updateCapabilities(uint32_t caps) {
- if (caps == currentCaps)
+ if (caps == m_currentCaps)
return;
- currentCaps = caps;
+ m_currentCaps = caps;
- for (auto const& s : m_vSeatResources) {
+ for (auto const& s : m_seatResources) {
s->sendCapabilities(caps);
}
}
void CWLSeatProtocol::updateKeymap() {
- if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- for (auto const& k : m_vKeyboards) {
+ for (auto const& k : m_keyboards) {
k->sendKeymap(g_pSeatManager->m_keyboard.lock());
}
}
void CWLSeatProtocol::updateRepeatInfo(uint32_t rate, uint32_t delayMs) {
- if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
+ if (!(m_currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return;
- for (auto const& k : m_vKeyboards) {
+ for (auto const& k : m_keyboards) {
k->repeatInfo(rate, delayMs);
}
}
SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) {
- for (auto const& r : m_vSeatResources) {
+ for (auto const& r : m_seatResources) {
if (r->client() == client)
return r;
}
@@ -556,8 +556,8 @@ SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) {
}
std::vector<uint8_t>& CCursorSurfaceRole::cursorPixelData(SP<CWLSurfaceResource> surface) {
- RASSERT(surface->role->role() == SURFACE_ROLE_CURSOR, "cursorPixelData called on a non-cursor surface");
+ RASSERT(surface->m_role->role() == SURFACE_ROLE_CURSOR, "cursorPixelData called on a non-cursor surface");
- auto role = (CCursorSurfaceRole*)surface->role.get();
- return role->cursorShmPixelData;
+ auto role = (CCursorSurfaceRole*)surface->m_role.get();
+ return role->m_cursorShmPixelData;
}
diff --git a/src/protocols/core/Seat.hpp b/src/protocols/core/Seat.hpp
index a4889379..35839385 100644
--- a/src/protocols/core/Seat.hpp
+++ b/src/protocols/core/Seat.hpp
@@ -38,7 +38,7 @@ class CCursorSurfaceRole : public ISurfaceRole {
static std::vector<uint8_t>& cursorPixelData(SP<CWLSurfaceResource> surface);
private:
- std::vector<uint8_t> cursorShmPixelData;
+ std::vector<uint8_t> m_cursorShmPixelData;
};
class CWLTouchResource {
@@ -54,17 +54,17 @@ class CWLTouchResource {
void sendShape(int32_t id, const Vector2D& shape);
void sendOrientation(int32_t id, double angle);
- WP<CWLSeatResource> owner;
+ WP<CWLSeatResource> m_owner;
private:
- SP<CWlTouch> resource;
- WP<CWLSurfaceResource> currentSurface;
+ SP<CWlTouch> m_resource;
+ WP<CWLSurfaceResource> m_currentSurface;
- int fingers = 0;
+ int m_fingers = 0;
struct {
CHyprSignalListener destroySurface;
- } listeners;
+ } m_listeners;
};
class CWLPointerResource {
@@ -85,17 +85,17 @@ class CWLPointerResource {
void sendAxisValue120(wl_pointer_axis axis, int32_t value120);
void sendAxisRelativeDirection(wl_pointer_axis axis, wl_pointer_axis_relative_direction direction);
- WP<CWLSeatResource> owner;
+ WP<CWLSeatResource> m_owner;
private:
- SP<CWlPointer> resource;
- WP<CWLSurfaceResource> currentSurface;
+ SP<CWlPointer> m_resource;
+ WP<CWLSurfaceResource> m_currentSurface;
- std::vector<uint32_t> pressedButtons;
+ std::vector<uint32_t> m_pressedButtons;
struct {
CHyprSignalListener destroySurface;
- } listeners;
+ } m_listeners;
};
class CWLKeyboardResource {
@@ -110,19 +110,19 @@ class CWLKeyboardResource {
void sendMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group);
void repeatInfo(uint32_t rate, uint32_t delayMs);
- WP<CWLSeatResource> owner;
+ WP<CWLSeatResource> m_owner;
private:
- SP<CWlKeyboard> resource;
- WP<CWLSurfaceResource> currentSurface;
+ SP<CWlKeyboard> m_resource;
+ WP<CWLSurfaceResource> m_currentSurface;
struct {
CHyprSignalListener destroySurface;
- } listeners;
+ } m_listeners;
- std::string lastKeymap = "<none>";
- uint32_t lastRate = 0;
- uint32_t lastDelayMs = 0;
+ std::string m_lastKeymap = "<none>";
+ uint32_t m_lastRate = 0;
+ uint32_t m_lastDelayMs = 0;
};
class CWLSeatResource {
@@ -135,19 +135,19 @@ class CWLSeatResource {
bool good();
wl_client* client();
- std::vector<WP<CWLPointerResource>> pointers;
- std::vector<WP<CWLKeyboardResource>> keyboards;
- std::vector<WP<CWLTouchResource>> touches;
+ std::vector<WP<CWLPointerResource>> m_pointers;
+ std::vector<WP<CWLKeyboardResource>> m_keyboards;
+ std::vector<WP<CWLTouchResource>> m_touches;
- WP<CWLSeatResource> self;
+ WP<CWLSeatResource> m_self;
struct {
CSignal destroy;
- } events;
+ } m_events;
private:
- SP<CWlSeat> resource;
- wl_client* pClient = nullptr;
+ SP<CWlSeat> m_resource;
+ wl_client* m_client = nullptr;
};
class CWLSeatProtocol : public IWaylandProtocol {
@@ -158,7 +158,7 @@ class CWLSeatProtocol : public IWaylandProtocol {
struct {
CSignal newSeatResource; // SP<CWLSeatResource>
- } events;
+ } m_events;
private:
void updateCapabilities(uint32_t caps); // in IHID caps
@@ -171,15 +171,15 @@ class CWLSeatProtocol : public IWaylandProtocol {
void destroyResource(CWLPointerResource* resource);
//
- std::vector<SP<CWLSeatResource>> m_vSeatResources;
- std::vector<SP<CWLKeyboardResource>> m_vKeyboards;
- std::vector<SP<CWLTouchResource>> m_vTouches;
- std::vector<SP<CWLPointerResource>> m_vPointers;
+ std::vector<SP<CWLSeatResource>> m_seatResources;
+ std::vector<SP<CWLKeyboardResource>> m_keyboards;
+ std::vector<SP<CWLTouchResource>> m_touches;
+ std::vector<SP<CWLPointerResource>> m_pointers;
SP<CWLSeatResource> seatResourceForClient(wl_client* client);
//
- uint32_t currentCaps = 0;
+ uint32_t m_currentCaps = 0;
friend class CWLSeatResource;
friend class CWLKeyboardResource;
diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp
index 420b4a3f..6ebfa64f 100644
--- a/src/protocols/core/Shm.cpp
+++ b/src/protocols/core/Shm.cpp
@@ -10,22 +10,22 @@
using namespace Hyprutils::OS;
CWLSHMBuffer::CWLSHMBuffer(SP<CWLSHMPoolResource> pool_, uint32_t id, int32_t offset_, const Vector2D& size_, int32_t stride_, uint32_t fmt_) {
- if UNLIKELY (!pool_->pool->data)
+ if UNLIKELY (!pool_->m_pool->m_data)
return;
g_pHyprRenderer->makeEGLCurrent();
- size = size_;
- pool = pool_->pool;
- stride = stride_;
- fmt = fmt_;
- offset = offset_;
- opaque = NFormatUtils::isFormatOpaque(NFormatUtils::shmToDRM(fmt_));
+ size = size_;
+ m_pool = pool_->m_pool;
+ m_stride = stride_;
+ m_fmt = fmt_;
+ m_offset = offset_;
+ opaque = NFormatUtils::isFormatOpaque(NFormatUtils::shmToDRM(fmt_));
- resource = CWLBufferResource::create(makeShared<CWlBuffer>(pool_->resource->client(), 1, id));
+ resource = CWLBufferResource::create(makeShared<CWlBuffer>(pool_->m_resource->client(), 1, id));
- listeners.bufferResourceDestroy = events.destroy.registerListener([this](std::any d) {
- listeners.bufferResourceDestroy.reset();
+ m_listeners.bufferResourceDestroy = events.destroy.registerListener([this](std::any d) {
+ m_listeners.bufferResourceDestroy.reset();
PROTO::shm->destroyResource(this);
});
}
@@ -50,16 +50,16 @@ bool CWLSHMBuffer::isSynchronous() {
Aquamarine::SSHMAttrs CWLSHMBuffer::shm() {
Aquamarine::SSHMAttrs attrs;
attrs.success = true;
- attrs.fd = pool->fd.get();
- attrs.format = NFormatUtils::shmToDRM(fmt);
+ attrs.fd = m_pool->m_fd.get();
+ attrs.format = NFormatUtils::shmToDRM(m_fmt);
attrs.size = size;
- attrs.stride = stride;
- attrs.offset = offset;
+ attrs.stride = m_stride;
+ attrs.offset = m_offset;
return attrs;
}
std::tuple<uint8_t*, uint32_t, size_t> CWLSHMBuffer::beginDataPtr(uint32_t flags) {
- return {(uint8_t*)pool->data + offset, fmt, stride * size.y};
+ return {(uint8_t*)m_pool->m_data + m_offset, m_fmt, m_stride * size.y};
}
void CWLSHMBuffer::endDataPtr() {
@@ -74,24 +74,24 @@ void CWLSHMBuffer::update(const CRegion& damage) {
;
}
-CSHMPool::CSHMPool(CFileDescriptor fd_, size_t size_) : fd(std::move(fd_)), size(size_), data(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0)) {
+CSHMPool::CSHMPool(CFileDescriptor fd_, size_t size_) : m_fd(std::move(fd_)), m_size(size_), m_data(mmap(nullptr, m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd.get(), 0)) {
;
}
CSHMPool::~CSHMPool() {
- munmap(data, size);
+ munmap(m_data, m_size);
}
void CSHMPool::resize(size_t size_) {
- LOGM(LOG, "Resizing a SHM pool from {} to {}", size, size_);
+ LOGM(LOG, "Resizing a SHM pool from {} to {}", m_size, size_);
- if (data)
- munmap(data, size);
- size = size_;
- data = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0);
+ if (m_data)
+ munmap(m_data, m_size);
+ m_size = size_;
+ m_data = mmap(nullptr, m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd.get(), 0);
- if UNLIKELY (data == MAP_FAILED)
- LOGM(ERR, "Couldn't mmap {} bytes from fd {} of shm client", size, fd.get());
+ if UNLIKELY (m_data == MAP_FAILED)
+ LOGM(ERR, "Couldn't mmap {} bytes from fd {} of shm client", m_size, m_fd.get());
}
static int shmIsSizeValid(CFileDescriptor& fd, size_t size) {
@@ -104,7 +104,7 @@ static int shmIsSizeValid(CFileDescriptor& fd, size_t size) {
return (size_t)st.st_size >= size;
}
-CWLSHMPoolResource::CWLSHMPoolResource(SP<CWlShmPool> resource_, CFileDescriptor fd_, size_t size_) : resource(resource_) {
+CWLSHMPoolResource::CWLSHMPoolResource(SP<CWlShmPool> resource_, CFileDescriptor fd_, size_t size_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
@@ -113,31 +113,31 @@ CWLSHMPoolResource::CWLSHMPoolResource(SP<CWlShmPool> resource_, CFileDescriptor
return;
}
- pool = makeShared<CSHMPool>(std::move(fd_), size_);
+ m_pool = makeShared<CSHMPool>(std::move(fd_), size_);
- resource->setDestroy([this](CWlShmPool* r) { PROTO::shm->destroyResource(this); });
- resource->setOnDestroy([this](CWlShmPool* r) { PROTO::shm->destroyResource(this); });
+ m_resource->setDestroy([this](CWlShmPool* r) { PROTO::shm->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlShmPool* r) { PROTO::shm->destroyResource(this); });
- resource->setResize([this](CWlShmPool* r, int32_t size_) {
- if UNLIKELY (size_ < (int32_t)pool->size) {
+ m_resource->setResize([this](CWlShmPool* r, int32_t size_) {
+ if UNLIKELY (size_ < (int32_t)m_pool->m_size) {
r->error(-1, "Shrinking a shm pool is illegal");
return;
}
- if UNLIKELY (!shmIsSizeValid(pool->fd, size_)) {
+ if UNLIKELY (!shmIsSizeValid(m_pool->m_fd, size_)) {
r->error(-1, "The size of the file is not big enough for the shm pool");
return;
}
- pool->resize(size_);
+ m_pool->resize(size_);
});
- resource->setCreateBuffer([this](CWlShmPool* r, uint32_t id, int32_t offset, int32_t w, int32_t h, int32_t stride, uint32_t fmt) {
- if UNLIKELY (!pool || !pool->data) {
+ m_resource->setCreateBuffer([this](CWlShmPool* r, uint32_t id, int32_t offset, int32_t w, int32_t h, int32_t stride, uint32_t fmt) {
+ if UNLIKELY (!m_pool || !m_pool->m_data) {
r->error(-1, "The provided shm pool failed to allocate properly");
return;
}
- if UNLIKELY (std::find(PROTO::shm->shmFormats.begin(), PROTO::shm->shmFormats.end(), fmt) == PROTO::shm->shmFormats.end()) {
+ if UNLIKELY (std::find(PROTO::shm->m_shmFormats.begin(), PROTO::shm->m_shmFormats.end(), fmt) == PROTO::shm->m_shmFormats.end()) {
r->error(WL_SHM_ERROR_INVALID_FORMAT, "Format invalid");
return;
}
@@ -147,11 +147,11 @@ CWLSHMPoolResource::CWLSHMPoolResource(SP<CWlShmPool> resource_, CFileDescriptor
return;
}
- const auto RESOURCE = PROTO::shm->m_vBuffers.emplace_back(makeShared<CWLSHMBuffer>(self.lock(), id, offset, Vector2D{w, h}, stride, fmt));
+ const auto RESOURCE = PROTO::shm->m_buffers.emplace_back(makeShared<CWLSHMBuffer>(m_self.lock(), id, offset, Vector2D{w, h}, stride, fmt));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::shm->m_vBuffers.pop_back();
+ PROTO::shm->m_buffers.pop_back();
return;
}
@@ -159,41 +159,41 @@ CWLSHMPoolResource::CWLSHMPoolResource(SP<CWlShmPool> resource_, CFileDescriptor
RESOURCE->resource->buffer = RESOURCE;
});
- if UNLIKELY (pool->data == MAP_FAILED)
- resource->error(WL_SHM_ERROR_INVALID_FD, "Couldn't mmap from fd");
+ if UNLIKELY (m_pool->m_data == MAP_FAILED)
+ m_resource->error(WL_SHM_ERROR_INVALID_FD, "Couldn't mmap from fd");
}
bool CWLSHMPoolResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
-CWLSHMResource::CWLSHMResource(SP<CWlShm> resource_) : resource(resource_) {
+CWLSHMResource::CWLSHMResource(SP<CWlShm> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlShm* r) { PROTO::shm->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlShm* r) { PROTO::shm->destroyResource(this); });
- resource->setCreatePool([](CWlShm* r, uint32_t id, int32_t fd, int32_t size) {
+ m_resource->setCreatePool([](CWlShm* r, uint32_t id, int32_t fd, int32_t size) {
CFileDescriptor poolFd{fd};
- const auto RESOURCE = PROTO::shm->m_vPools.emplace_back(makeShared<CWLSHMPoolResource>(makeShared<CWlShmPool>(r->client(), r->version(), id), std::move(poolFd), size));
+ const auto RESOURCE = PROTO::shm->m_pools.emplace_back(makeShared<CWLSHMPoolResource>(makeShared<CWlShmPool>(r->client(), r->version(), id), std::move(poolFd), size));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::shm->m_vPools.pop_back();
+ PROTO::shm->m_pools.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
+ RESOURCE->m_self = RESOURCE;
});
// send a few supported formats. No need for any other I think?
- for (auto const& s : PROTO::shm->shmFormats) {
- resource->sendFormat((wl_shm_format)s);
+ for (auto const& s : PROTO::shm->m_shmFormats) {
+ m_resource->sendFormat((wl_shm_format)s);
}
}
bool CWLSHMResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
CWLSHMProtocol::CWLSHMProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
@@ -201,36 +201,36 @@ CWLSHMProtocol::CWLSHMProtocol(const wl_interface* iface, const int& ver, const
}
void CWLSHMProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- if (shmFormats.empty()) {
- shmFormats.push_back(WL_SHM_FORMAT_ARGB8888);
- shmFormats.push_back(WL_SHM_FORMAT_XRGB8888);
+ if (m_shmFormats.empty()) {
+ m_shmFormats.push_back(WL_SHM_FORMAT_ARGB8888);
+ m_shmFormats.push_back(WL_SHM_FORMAT_XRGB8888);
static const std::array<DRMFormat, 6> supportedShmFourccFormats = {
DRM_FORMAT_XBGR8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_XBGR2101010, DRM_FORMAT_ABGR2101010,
};
for (auto const& fmt : supportedShmFourccFormats) {
- shmFormats.push_back(fmt);
+ m_shmFormats.push_back(fmt);
}
}
- const auto RESOURCE = m_vManagers.emplace_back(makeShared<CWLSHMResource>(makeShared<CWlShm>(client, ver, id)));
+ const auto RESOURCE = m_managers.emplace_back(makeShared<CWLSHMResource>(makeShared<CWlShm>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vManagers.pop_back();
+ m_managers.pop_back();
return;
}
}
void CWLSHMProtocol::destroyResource(CWLSHMResource* resource) {
- std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_managers, [&](const auto& other) { return other.get() == resource; });
}
void CWLSHMProtocol::destroyResource(CWLSHMPoolResource* resource) {
- std::erase_if(m_vPools, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_pools, [&](const auto& other) { return other.get() == resource; });
}
void CWLSHMProtocol::destroyResource(CWLSHMBuffer* resource) {
- std::erase_if(m_vBuffers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_buffers, [&](const auto& other) { return other.get() == resource; });
}
diff --git a/src/protocols/core/Shm.hpp b/src/protocols/core/Shm.hpp
index 61b26f12..e504146d 100644
--- a/src/protocols/core/Shm.hpp
+++ b/src/protocols/core/Shm.hpp
@@ -23,9 +23,9 @@ class CSHMPool {
CSHMPool(Hyprutils::OS::CFileDescriptor fd, size_t size);
~CSHMPool();
- Hyprutils::OS::CFileDescriptor fd;
- size_t size = 0;
- void* data = nullptr;
+ Hyprutils::OS::CFileDescriptor m_fd;
+ size_t m_size = 0;
+ void* m_data = nullptr;
void resize(size_t size);
};
@@ -45,14 +45,15 @@ class CWLSHMBuffer : public IHLBuffer {
bool good();
- int32_t offset = 0, stride = 0;
- uint32_t fmt = 0;
- SP<CSHMPool> pool;
+ int32_t m_offset = 0;
+ int32_t m_stride = 0;
+ uint32_t m_fmt = 0;
+ SP<CSHMPool> m_pool;
private:
struct {
CHyprSignalListener bufferResourceDestroy;
- } listeners;
+ } m_listeners;
};
class CWLSHMPoolResource {
@@ -61,12 +62,12 @@ class CWLSHMPoolResource {
bool good();
- SP<CSHMPool> pool;
+ SP<CSHMPool> m_pool;
- WP<CWLSHMPoolResource> self;
+ WP<CWLSHMPoolResource> m_self;
private:
- SP<CWlShmPool> resource;
+ SP<CWlShmPool> m_resource;
friend class CWLSHMBuffer;
};
@@ -78,7 +79,7 @@ class CWLSHMResource {
bool good();
private:
- SP<CWlShm> resource;
+ SP<CWlShm> m_resource;
};
class CWLSHMProtocol : public IWaylandProtocol {
@@ -93,12 +94,12 @@ class CWLSHMProtocol : public IWaylandProtocol {
void destroyResource(CWLSHMBuffer* resource);
//
- std::vector<SP<CWLSHMResource>> m_vManagers;
- std::vector<SP<CWLSHMPoolResource>> m_vPools;
- std::vector<SP<CWLSHMBuffer>> m_vBuffers;
+ std::vector<SP<CWLSHMResource>> m_managers;
+ std::vector<SP<CWLSHMPoolResource>> m_pools;
+ std::vector<SP<CWLSHMBuffer>> m_buffers;
//
- std::vector<uint32_t> shmFormats;
+ std::vector<uint32_t> m_shmFormats;
friend class CWLSHMResource;
friend class CWLSHMPoolResource;
diff --git a/src/protocols/core/Subcompositor.cpp b/src/protocols/core/Subcompositor.cpp
index 82f4aedb..4111b5dc 100644
--- a/src/protocols/core/Subcompositor.cpp
+++ b/src/protocols/core/Subcompositor.cpp
@@ -3,154 +3,154 @@
#include <algorithm>
CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWLSurfaceResource> surface_, SP<CWLSurfaceResource> parent_) :
- surface(surface_), parent(parent_), resource(resource_) {
+ m_surface(surface_), m_parent(parent_), m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlSubsurface* r) { destroy(); });
- resource->setDestroy([this](CWlSubsurface* r) { destroy(); });
+ m_resource->setOnDestroy([this](CWlSubsurface* r) { destroy(); });
+ m_resource->setDestroy([this](CWlSubsurface* r) { destroy(); });
- resource->setSetPosition([this](CWlSubsurface* r, int32_t x, int32_t y) { position = {x, y}; });
+ m_resource->setSetPosition([this](CWlSubsurface* r, int32_t x, int32_t y) { m_position = {x, y}; });
- resource->setSetDesync([this](CWlSubsurface* r) { sync = false; });
- resource->setSetSync([this](CWlSubsurface* r) { sync = true; });
+ m_resource->setSetDesync([this](CWlSubsurface* r) { m_sync = false; });
+ m_resource->setSetSync([this](CWlSubsurface* r) { m_sync = true; });
- resource->setPlaceAbove([this](CWlSubsurface* r, wl_resource* surf) {
+ m_resource->setPlaceAbove([this](CWlSubsurface* r, wl_resource* surf) {
auto SURF = CWLSurfaceResource::fromResource(surf);
- if (!parent)
+ if (!m_parent)
return;
auto pushAboveIndex = [this](int idx) -> void {
- for (auto const& c : parent->subsurfaces) {
- if (c->zIndex >= idx)
- c->zIndex++;
+ for (auto const& c : m_parent->m_subsurfaces) {
+ if (c->m_zIndex >= idx)
+ c->m_zIndex++;
}
};
- std::erase_if(parent->subsurfaces, [this](const auto& e) { return e == self || !e; });
+ std::erase_if(m_parent->m_subsurfaces, [this](const auto& e) { return e == m_self || !e; });
- auto it = std::find(parent->subsurfaces.begin(), parent->subsurfaces.end(), SURF);
+ auto it = std::find(m_parent->m_subsurfaces.begin(), m_parent->m_subsurfaces.end(), SURF);
- if (it == parent->subsurfaces.end()) {
+ if (it == m_parent->m_subsurfaces.end()) {
LOGM(ERR, "Invalid surface reference in placeAbove, likely parent");
pushAboveIndex(1);
- parent->subsurfaces.emplace_back(self);
- zIndex = 1;
+ m_parent->m_subsurfaces.emplace_back(m_self);
+ m_zIndex = 1;
} else {
- pushAboveIndex((*it)->zIndex);
- zIndex = (*it)->zIndex;
- parent->subsurfaces.emplace_back(self);
+ pushAboveIndex((*it)->m_zIndex);
+ m_zIndex = (*it)->m_zIndex;
+ m_parent->m_subsurfaces.emplace_back(m_self);
}
- std::sort(parent->subsurfaces.begin(), parent->subsurfaces.end(), [](const auto& a, const auto& b) { return a->zIndex < b->zIndex; });
+ std::sort(m_parent->m_subsurfaces.begin(), m_parent->m_subsurfaces.end(), [](const auto& a, const auto& b) { return a->m_zIndex < b->m_zIndex; });
});
- resource->setPlaceBelow([this](CWlSubsurface* r, wl_resource* surf) {
+ m_resource->setPlaceBelow([this](CWlSubsurface* r, wl_resource* surf) {
auto SURF = CWLSurfaceResource::fromResource(surf);
- if (!parent)
+ if (!m_parent)
return;
auto pushBelowIndex = [this](int idx) -> void {
- for (auto const& c : parent->subsurfaces) {
- if (c->zIndex <= idx)
- c->zIndex--;
+ for (auto const& c : m_parent->m_subsurfaces) {
+ if (c->m_zIndex <= idx)
+ c->m_zIndex--;
}
};
- std::erase_if(parent->subsurfaces, [this](const auto& e) { return e == self || !e; });
+ std::erase_if(m_parent->m_subsurfaces, [this](const auto& e) { return e == m_self || !e; });
- auto it = std::find(parent->subsurfaces.begin(), parent->subsurfaces.end(), SURF);
+ auto it = std::find(m_parent->m_subsurfaces.begin(), m_parent->m_subsurfaces.end(), SURF);
- if (it == parent->subsurfaces.end()) {
+ if (it == m_parent->m_subsurfaces.end()) {
LOGM(ERR, "Invalid surface reference in placeBelow, likely parent");
pushBelowIndex(-1);
- parent->subsurfaces.emplace_back(self);
- zIndex = -1;
+ m_parent->m_subsurfaces.emplace_back(m_self);
+ m_zIndex = -1;
} else {
- pushBelowIndex((*it)->zIndex);
- zIndex = (*it)->zIndex;
- parent->subsurfaces.emplace_back(self);
+ pushBelowIndex((*it)->m_zIndex);
+ m_zIndex = (*it)->m_zIndex;
+ m_parent->m_subsurfaces.emplace_back(m_self);
}
- std::sort(parent->subsurfaces.begin(), parent->subsurfaces.end(), [](const auto& a, const auto& b) { return a->zIndex < b->zIndex; });
+ std::sort(m_parent->m_subsurfaces.begin(), m_parent->m_subsurfaces.end(), [](const auto& a, const auto& b) { return a->m_zIndex < b->m_zIndex; });
});
- listeners.commitSurface = surface->events.commit.registerListener([this](std::any d) {
- if (surface->current.texture && !surface->mapped) {
- surface->map();
- surface->events.map.emit();
+ m_listeners.commitSurface = m_surface->m_events.commit.registerListener([this](std::any d) {
+ if (m_surface->m_current.texture && !m_surface->m_mapped) {
+ m_surface->map();
+ m_surface->m_events.map.emit();
return;
}
- if (!surface->current.texture && surface->mapped) {
- surface->events.unmap.emit();
- surface->unmap();
+ if (!m_surface->m_current.texture && m_surface->m_mapped) {
+ m_surface->m_events.unmap.emit();
+ m_surface->unmap();
return;
}
});
}
CWLSubsurfaceResource::~CWLSubsurfaceResource() {
- events.destroy.emit();
- if (surface)
- surface->resetRole();
+ m_events.destroy.emit();
+ if (m_surface)
+ m_surface->resetRole();
}
void CWLSubsurfaceResource::destroy() {
- if (surface && surface->mapped) {
- surface->events.unmap.emit();
- surface->unmap();
+ if (m_surface && m_surface->m_mapped) {
+ m_surface->m_events.unmap.emit();
+ m_surface->unmap();
}
- events.destroy.emit();
+ m_events.destroy.emit();
PROTO::subcompositor->destroyResource(this);
}
Vector2D CWLSubsurfaceResource::posRelativeToParent() {
- Vector2D pos = position;
- SP<CWLSurfaceResource> surf = parent.lock();
+ Vector2D pos = m_position;
+ SP<CWLSurfaceResource> surf = m_parent.lock();
// some apps might create cycles, which I believe _technically_ are not a protocol error
// in some cases, notably firefox likes to do that, so we keep track of what
// surfaces we've visited and if we hit a surface we've visited we bail out.
std::vector<SP<CWLSurfaceResource>> surfacesVisited;
- while (surf->role->role() == SURFACE_ROLE_SUBSURFACE &&
+ while (surf->m_role->role() == SURFACE_ROLE_SUBSURFACE &&
std::find_if(surfacesVisited.begin(), surfacesVisited.end(), [surf](const auto& other) { return surf == other; }) == surfacesVisited.end()) {
surfacesVisited.emplace_back(surf);
- auto subsurface = ((CSubsurfaceRole*)parent->role.get())->subsurface.lock();
- pos += subsurface->position;
- surf = subsurface->parent.lock();
+ auto subsurface = ((CSubsurfaceRole*)m_parent->m_role.get())->m_subsurface.lock();
+ pos += subsurface->m_position;
+ surf = subsurface->m_parent.lock();
}
return pos;
}
bool CWLSubsurfaceResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
SP<CWLSurfaceResource> CWLSubsurfaceResource::t1Parent() {
- SP<CWLSurfaceResource> surf = parent.lock();
+ SP<CWLSurfaceResource> surf = m_parent.lock();
std::vector<SP<CWLSurfaceResource>> surfacesVisited;
- while (surf->role->role() == SURFACE_ROLE_SUBSURFACE &&
+ while (surf->m_role->role() == SURFACE_ROLE_SUBSURFACE &&
std::find_if(surfacesVisited.begin(), surfacesVisited.end(), [surf](const auto& other) { return surf == other; }) == surfacesVisited.end()) {
surfacesVisited.emplace_back(surf);
- auto subsurface = ((CSubsurfaceRole*)parent->role.get())->subsurface.lock();
- surf = subsurface->parent.lock();
+ auto subsurface = ((CSubsurfaceRole*)m_parent->m_role.get())->m_subsurface.lock();
+ surf = subsurface->m_parent.lock();
}
return surf;
}
-CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource_) : resource(resource_) {
+CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CWlSubcompositor* r) { PROTO::subcompositor->destroyResource(this); });
- resource->setDestroy([this](CWlSubcompositor* r) { PROTO::subcompositor->destroyResource(this); });
+ m_resource->setOnDestroy([this](CWlSubcompositor* r) { PROTO::subcompositor->destroyResource(this); });
+ m_resource->setDestroy([this](CWlSubcompositor* r) { PROTO::subcompositor->destroyResource(this); });
- resource->setGetSubsurface([](CWlSubcompositor* r, uint32_t id, wl_resource* surface, wl_resource* parent) {
+ m_resource->setGetSubsurface([](CWlSubcompositor* r, uint32_t id, wl_resource* surface, wl_resource* parent) {
auto SURF = CWLSurfaceResource::fromResource(surface);
auto PARENT = CWLSurfaceResource::fromResource(parent);
@@ -159,15 +159,15 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource
return;
}
- if UNLIKELY (SURF->role->role() != SURFACE_ROLE_UNASSIGNED) {
+ if UNLIKELY (SURF->m_role->role() != SURFACE_ROLE_UNASSIGNED) {
r->error(-1, "Surface already has a different role");
return;
}
SP<CWLSurfaceResource> t1Parent = nullptr;
- if (PARENT->role->role() == SURFACE_ROLE_SUBSURFACE) {
- auto subsurface = ((CSubsurfaceRole*)PARENT->role.get())->subsurface.lock();
+ if (PARENT->m_role->role() == SURFACE_ROLE_SUBSURFACE) {
+ auto subsurface = ((CSubsurfaceRole*)PARENT->m_role.get())->m_subsurface.lock();
t1Parent = subsurface->t1Parent();
} else
t1Parent = PARENT;
@@ -178,26 +178,26 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource
}
const auto RESOURCE =
- PROTO::subcompositor->m_vSurfaces.emplace_back(makeShared<CWLSubsurfaceResource>(makeShared<CWlSubsurface>(r->client(), r->version(), id), SURF, PARENT));
+ PROTO::subcompositor->m_surfaces.emplace_back(makeShared<CWLSubsurfaceResource>(makeShared<CWlSubsurface>(r->client(), r->version(), id), SURF, PARENT));
if UNLIKELY (!RESOURCE->good()) {
r->noMemory();
- PROTO::subcompositor->m_vSurfaces.pop_back();
+ PROTO::subcompositor->m_surfaces.pop_back();
return;
}
- RESOURCE->self = RESOURCE;
- SURF->role = makeShared<CSubsurfaceRole>(RESOURCE);
- PARENT->subsurfaces.emplace_back(RESOURCE);
+ RESOURCE->m_self = RESOURCE;
+ SURF->m_role = makeShared<CSubsurfaceRole>(RESOURCE);
+ PARENT->m_subsurfaces.emplace_back(RESOURCE);
LOGM(LOG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
- PARENT->events.newSubsurface.emit(RESOURCE);
+ PARENT->m_events.newSubsurface.emit(RESOURCE);
});
}
bool CWLSubcompositorResource::good() {
- return resource->resource();
+ return m_resource->resource();
}
CWLSubcompositorProtocol::CWLSubcompositorProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
@@ -205,23 +205,23 @@ CWLSubcompositorProtocol::CWLSubcompositorProtocol(const wl_interface* iface, co
}
void CWLSubcompositorProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto RESOURCE = m_vManagers.emplace_back(makeShared<CWLSubcompositorResource>(makeShared<CWlSubcompositor>(client, ver, id)));
+ const auto RESOURCE = m_managers.emplace_back(makeShared<CWLSubcompositorResource>(makeShared<CWlSubcompositor>(client, ver, id)));
if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
- m_vManagers.pop_back();
+ m_managers.pop_back();
return;
}
}
void CWLSubcompositorProtocol::destroyResource(CWLSubcompositorResource* resource) {
- std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_managers, [&](const auto& other) { return other.get() == resource; });
}
void CWLSubcompositorProtocol::destroyResource(CWLSubsurfaceResource* resource) {
- std::erase_if(m_vSurfaces, [&](const auto& other) { return other.get() == resource; });
+ std::erase_if(m_surfaces, [&](const auto& other) { return other.get() == resource; });
}
-CSubsurfaceRole::CSubsurfaceRole(SP<CWLSubsurfaceResource> sub) : subsurface(sub) {
+CSubsurfaceRole::CSubsurfaceRole(SP<CWLSubsurfaceResource> sub) : m_subsurface(sub) {
;
}
diff --git a/src/protocols/core/Subcompositor.hpp b/src/protocols/core/Subcompositor.hpp
index dc713044..cf7913ec 100644
--- a/src/protocols/core/Subcompositor.hpp
+++ b/src/protocols/core/Subcompositor.hpp
@@ -25,7 +25,7 @@ class CSubsurfaceRole : public ISurfaceRole {
return SURFACE_ROLE_SUBSURFACE;
}
- WP<CWLSubsurfaceResource> subsurface;
+ WP<CWLSubsurfaceResource> m_subsurface;
};
class CWLSubsurfaceResource {
@@ -37,28 +37,28 @@ class CWLSubsurfaceResource {
bool good();
SP<CWLSurfaceResource> t1Parent();
- bool sync = false;
- Vector2D position;
+ bool m_sync = false;
+ Vector2D m_position;
- WP<CWLSurfaceResource> surface;
- WP<CWLSurfaceResource> parent;
+ WP<CWLSurfaceResource> m_surface;
+ WP<CWLSurfaceResource> m_parent;
- WP<CWLSubsurfaceResource> self;
+ WP<CWLSubsurfaceResource> m_self;
- int zIndex = 1; // by default, it's above
+ int m_zIndex = 1; // by default, it's above
struct {
CSignal destroy;
- } events;
+ } m_events;
private:
- SP<CWlSubsurface> resource;
+ SP<CWlSubsurface> m_resource;
void destroy();
struct {
CHyprSignalListener commitSurface;
- } listeners;
+ } m_listeners;
};
class CWLSubcompositorResource {
@@ -68,7 +68,7 @@ class CWLSubcompositorResource {
bool good();
private:
- SP<CWlSubcompositor> resource;
+ SP<CWlSubcompositor> m_resource;
};
class CWLSubcompositorProtocol : public IWaylandProtocol {
@@ -82,8 +82,8 @@ class CWLSubcompositorProtocol : public IWaylandProtocol {
void destroyResource(CWLSubsurfaceResource* resource);
//
- std::vector<SP<CWLSubcompositorResource>> m_vManagers;
- std::vector<SP<CWLSubsurfaceResource>> m_vSurfaces;
+ std::vector<SP<CWLSubcompositorResource>> m_managers;
+ std::vector<SP<CWLSubsurfaceResource>> m_surfaces;
friend class CWLSubcompositorResource;
friend class CWLSubsurfaceResource;
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 31fd7b0a..c213f860 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -1568,7 +1568,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
}
const auto imageDescription =
- m_RenderData.surface.valid() && m_RenderData.surface->colorManagement.valid() ? m_RenderData.surface->colorManagement->imageDescription() : SImageDescription{};
+ m_RenderData.surface.valid() && m_RenderData.surface->m_colorManagement.valid() ? m_RenderData.surface->m_colorManagement->imageDescription() : SImageDescription{};
const bool skipCM = !*PENABLECM || !m_bCMSupported /* CM unsupported or disabled */
|| (imageDescription == m_RenderData.pMonitor->m_imageDescription) /* Source and target have the same image description */
@@ -2088,9 +2088,9 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
CRegion inverseOpaque;
- pixman_box32_t surfbox = {0, 0, PSURFACE->current.size.x, PSURFACE->current.size.y};
- CRegion opaqueRegion{PSURFACE->current.opaque};
- inverseOpaque.set(opaqueRegion).invert(&surfbox).intersect(0, 0, PSURFACE->current.size.x, PSURFACE->current.size.y);
+ pixman_box32_t surfbox = {0, 0, PSURFACE->m_current.size.x, PSURFACE->m_current.size.y};
+ CRegion opaqueRegion{PSURFACE->m_current.opaque};
+ inverseOpaque.set(opaqueRegion).invert(&surfbox).intersect(0, 0, PSURFACE->m_current.size.x, PSURFACE->m_current.size.y);
if (inverseOpaque.empty())
return false;
@@ -2224,11 +2224,11 @@ void CHyprOpenGLImpl::renderTextureWithBlur(SP<CTexture> tex, const CBox& box, f
// amazing hack: the surface has an opaque region!
CRegion inverseOpaque;
- if (a >= 1.f && std::round(pSurface->current.size.x * m_RenderData.pMonitor->m_scale) == box.w &&
- std::round(pSurface->current.size.y * m_RenderData.pMonitor->m_scale) == box.h) {
- pixman_box32_t surfbox = {0, 0, pSurface->current.size.x * pSurface->current.scale, pSurface->current.size.y * pSurface->current.scale};
- inverseOpaque = pSurface->current.opaque;
- inverseOpaque.invert(&surfbox).intersect(0, 0, pSurface->current.size.x * pSurface->current.scale, pSurface->current.size.y * pSurface->current.scale);
+ if (a >= 1.f && std::round(pSurface->m_current.size.x * m_RenderData.pMonitor->m_scale) == box.w &&
+ std::round(pSurface->m_current.size.y * m_RenderData.pMonitor->m_scale) == box.h) {
+ pixman_box32_t surfbox = {0, 0, pSurface->m_current.size.x * pSurface->m_current.scale, pSurface->m_current.size.y * pSurface->m_current.scale};
+ inverseOpaque = pSurface->m_current.opaque;
+ inverseOpaque.invert(&surfbox).intersect(0, 0, pSurface->m_current.size.x * pSurface->m_current.scale, pSurface->m_current.size.y * pSurface->m_current.scale);
if (inverseOpaque.empty()) {
renderTexture(tex, box, a, round, roundingPower, false, true);
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 15c52ba9..1b861f7a 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -589,7 +589,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
pWindow->m_wlSurface->resource()->breadthfirst(
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
- renderdata.texture = s->current.texture;
+ renderdata.texture = s->m_current.texture;
renderdata.surface = s;
renderdata.mainSurface = s == pWindow->m_wlSurface->resource();
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -657,7 +657,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
popup->m_wlSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
- renderdata.texture = s->current.texture;
+ renderdata.texture = s->m_current.texture;
renderdata.surface = s;
renderdata.mainSurface = false;
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -739,7 +739,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
pLayer->m_surface->resource()->breadthfirst(
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
- renderdata.texture = s->current.texture;
+ renderdata.texture = s->m_current.texture;
renderdata.surface = s;
renderdata.mainSurface = s == pLayer->m_surface->resource();
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -760,7 +760,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
Vector2D pos = popup->coordsRelativeToParent();
renderdata.localPos = pos;
- renderdata.texture = popup->m_wlSurface->resource()->current.texture;
+ renderdata.texture = popup->m_wlSurface->resource()->m_current.texture;
renderdata.surface = popup->m_wlSurface->resource();
renderdata.mainSurface = false;
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -779,8 +779,8 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, con
renderdata.surface = SURF;
renderdata.decorate = false;
- renderdata.w = SURF->current.size.x;
- renderdata.h = SURF->current.size.y;
+ renderdata.w = SURF->m_current.size.x;
+ renderdata.h = SURF->m_current.size.y;
static auto PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
static auto PBLURIMES = CConfigValue<Hyprlang::INT>("decoration:blur:input_methods");
@@ -795,7 +795,7 @@ void CHyprRenderer::renderIMEPopup(CInputPopup* pPopup, PHLMONITOR pMonitor, con
SURF->breadthfirst(
[this, &renderdata, &SURF](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
- renderdata.texture = s->current.texture;
+ renderdata.texture = s->m_current.texture;
renderdata.surface = s;
renderdata.mainSurface = s == SURF;
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -816,7 +816,7 @@ void CHyprRenderer::renderSessionLockSurface(WP<SSessionLockSurface> pSurface, P
renderdata.surface->breadthfirst(
[this, &renderdata, &pSurface](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
renderdata.localPos = offset;
- renderdata.texture = s->current.texture;
+ renderdata.texture = s->m_current.texture;
renderdata.surface = s;
renderdata.mainSurface = s == pSurface->surface->surface();
m_sRenderPass.add(makeShared<CSurfacePassElement>(renderdata));
@@ -1053,10 +1053,10 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
Vector2D uvTL;
Vector2D uvBR = Vector2D(1, 1);
- if (pSurface->current.viewport.hasSource) {
+ if (pSurface->m_current.viewport.hasSource) {
// we stretch it to dest. if no dest, to 1,1
- Vector2D const& bufferSize = pSurface->current.bufferSize;
- auto const& bufferSource = pSurface->current.viewport.source;
+ Vector2D const& bufferSize = pSurface->m_current.bufferSize;
+ auto const& bufferSource = pSurface->m_current.viewport.source;
// calculate UV for the basic src_box. Assume dest == size. Scale to dest later
uvTL = Vector2D(bufferSource.x / bufferSize.x, bufferSource.y / bufferSize.y);
@@ -1071,8 +1071,8 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
if (projSize != Vector2D{} && fixMisalignedFSV1) {
// instead of nearest_neighbor (we will repeat / skip)
// just cut off / expand surface
- const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->current.bufferSize;
- const Vector2D MISALIGNMENT = pSurface->current.bufferSize - projSize;
+ const Vector2D PIXELASUV = Vector2D{1, 1} / pSurface->m_current.bufferSize;
+ const Vector2D MISALIGNMENT = pSurface->m_current.bufferSize - projSize;
if (MISALIGNMENT != Vector2D{})
uvBR -= MISALIGNMENT * PIXELASUV;
}
@@ -1083,9 +1083,10 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
// there is no way to fix this if that's the case
if (*PEXPANDEDGES) {
const auto MONITOR_WL_SCALE = std::ceil(pMonitor->m_scale);
- const bool SCALE_UNAWARE = MONITOR_WL_SCALE != pSurface->current.scale && !pSurface->current.viewport.hasDestination;
+ const bool SCALE_UNAWARE = MONITOR_WL_SCALE != pSurface->m_current.scale && !pSurface->m_current.viewport.hasDestination;
const auto EXPECTED_SIZE =
- ((pSurface->current.viewport.hasDestination ? pSurface->current.viewport.destination : pSurface->current.bufferSize / pSurface->current.scale) * pMonitor->m_scale)
+ ((pSurface->m_current.viewport.hasDestination ? pSurface->m_current.viewport.destination : pSurface->m_current.bufferSize / pSurface->m_current.scale) *
+ pMonitor->m_scale)
.round();
if (!SCALE_UNAWARE && (EXPECTED_SIZE.x < projSize.x || EXPECTED_SIZE.y < projSize.y)) {
// this will not work with shm AFAIK, idk why.
@@ -1111,10 +1112,10 @@ void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, SP<CWLSurfaceResour
// ignore X and Y, adjust uv
if (geom.x != 0 || geom.y != 0 || geom.width > projSizeUnscaled.x || geom.height > projSizeUnscaled.y) {
- const auto XPERC = (double)geom.x / (double)pSurface->current.size.x;
- const auto YPERC = (double)geom.y / (double)pSurface->current.size.y;
- const auto WPERC = (double)(geom.x + geom.width) / (double)pSurface->current.size.x;
- const auto HPERC = (double)(geom.y + geom.height) / (double)pSurface->current.size.y;
+ const auto XPERC = (double)geom.x / (double)pSurface->m_current.size.x;
+ const auto YPERC = (double)geom.y / (double)pSurface->m_current.size.y;
+ const auto WPERC = (double)(geom.x + geom.width) / (double)pSurface->m_current.size.x;
+ const auto HPERC = (double)(geom.y + geom.height) / (double)pSurface->m_current.size.y;
const auto TOADDTL = Vector2D(XPERC * (uvBR.x - uvTL.x), YPERC * (uvBR.y - uvTL.y));
uvBR = uvBR - Vector2D((1.0 - WPERC) * (uvBR.x - uvTL.x), (1.0 - HPERC) * (uvBR.y - uvTL.y));
@@ -1501,18 +1502,18 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
const auto WINDOW = pMonitor->m_activeWorkspace->getFullscreenWindow();
const auto ROOT_SURF = WINDOW->m_wlSurface->resource();
const auto SURF =
- ROOT_SURF->findFirstPreorder([ROOT_SURF](SP<CWLSurfaceResource> surf) { return surf->colorManagement.valid() && surf->extends() == ROOT_SURF->extends(); });
+ ROOT_SURF->findFirstPreorder([ROOT_SURF](SP<CWLSurfaceResource> surf) { return surf->m_colorManagement.valid() && surf->extends() == ROOT_SURF->extends(); });
wantHDR = PHDR && *PPASS == 2;
// we have a surface with image description and it's allowed by wantHDR
- if (SURF && SURF->colorManagement.valid() && SURF->colorManagement->hasImageDescription() &&
- (!wantHDR || SURF->colorManagement->imageDescription().transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ)) {
- bool needsHdrMetadataUpdate = SURF->colorManagement->needsHdrMetadataUpdate() || pMonitor->m_previousFSWindow != WINDOW;
- if (SURF->colorManagement->needsHdrMetadataUpdate())
- SURF->colorManagement->setHDRMetadata(createHDRMetadata(SURF->colorManagement->imageDescription(), pMonitor->m_output->parsedEDID));
+ if (SURF && SURF->m_colorManagement.valid() && SURF->m_colorManagement->hasImageDescription() &&
+ (!wantHDR || SURF->m_colorManagement->imageDescription().transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ)) {
+ bool needsHdrMetadataUpdate = SURF->m_colorManagement->needsHdrMetadataUpdate() || pMonitor->m_previousFSWindow != WINDOW;
+ if (SURF->m_colorManagement->needsHdrMetadataUpdate())
+ SURF->m_colorManagement->setHDRMetadata(createHDRMetadata(SURF->m_colorManagement->imageDescription(), pMonitor->m_output->parsedEDID));
if (needsHdrMetadataUpdate)
- pMonitor->m_output->state->setHDRMetadata(SURF->colorManagement->hdrMetadata());
+ pMonitor->m_output->state->setHDRMetadata(SURF->m_colorManagement->hdrMetadata());
hdrIsHandled = true;
}
diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp
index 8897be33..925a30b4 100644
--- a/src/render/pass/Pass.cpp
+++ b/src/render/pass/Pass.cpp
@@ -244,13 +244,13 @@ void CRenderPass::renderDebugData() {
renderHLSurface(debugData.lastWindowText, g_pCompositor->m_lastWindow->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
if (g_pSeatManager->m_state.pointerFocus) {
- if (g_pSeatManager->m_state.pointerFocus->current.input.intersect(CBox{{}, g_pSeatManager->m_state.pointerFocus->current.size}).getExtents().size() !=
- g_pSeatManager->m_state.pointerFocus->current.size) {
+ if (g_pSeatManager->m_state.pointerFocus->m_current.input.intersect(CBox{{}, g_pSeatManager->m_state.pointerFocus->m_current.size}).getExtents().size() !=
+ g_pSeatManager->m_state.pointerFocus->m_current.size) {
auto hlSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (hlSurface) {
auto BOX = hlSurface->getSurfaceBoxGlobal();
if (BOX) {
- auto region = g_pSeatManager->m_state.pointerFocus->current.input.copy()
+ auto region = g_pSeatManager->m_state.pointerFocus->m_current.input.copy()
.scale(g_pHyprOpenGL->m_RenderData.pMonitor->m_scale)
.translate(BOX->pos() - g_pHyprOpenGL->m_RenderData.pMonitor->m_position);
g_pHyprOpenGL->renderRectWithDamage(box, CHyprColor{0.8F, 0.8F, 0.2F, 0.4F}, region);
diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp
index 3813e714..ade9277c 100644
--- a/src/render/pass/SurfacePassElement.cpp
+++ b/src/render/pass/SurfacePassElement.cpp
@@ -72,12 +72,12 @@ void CSurfacePassElement::draw(const CRegion& damage) {
return;
}
- const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->m_scale) != data.pMonitor->m_scale /* Fractional */ && data.surface->current.scale == 1 /* fs protocol */ &&
- windowBox.size() != data.surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->current.bufferSize.x, 3) &&
- DELTALESSTHAN(windowBox.height, data.surface->current.bufferSize.y, 3) /* off by one-or-two */ &&
+ const bool MISALIGNEDFSV1 = std::floor(data.pMonitor->m_scale) != data.pMonitor->m_scale /* Fractional */ && data.surface->m_current.scale == 1 /* fs protocol */ &&
+ windowBox.size() != data.surface->m_current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, data.surface->m_current.bufferSize.x, 3) &&
+ DELTALESSTHAN(windowBox.height, data.surface->m_current.bufferSize.y, 3) /* off by one-or-two */ &&
(!data.pWindow || (!data.pWindow->m_realSize->isBeingAnimated() && !INTERACTIVERESIZEINPROGRESS)) /* not window or not animated/resizing */;
- if (data.surface->colorManagement.valid())
+ if (data.surface->m_colorManagement.valid())
Debug::log(TRACE, "FIXME: rendering surface with color management enabled, should apply necessary transformations");
g_pHyprRenderer->calculateUVForSurface(data.pWindow, data.surface, data.pMonitor->m_self.lock(), data.mainSurface, windowBox.size(), PROJSIZEUNSCALED, MISALIGNEDFSV1);
@@ -131,8 +131,8 @@ void CSurfacePassElement::draw(const CRegion& damage) {
// add async (dmabuf) buffers to usedBuffers so we can handle release later
// sync (shm) buffers will be released in commitState, so no need to track them here
- if (data.surface->current.buffer && !data.surface->current.buffer->isSynchronous())
- g_pHyprRenderer->usedAsyncBuffers.emplace_back(data.surface->current.buffer);
+ if (data.surface->m_current.buffer && !data.surface->m_current.buffer->isSynchronous())
+ g_pHyprRenderer->usedAsyncBuffers.emplace_back(data.surface->m_current.buffer);
g_pHyprOpenGL->blend(true);
}
@@ -167,8 +167,8 @@ CBox CSurfacePassElement::getTexBox() {
}
} else { // here we clamp to 2, these might be some tiny specks
- windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, std::max((float)data.surface->current.size.x, 2.F),
- std::max((float)data.surface->current.size.y, 2.F)};
+ windowBox = {(int)outputX + data.pos.x + data.localPos.x, (int)outputY + data.pos.y + data.localPos.y, std::max((float)data.surface->m_current.size.x, 2.F),
+ std::max((float)data.surface->m_current.size.y, 2.F)};
if (data.pWindow && data.pWindow->m_realSize->isBeingAnimated() && data.surface && !data.mainSurface && data.squishOversized /* subsurface */) {
// adjust subsurfaces to the window
windowBox.width = (windowBox.width / data.pWindow->m_reportedSize.x) * data.pWindow->m_realSize->value().x;
@@ -226,8 +226,8 @@ CRegion CSurfacePassElement::opaqueRegion() {
if (ALPHA < 1.F)
return {};
- if (data.surface && data.surface->current.size == Vector2D{data.w, data.h}) {
- CRegion opaqueSurf = data.surface->current.opaque.copy().intersect(CBox{{}, {data.w, data.h}});
+ if (data.surface && data.surface->m_current.size == Vector2D{data.w, data.h}) {
+ CRegion opaqueSurf = data.surface->m_current.opaque.copy().intersect(CBox{{}, {data.w, data.h}});
const auto texBox = getTexBox();
opaqueSurf.scale(texBox.size() / Vector2D{data.w, data.h});
return opaqueSurf.translate(data.pos + data.localPos - data.pMonitor->m_position).expand(-data.rounding);
@@ -241,7 +241,7 @@ CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
if (!PSURFACE)
return {};
- const auto& bufferSize = data.surface->current.bufferSize;
+ const auto& bufferSize = data.surface->m_current.bufferSize;
auto visibleRegion = PSURFACE->m_visibleRegion.copy();
if (visibleRegion.empty())
diff --git a/src/xwayland/XSurface.cpp b/src/xwayland/XSurface.cpp
index 1ef1c673..89c65473 100644
--- a/src/xwayland/XSurface.cpp
+++ b/src/xwayland/XSurface.cpp
@@ -52,7 +52,7 @@ void CXWaylandSurface::ensureListeners() {
listeners.destroySurface.reset();
listeners.commitSurface.reset();
} else if (!connected && surface) {
- listeners.destroySurface = surface->events.destroy.registerListener([this](std::any d) {
+ listeners.destroySurface = surface->m_events.destroy.registerListener([this](std::any d) {
if (mapped)
unmap();
@@ -62,13 +62,13 @@ void CXWaylandSurface::ensureListeners() {
events.resourceChange.emit();
});
- listeners.commitSurface = surface->events.commit.registerListener([this](std::any d) {
- if (surface->current.texture && !mapped) {
+ listeners.commitSurface = surface->m_events.commit.registerListener([this](std::any d) {
+ if (surface->m_current.texture && !mapped) {
map();
return;
}
- if (!surface->current.texture && mapped) {
+ if (!surface->m_current.texture && mapped) {
unmap();
return;
}
@@ -132,7 +132,7 @@ void CXWaylandSurface::considerMap() {
return;
}
- if (surface->current.texture) {
+ if (surface->m_current.texture) {
Debug::log(LOG, "XWayland surface: considerMap, sure, we have a buffer");
map();
return;
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 1c0e8ff4..6a0b1c84 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -957,7 +957,7 @@ CXWM::CXWM() : connection(g_pXWayland->pServer->xwmFDs[0].get()) {
setActiveWindow(XCB_WINDOW_NONE);
initSelection();
- listeners.newWLSurface = PROTO::compositor->events.newSurface.registerListener([this](std::any d) { onNewSurface(std::any_cast<SP<CWLSurfaceResource>>(d)); });
+ listeners.newWLSurface = PROTO::compositor->m_events.newSurface.registerListener([this](std::any d) { onNewSurface(std::any_cast<SP<CWLSurfaceResource>>(d)); });
listeners.newXShellSurface = PROTO::xwaylandShell->events.newSurface.registerListener([this](std::any d) { onNewResource(std::any_cast<SP<CXWaylandSurfaceResource>>(d)); });
createWMWindow();