summaryrefslogtreecommitdiff
path: root/src/protocols/ToplevelExport.cpp
diff options
context:
space:
mode:
authordavc0n <dconti.dev@gmail.com>2025-05-04 19:21:36 +0200
committerGitHub <noreply@github.com>2025-05-04 19:21:36 +0200
commit2626f89ea6fe0df585df28052bf1fcca2c50fe8e (patch)
tree6dd030f42e065e1a927ab907222e1efaf21b0bc1 /src/protocols/ToplevelExport.cpp
parentadbae0f74d951e06c575bad3c81a944027dfe413 (diff)
protocols: refactor class member vars (n-t) (#10273)
Diffstat (limited to 'src/protocols/ToplevelExport.cpp')
-rw-r--r--src/protocols/ToplevelExport.cpp252
1 files changed, 126 insertions, 126 deletions
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index fd5d0b27..04781a9b 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -14,120 +14,120 @@
#include <algorithm>
#include <hyprutils/math/Vector2D.hpp>
-CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1> resource_) : resource(resource_) {
+CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1> resource_) : m_resource(resource_) {
if UNLIKELY (!good())
return;
- resource->setOnDestroy([this](CHyprlandToplevelExportManagerV1* pMgr) { PROTO::toplevelExport->destroyResource(this); });
- resource->setDestroy([this](CHyprlandToplevelExportManagerV1* pMgr) { PROTO::toplevelExport->destroyResource(this); });
- resource->setCaptureToplevel([this](CHyprlandToplevelExportManagerV1* pMgr, uint32_t frame, int32_t overlayCursor, uint32_t handle) {
+ m_resource->setOnDestroy([this](CHyprlandToplevelExportManagerV1* pMgr) { PROTO::toplevelExport->destroyResource(this); });
+ m_resource->setDestroy([this](CHyprlandToplevelExportManagerV1* pMgr) { PROTO::toplevelExport->destroyResource(this); });
+ m_resource->setCaptureToplevel([this](CHyprlandToplevelExportManagerV1* pMgr, uint32_t frame, int32_t overlayCursor, uint32_t handle) {
this->captureToplevel(pMgr, frame, overlayCursor, g_pCompositor->getWindowFromHandle(handle));
});
- resource->setCaptureToplevelWithWlrToplevelHandle([this](CHyprlandToplevelExportManagerV1* pMgr, uint32_t frame, int32_t overlayCursor, wl_resource* handle) {
+ m_resource->setCaptureToplevelWithWlrToplevelHandle([this](CHyprlandToplevelExportManagerV1* pMgr, uint32_t frame, int32_t overlayCursor, wl_resource* handle) {
this->captureToplevel(pMgr, frame, overlayCursor, PROTO::foreignToplevelWlr->windowFromHandleResource(handle));
});
- lastMeasure.reset();
- lastFrame.reset();
- tickCallback = g_pHookSystem->hookDynamic("tick", [&](void* self, SCallbackInfo& info, std::any data) { onTick(); });
+ m_lastMeasure.reset();
+ m_lastFrame.reset();
+ m_tickCallback = g_pHookSystem->hookDynamic("tick", [&](void* self, SCallbackInfo& info, std::any data) { onTick(); });
}
void CToplevelExportClient::captureToplevel(CHyprlandToplevelExportManagerV1* pMgr, uint32_t frame, int32_t overlayCursor_, PHLWINDOW handle) {
// create a frame
- const auto FRAME = PROTO::toplevelExport->m_vFrames.emplace_back(
- makeShared<CToplevelExportFrame>(makeShared<CHyprlandToplevelExportFrameV1>(resource->client(), resource->version(), frame), overlayCursor_, handle));
+ const auto FRAME = PROTO::toplevelExport->m_frames.emplace_back(
+ makeShared<CToplevelExportFrame>(makeShared<CHyprlandToplevelExportFrameV1>(m_resource->client(), m_resource->version(), frame), overlayCursor_, handle));
if UNLIKELY (!FRAME->good()) {
LOGM(ERR, "Couldn't alloc frame for sharing! (no memory)");
- resource->noMemory();
+ m_resource->noMemory();
PROTO::toplevelExport->destroyResource(FRAME.get());
return;
}
- FRAME->self = FRAME;
- FRAME->client = self;
+ FRAME->m_self = FRAME;
+ FRAME->m_client = m_self;
}
void CToplevelExportClient::onTick() {
- if (lastMeasure.getMillis() < 500)
+ if (m_lastMeasure.getMillis() < 500)
return;
- framesInLastHalfSecond = frameCounter;
- frameCounter = 0;
- lastMeasure.reset();
-
- const auto LASTFRAMEDELTA = lastFrame.getMillis() / 1000.0;
- const bool FRAMEAWAITING = std::ranges::any_of(PROTO::toplevelExport->m_vFrames, [&](const auto& frame) { return frame->client.get() == this; });
-
- if (framesInLastHalfSecond > 3 && !sentScreencast) {
- EMIT_HOOK_EVENT("screencast", (std::vector<uint64_t>{1, (uint64_t)framesInLastHalfSecond, (uint64_t)clientOwner}));
- g_pEventManager->postEvent(SHyprIPCEvent{"screencast", "1," + std::to_string(clientOwner)});
- sentScreencast = true;
- } else if (framesInLastHalfSecond < 4 && sentScreencast && LASTFRAMEDELTA > 1.0 && !FRAMEAWAITING) {
- EMIT_HOOK_EVENT("screencast", (std::vector<uint64_t>{0, (uint64_t)framesInLastHalfSecond, (uint64_t)clientOwner}));
- g_pEventManager->postEvent(SHyprIPCEvent{"screencast", "0," + std::to_string(clientOwner)});
- sentScreencast = false;
+ m_framesInLastHalfSecond = m_frameCounter;
+ m_frameCounter = 0;
+ m_lastMeasure.reset();
+
+ const auto LASTFRAMEDELTA = m_lastFrame.getMillis() / 1000.0;
+ const bool FRAMEAWAITING = std::ranges::any_of(PROTO::toplevelExport->m_frames, [&](const auto& frame) { return frame->m_client.get() == this; });
+
+ if (m_framesInLastHalfSecond > 3 && !m_sentScreencast) {
+ EMIT_HOOK_EVENT("screencast", (std::vector<uint64_t>{1, (uint64_t)m_framesInLastHalfSecond, (uint64_t)m_clientOwner}));
+ g_pEventManager->postEvent(SHyprIPCEvent{"screencast", "1," + std::to_string(m_clientOwner)});
+ m_sentScreencast = true;
+ } else if (m_framesInLastHalfSecond < 4 && m_sentScreencast && LASTFRAMEDELTA > 1.0 && !FRAMEAWAITING) {
+ EMIT_HOOK_EVENT("screencast", (std::vector<uint64_t>{0, (uint64_t)m_framesInLastHalfSecond, (uint64_t)m_clientOwner}));
+ g_pEventManager->postEvent(SHyprIPCEvent{"screencast", "0," + std::to_string(m_clientOwner)});
+ m_sentScreencast = false;
}
}
bool CToplevelExportClient::good() {
- return resource->resource();
+ return m_resource->resource();
}
-CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> resource_, int32_t overlayCursor_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
+CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> resource_, int32_t overlayCursor_, PHLWINDOW pWindow_) : m_resource(resource_), m_window(pWindow_) {
if UNLIKELY (!good())
return;
- cursorOverlayRequested = !!overlayCursor_;
+ m_cursorOverlayRequested = !!overlayCursor_;
- if UNLIKELY (!pWindow) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which does not exist!", pWindow);
- resource->sendFailed();
+ if UNLIKELY (!m_window) {
+ LOGM(ERR, "Client requested sharing of window handle {:x} which does not exist!", m_window);
+ m_resource->sendFailed();
return;
}
- if UNLIKELY (!pWindow->m_isMapped) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable!", pWindow);
- resource->sendFailed();
+ if UNLIKELY (!m_window->m_isMapped) {
+ LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable!", m_window);
+ m_resource->sendFailed();
return;
}
- resource->setOnDestroy([this](CHyprlandToplevelExportFrameV1* pFrame) { PROTO::toplevelExport->destroyResource(this); });
- resource->setDestroy([this](CHyprlandToplevelExportFrameV1* pFrame) { PROTO::toplevelExport->destroyResource(this); });
- resource->setCopy([this](CHyprlandToplevelExportFrameV1* pFrame, wl_resource* res, int32_t ignoreDamage) { this->copy(pFrame, res, ignoreDamage); });
+ m_resource->setOnDestroy([this](CHyprlandToplevelExportFrameV1* pFrame) { PROTO::toplevelExport->destroyResource(this); });
+ m_resource->setDestroy([this](CHyprlandToplevelExportFrameV1* pFrame) { PROTO::toplevelExport->destroyResource(this); });
+ m_resource->setCopy([this](CHyprlandToplevelExportFrameV1* pFrame, wl_resource* res, int32_t ignoreDamage) { this->copy(pFrame, res, ignoreDamage); });
- const auto PMONITOR = pWindow->m_monitor.lock();
+ const auto PMONITOR = m_window->m_monitor.lock();
g_pHyprRenderer->makeEGLCurrent();
- shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
- if UNLIKELY (shmFormat == DRM_FORMAT_INVALID) {
+ m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR);
+ if UNLIKELY (m_shmFormat == DRM_FORMAT_INVALID) {
LOGM(ERR, "No format supported by renderer in capture toplevel");
- resource->sendFailed();
+ m_resource->sendFailed();
return;
}
- const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(shmFormat);
+ const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(m_shmFormat);
if UNLIKELY (!PSHMINFO) {
LOGM(ERR, "No pixel format supported by renderer in capture toplevel");
- resource->sendFailed();
+ m_resource->sendFailed();
return;
}
- dmabufFormat = PMONITOR->m_output->state->state().drmFormat;
+ m_dmabufFormat = PMONITOR->m_output->state->state().drmFormat;
- box = {0, 0, (int)(pWindow->m_realSize->value().x * PMONITOR->m_scale), (int)(pWindow->m_realSize->value().y * PMONITOR->m_scale)};
+ m_box = {0, 0, (int)(m_window->m_realSize->value().x * PMONITOR->m_scale), (int)(m_window->m_realSize->value().y * PMONITOR->m_scale)};
- box.transform(wlTransformToHyprutils(PMONITOR->m_transform), PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y).round();
+ m_box.transform(wlTransformToHyprutils(PMONITOR->m_transform), PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y).round();
- shmStride = NFormatUtils::minStride(PSHMINFO, box.w);
+ m_shmStride = NFormatUtils::minStride(PSHMINFO, m_box.w);
- resource->sendBuffer(NFormatUtils::drmToShm(shmFormat), box.width, box.height, shmStride);
+ m_resource->sendBuffer(NFormatUtils::drmToShm(m_shmFormat), m_box.width, m_box.height, m_shmStride);
- if LIKELY (dmabufFormat != DRM_FORMAT_INVALID)
- resource->sendLinuxDmabuf(dmabufFormat, box.width, box.height);
+ if LIKELY (m_dmabufFormat != DRM_FORMAT_INVALID)
+ m_resource->sendLinuxDmabuf(m_dmabufFormat, m_box.width, m_box.height);
- resource->sendBufferDone();
+ m_resource->sendBufferDone();
}
void CToplevelExportFrame::copy(CHyprlandToplevelExportFrameV1* pFrame, wl_resource* buffer_, int32_t ignoreDamage) {
@@ -136,106 +136,106 @@ void CToplevelExportFrame::copy(CHyprlandToplevelExportFrameV1* pFrame, wl_resou
return;
}
- if UNLIKELY (!validMapped(pWindow)) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is gone!", pWindow);
- resource->sendFailed();
+ if UNLIKELY (!validMapped(m_window)) {
+ LOGM(ERR, "Client requested sharing of window handle {:x} which is gone!", m_window);
+ m_resource->sendFailed();
return;
}
- if UNLIKELY (!pWindow->m_isMapped) {
- LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", pWindow);
- resource->sendFailed();
+ if UNLIKELY (!m_window->m_isMapped) {
+ LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", m_window);
+ m_resource->sendFailed();
return;
}
const auto PBUFFER = CWLBufferResource::fromResource(buffer_);
if UNLIKELY (!PBUFFER) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer");
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer");
PROTO::toplevelExport->destroyResource(this);
return;
}
- if UNLIKELY (PBUFFER->m_buffer->size != box.size()) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer dimensions");
+ if UNLIKELY (PBUFFER->m_buffer->size != m_box.size()) {
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer dimensions");
PROTO::toplevelExport->destroyResource(this);
return;
}
- if UNLIKELY (buffer) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_ALREADY_USED, "frame already used");
+ if UNLIKELY (m_buffer) {
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_ALREADY_USED, "frame already used");
PROTO::toplevelExport->destroyResource(this);
return;
}
if (auto attrs = PBUFFER->m_buffer->dmabuf(); attrs.success) {
- bufferDMA = true;
+ m_bufferDMA = true;
- if (attrs.format != dmabufFormat) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
+ if (attrs.format != m_dmabufFormat) {
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
PROTO::toplevelExport->destroyResource(this);
return;
}
} else if (auto attrs = PBUFFER->m_buffer->shm(); attrs.success) {
- if (attrs.format != shmFormat) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
+ if (attrs.format != m_shmFormat) {
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format");
PROTO::toplevelExport->destroyResource(this);
return;
- } else if ((int)attrs.stride != shmStride) {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer stride");
+ } else if ((int)attrs.stride != m_shmStride) {
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer stride");
PROTO::toplevelExport->destroyResource(this);
return;
}
} else {
- resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer type");
+ m_resource->error(HYPRLAND_TOPLEVEL_EXPORT_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer type");
PROTO::toplevelExport->destroyResource(this);
return;
}
- buffer = CHLBufferReference(PBUFFER->m_buffer.lock());
+ m_buffer = CHLBufferReference(PBUFFER->m_buffer.lock());
m_ignoreDamage = ignoreDamage;
- if (ignoreDamage && validMapped(pWindow))
+ if (ignoreDamage && validMapped(m_window))
share();
else
- PROTO::toplevelExport->m_vFramesAwaitingWrite.emplace_back(self);
+ PROTO::toplevelExport->m_framesAwaitingWrite.emplace_back(m_self);
}
void CToplevelExportFrame::share() {
- if (!buffer || !validMapped(pWindow))
+ if (!m_buffer || !validMapped(m_window))
return;
- if (bufferDMA) {
+ if (m_bufferDMA) {
if (!copyDmabuf(Time::steadyNow())) {
- resource->sendFailed();
+ m_resource->sendFailed();
return;
}
} else {
if (!copyShm(Time::steadyNow())) {
- resource->sendFailed();
+ m_resource->sendFailed();
return;
}
}
- resource->sendFlags((hyprlandToplevelExportFrameV1Flags)0);
+ m_resource->sendFlags((hyprlandToplevelExportFrameV1Flags)0);
if (!m_ignoreDamage)
- resource->sendDamage(0, 0, box.width, box.height);
+ m_resource->sendDamage(0, 0, m_box.width, m_box.height);
const auto [sec, nsec] = Time::secNsec(Time::steadyNow());
uint32_t tvSecHi = (sizeof(sec) > 4) ? sec >> 32 : 0;
uint32_t tvSecLo = sec & 0xFFFFFFFF;
- resource->sendReady(tvSecHi, tvSecLo, nsec);
+ m_resource->sendReady(tvSecHi, tvSecLo, nsec);
}
bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
- const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(resource->client(), PERMISSION_TYPE_SCREENCOPY);
- auto shm = buffer->shm();
- auto [pixelData, fmt, bufLen] = buffer->beginDataPtr(0); // no need for end, cuz it's shm
+ const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(m_resource->client(), PERMISSION_TYPE_SCREENCOPY);
+ auto shm = m_buffer->shm();
+ auto [pixelData, fmt, bufLen] = m_buffer->beginDataPtr(0); // no need for end, cuz it's shm
// render the client
- const auto PMONITOR = pWindow->m_monitor.lock();
+ const auto PMONITOR = m_window->m_monitor.lock();
CRegion fakeDamage{0, 0, PMONITOR->m_pixelSize.x * 10, PMONITOR->m_pixelSize.y * 10};
g_pHyprRenderer->makeEGLCurrent();
@@ -257,12 +257,12 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
// render client at 0,0
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
- g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(pWindow); // block the feedback to avoid spamming the surface if it's visible
- g_pHyprRenderer->renderWindow(pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
+ g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(m_window); // block the feedback to avoid spamming the surface if it's visible
+ g_pHyprRenderer->renderWindow(m_window, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
if (overlayCursor)
- g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
+ g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - m_window->m_realPosition->value());
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
CBox texbox =
CBox{PMONITOR->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
@@ -294,24 +294,24 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
switch (PMONITOR->m_transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
case WL_OUTPUT_TRANSFORM_90: {
- origin.y = PMONITOR->m_pixelSize.y - box.height;
+ origin.y = PMONITOR->m_pixelSize.y - m_box.height;
break;
}
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
case WL_OUTPUT_TRANSFORM_180: {
- origin.x = PMONITOR->m_pixelSize.x - box.width;
- origin.y = PMONITOR->m_pixelSize.y - box.height;
+ origin.x = PMONITOR->m_pixelSize.x - m_box.width;
+ origin.y = PMONITOR->m_pixelSize.y - m_box.height;
break;
}
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_270: {
- origin.x = PMONITOR->m_pixelSize.x - box.width;
+ origin.x = PMONITOR->m_pixelSize.x - m_box.width;
break;
}
default: break;
}
- glReadPixels(origin.x, origin.y, box.width, box.height, glFormat, PFORMAT->glType, pixelData);
+ glReadPixels(origin.x, origin.y, m_box.width, m_box.height, glFormat, PFORMAT->glType, pixelData);
if (overlayCursor) {
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->m_self.lock());
@@ -328,8 +328,8 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
}
bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
- const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(resource->client(), PERMISSION_TYPE_SCREENCOPY);
- const auto PMONITOR = pWindow->m_monitor.lock();
+ const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(m_resource->client(), PERMISSION_TYPE_SCREENCOPY);
+ const auto PMONITOR = m_window->m_monitor.lock();
CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX};
@@ -340,17 +340,17 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
g_pPointerManager->damageCursor(PMONITOR->m_self.lock());
}
- if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_TO_BUFFER, buffer.m_buffer))
+ if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_TO_BUFFER, m_buffer.m_buffer))
return false;
g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 1.0));
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
- g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(pWindow); // block the feedback to avoid spamming the surface if it's visible
- g_pHyprRenderer->renderWindow(pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
+ g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(m_window); // block the feedback to avoid spamming the surface if it's visible
+ g_pHyprRenderer->renderWindow(m_window, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
if (overlayCursor)
- g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
+ g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - m_window->m_realPosition->value());
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
CBox texbox =
CBox{PMONITOR->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
@@ -369,7 +369,7 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
}
bool CToplevelExportFrame::shouldOverlayCursor() const {
- if (!cursorOverlayRequested)
+ if (!m_cursorOverlayRequested)
return false;
auto pointerSurfaceResource = g_pSeatManager->m_state.pointerFocus.lock();
@@ -379,11 +379,11 @@ bool CToplevelExportFrame::shouldOverlayCursor() const {
auto pointerSurface = CWLSurface::fromResource(pointerSurfaceResource);
- return pointerSurface && pointerSurface->getWindow() == pWindow;
+ return pointerSurface && pointerSurface->getWindow() == m_window;
}
bool CToplevelExportFrame::good() {
- return resource->resource();
+ return m_resource->resource();
}
CToplevelExportProtocol::CToplevelExportProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
@@ -391,59 +391,59 @@ CToplevelExportProtocol::CToplevelExportProtocol(const wl_interface* iface, cons
}
void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
- const auto CLIENT = m_vClients.emplace_back(makeShared<CToplevelExportClient>(makeShared<CHyprlandToplevelExportManagerV1>(client, ver, id)));
+ const auto CLIENT = m_clients.emplace_back(makeShared<CToplevelExportClient>(makeShared<CHyprlandToplevelExportManagerV1>(client, ver, id)));
if (!CLIENT->good()) {
LOGM(LOG, "Failed to bind client! (out of memory)");
wl_client_post_no_memory(client);
- m_vClients.pop_back();
+ m_clients.pop_back();
return;
}
- CLIENT->self = CLIENT;
+ CLIENT->m_self = CLIENT;
LOGM(LOG, "Bound client successfully!");
}
void CToplevelExportProtocol::destroyResource(CToplevelExportClient* client) {
- std::erase_if(m_vClients, [&](const auto& other) { return other.get() == client; });
- std::erase_if(m_vFrames, [&](const auto& other) { return other->client.get() == client; });
- std::erase_if(m_vFramesAwaitingWrite, [&](const auto& other) { return !other || other->client.get() == client; });
+ std::erase_if(m_clients, [&](const auto& other) { return other.get() == client; });
+ std::erase_if(m_frames, [&](const auto& other) { return other->m_client.get() == client; });
+ std::erase_if(m_framesAwaitingWrite, [&](const auto& other) { return !other || other->m_client.get() == client; });
}
void CToplevelExportProtocol::destroyResource(CToplevelExportFrame* frame) {
- std::erase_if(m_vFrames, [&](const auto& other) { return other.get() == frame; });
- std::erase_if(m_vFramesAwaitingWrite, [&](const auto& other) { return !other || other.get() == frame; });
+ std::erase_if(m_frames, [&](const auto& other) { return other.get() == frame; });
+ std::erase_if(m_framesAwaitingWrite, [&](const auto& other) { return !other || other.get() == frame; });
}
void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
- if (m_vFramesAwaitingWrite.empty())
+ if (m_framesAwaitingWrite.empty())
return; // nothing to share
std::vector<WP<CToplevelExportFrame>> framesToRemove;
// reserve number of elements to avoid reallocations
- framesToRemove.reserve(m_vFramesAwaitingWrite.size());
+ framesToRemove.reserve(m_framesAwaitingWrite.size());
// share frame if correct output
- for (auto const& f : m_vFramesAwaitingWrite) {
+ for (auto const& f : m_framesAwaitingWrite) {
if (!f)
continue;
// check permissions
- const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(f->resource->client(), PERMISSION_TYPE_SCREENCOPY);
+ const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(f->m_resource->client(), PERMISSION_TYPE_SCREENCOPY);
if (PERM == PERMISSION_RULE_ALLOW_MODE_PENDING)
continue; // pending an answer, don't do anything yet.
- if (!validMapped(f->pWindow)) {
+ if (!validMapped(f->m_window)) {
framesToRemove.emplace_back(f);
continue;
}
- if (!f->pWindow)
+ if (!f->m_window)
continue;
- const auto PWINDOW = f->pWindow;
+ const auto PWINDOW = f->m_window;
if (pMonitor != PWINDOW->m_monitor.lock())
continue;
@@ -455,20 +455,20 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
f->share();
- f->client->lastFrame.reset();
- ++f->client->frameCounter;
+ f->m_client->m_lastFrame.reset();
+ ++f->m_client->m_frameCounter;
framesToRemove.push_back(f);
}
for (auto const& f : framesToRemove) {
- std::erase(m_vFramesAwaitingWrite, f);
+ std::erase(m_framesAwaitingWrite, f);
}
}
void CToplevelExportProtocol::onWindowUnmap(PHLWINDOW pWindow) {
- for (auto const& f : m_vFrames) {
- if (f->pWindow == pWindow)
- f->pWindow.reset();
+ for (auto const& f : m_frames) {
+ if (f->m_window == pWindow)
+ f->m_window.reset();
}
}