diff options
author | vaxerski <[email protected]> | 2022-09-13 15:25:42 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-09-13 15:25:42 +0200 |
commit | e9f226797e43cedf17b094bc498272213ed53687 (patch) | |
tree | 9a1a49cf308dac971a5bd73e4a00175930d323de /src/events/Monitors.cpp | |
parent | 7d4f0a319943f56b1a277ceae198fc3f77615afe (diff) | |
download | Hyprland-e9f226797e43cedf17b094bc498272213ed53687.tar.gz Hyprland-e9f226797e43cedf17b094bc498272213ed53687.zip |
Added monitor mirroring
Diffstat (limited to 'src/events/Monitors.cpp')
-rw-r--r-- | src/events/Monitors.cpp | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 0fe481c8..211562b0 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -190,7 +190,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { } // if we have no tracking or full tracking, invalidate the entire monitor - if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0) { + if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0 || PMONITOR->isMirror() /* why??? */) { pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x * 10, (int)PMONITOR->vecTransformedSize.y * 10); // wot? pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage); @@ -224,37 +224,44 @@ void Events::listener_monitorFrame(void* owner, void* data) { // potentially can save on resources. g_pHyprOpenGL->begin(PMONITOR, &damage); - g_pHyprOpenGL->clear(CColor(17, 17, 17, 255)); - g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper" - g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now); + if (PMONITOR->isMirror()) { + g_pHyprOpenGL->renderMirrored(); - // if correct monitor draw hyprerror - if (PMONITOR->ID == 0) - g_pHyprError->draw(); + Debug::log(LOG, "Mirror frame"); + } else { + g_pHyprOpenGL->clear(CColor(17, 17, 17, 255)); + g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper" - // for drawing the debug overlay - if (PMONITOR->ID == 0 && *PDEBUGOVERLAY == 1) { - startRenderOverlay = std::chrono::high_resolution_clock::now(); - g_pDebugOverlay->draw(); - endRenderOverlay = std::chrono::high_resolution_clock::now(); - } + g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now); - if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { - wlr_box monrect = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; - g_pHyprOpenGL->renderRect(&monrect, CColor(255,0,255,100), 0); - damageBlinkCleanup = 1; - } else if (*PDAMAGEBLINK) { - damageBlinkCleanup++; - if (damageBlinkCleanup > 3) - damageBlinkCleanup = 0; - } + // if correct monitor draw hyprerror + if (PMONITOR->ID == 0) + g_pHyprError->draw(); + + // for drawing the debug overlay + if (PMONITOR->ID == 0 && *PDEBUGOVERLAY == 1) { + startRenderOverlay = std::chrono::high_resolution_clock::now(); + g_pDebugOverlay->draw(); + endRenderOverlay = std::chrono::high_resolution_clock::now(); + } - wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); + if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { + wlr_box monrect = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; + g_pHyprOpenGL->renderRect(&monrect, CColor(255, 0, 255, 100), 0); + damageBlinkCleanup = 1; + } else if (*PDAMAGEBLINK) { + damageBlinkCleanup++; + if (damageBlinkCleanup > 3) + damageBlinkCleanup = 0; + } + + wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); - wlr_output_render_software_cursors(PMONITOR->output, NULL); + wlr_output_render_software_cursors(PMONITOR->output, NULL); - wlr_renderer_end(g_pCompositor->m_sWLRRenderer); + wlr_renderer_end(g_pCompositor->m_sWLRRenderer); + } g_pHyprOpenGL->end(); @@ -272,6 +279,10 @@ void Events::listener_monitorFrame(void* owner, void* data) { pixman_region32_union(&frameDamage, &frameDamage, &damage); wlr_output_set_damage(PMONITOR->output, &frameDamage); + + if (!PMONITOR->mirrors.empty()) + g_pHyprRenderer->damageMirrorsWith(PMONITOR, &frameDamage); + pixman_region32_fini(&frameDamage); pixman_region32_fini(&damage); |