summaryrefslogtreecommitdiff
path: root/src/protocols/ToplevelExport.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-04 00:58:30 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-04 00:58:30 +0100
commit882be7765b820d075bbeecde12695f1696f577cf (patch)
treeef3ccded877bde420258866b0485dcc50fec9f4e /src/protocols/ToplevelExport.cpp
parent99314fbe71fe1a0545ed463dc93ef8e7d80f9916 (diff)
toplevelExport: honor overlay_cursor
Diffstat (limited to 'src/protocols/ToplevelExport.cpp')
-rw-r--r--src/protocols/ToplevelExport.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index 50027046..a51f2632 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -349,10 +349,15 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe
pixman_region32_t fakeDamage;
pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10);
+ if (frame->overlayCursor)
+ wlr_output_lock_software_cursors(PMONITOR->output, true);
+
if (!wlr_output_attach_render(PMONITOR->output, nullptr)) {
Debug::log(ERR, "[toplevel_export] Couldn't attach render");
pixman_region32_fini(&fakeDamage);
wlr_buffer_end_data_ptr_access(frame->buffer);
+ if (frame->overlayCursor)
+ wlr_output_lock_software_cursors(PMONITOR->output, false);
return false;
}
@@ -364,6 +369,28 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe
g_pHyprRenderer->renderWindow(frame->pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
+ if (frame->overlayCursor && wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y)) {
+ // hack le massive
+ wlr_output_cursor* cursor;
+ const auto OFFSET = frame->pWindow->m_vRealPosition.vec() - PMONITOR->vecPosition;
+ wl_list_for_each(cursor, &PMONITOR->output->cursors, link) {
+ if (!cursor->enabled || !cursor->visible || PMONITOR->output->hardware_cursor == cursor) {
+ continue;
+ }
+ cursor->x -= OFFSET.x;
+ cursor->y -= OFFSET.y;
+ }
+ wlr_output_render_software_cursors(PMONITOR->output, NULL);
+ wl_list_for_each(cursor, &PMONITOR->output->cursors, link) {
+ if (!cursor->enabled || !cursor->visible || PMONITOR->output->hardware_cursor == cursor) {
+ continue;
+ }
+ cursor->x += OFFSET.x;
+ cursor->y += OFFSET.y;
+ }
+ wlr_renderer_end(g_pCompositor->m_sWLRRenderer);
+ }
+
// copy pixels
const auto PFORMAT = get_gles2_format_from_drm(format);
if (!PFORMAT) {
@@ -371,6 +398,8 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe
g_pHyprOpenGL->end();
pixman_region32_fini(&fakeDamage);
wlr_buffer_end_data_ptr_access(frame->buffer);
+ if (frame->overlayCursor)
+ wlr_output_lock_software_cursors(PMONITOR->output, false);
return false;
}
@@ -388,6 +417,9 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe
wlr_buffer_end_data_ptr_access(frame->buffer);
+ if (frame->overlayCursor)
+ wlr_output_lock_software_cursors(PMONITOR->output, false);
+
return true;
}