diff options
| author | Narice <narice@tutanota.com> | 2022-05-16 11:53:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-16 11:53:28 +0100 |
| commit | 23c3534197f54e2f74b791ce2a8857b25bbba259 (patch) | |
| tree | c48e00553bb7027779b19e93a7f631a5f10eee98 /src/events | |
| parent | 4f10d8e07dd330bf1c4ce9eebecc0db919e522d9 (diff) | |
| parent | e991550abe8f4b13af586d635cdfec3b5c18fcd9 (diff) | |
Merge branch 'vaxerski:main' into main
Diffstat (limited to 'src/events')
| -rw-r--r-- | src/events/Layers.cpp | 36 | ||||
| -rw-r--r-- | src/events/Monitors.cpp | 4 | ||||
| -rw-r--r-- | src/events/Windows.cpp | 3 |
3 files changed, 37 insertions, 6 deletions
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index 12e9e93b..86e2ca1a 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -58,6 +58,23 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) { Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface); + if (!layersurface->fadingOut) { + if (layersurface->layerSurface->mapped) { + Debug::log(LOG, "LayerSurface wasn't unmapped, making a snapshot now!"); + + // make a snapshot and start fade + // layersurfaces aren't required to unmap before destroy + g_pHyprOpenGL->makeLayerSnapshot(layersurface); + layersurface->alpha = 0.f; + + layersurface->fadingOut = true; + } else { + Debug::log(LOG, "Removing LayerSurface that wasn't mapped."); + layersurface->alpha.setValueAndWarp(0.f); + layersurface->fadingOut = true; + } + } + if (layersurface->layerSurface->mapped) layersurface->layerSurface->mapped = false; @@ -72,9 +89,6 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) { const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID); - // remove the layersurface as it's not used anymore - PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface); - // rearrange to fix the reserved areas if (PMONITOR) { g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID); @@ -85,7 +99,8 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) { g_pHyprRenderer->damageBox(&geomFixed); } - delete layersurface; + layersurface->readyToDelete = true; + layersurface->layerSurface = nullptr; } void Events::listener_mapLayerSurface(void* owner, void* data) { @@ -121,6 +136,11 @@ void Events::listener_mapLayerSurface(void* owner, void* data) { wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height}; g_pHyprRenderer->damageBox(&geomFixed); + + layersurface->alpha.setValue(0); + layersurface->alpha = 255.f; + layersurface->readyToDelete = false; + layersurface->fadingOut = false; } void Events::listener_unmapLayerSurface(void* owner, void* data) { @@ -128,6 +148,14 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) { Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface); + // make a snapshot and start fade + g_pHyprOpenGL->makeLayerSnapshot(layersurface); + layersurface->alpha = 0.f; + + layersurface->fadingOut = true; + + g_pCompositor->m_lSurfacesFadingOut.push_back(layersurface); + if (layersurface->layerSurface->mapped) layersurface->layerSurface->mapped = false; diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index a08bbfda..65049426 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -135,7 +135,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { if (PMONITOR->ID == pMostHzMonitor->ID) { g_pCompositor->sanityCheckWorkspaces(); g_pAnimationManager->tick(); - g_pCompositor->cleanupWindows(); + g_pCompositor->cleanupFadingOut(); HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit @@ -191,7 +191,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { const auto BLURSIZE = g_pConfigManager->getInt("decoration:blur_size"); const auto BLURPASSES = g_pConfigManager->getInt("decoration:blur_passes"); - const auto BLURRADIUS = BLURSIZE * BLURPASSES * 2; // is this 2? I don't know but 2 works. + const auto BLURRADIUS = BLURSIZE * pow(2, BLURPASSES); // is this 2^pass? I don't know but it works... I think. pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 0bbe1629..a6ae6c5d 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -95,6 +95,9 @@ void Events::listener_mapWindow(void* owner, void* data) { } catch(std::exception& e) { Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); } + } else if (r.szRule.find("animation") == 0) { + auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); + PWINDOW->m_sAdditionalConfigData.animationStyle = STYLE; } } |
