summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-06-12 22:57:06 +0200
committerVaxry <vaxry@vaxry.net>2024-06-12 22:57:06 +0200
commit18ee9ece9cec51daa75fbf765d9fa6b72ef898e5 (patch)
tree5bc2af37a443dd35c289fba389854c839e4c3cb6 /src
parent38132ffaf53c843a3ed03be5b305702fde8f5a49 (diff)
layershell: minor fixes to re-mapping of layers
ref #2012
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp4
-rw-r--r--src/Compositor.hpp1
-rw-r--r--src/desktop/LayerSurface.cpp19
3 files changed, 22 insertions, 2 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 20bc82e7..8f36b4ae 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -1361,6 +1361,10 @@ void CCompositor::addToFadingOutSafe(PHLLS pLS) {
m_vSurfacesFadingOut.emplace_back(pLS);
}
+void CCompositor::removeFromFadingOutSafe(PHLLS ls) {
+ std::erase(m_vSurfacesFadingOut, ls);
+}
+
void CCompositor::addToFadingOutSafe(PHLWINDOW pWindow) {
const auto FOUND = std::find_if(m_vWindowsFadingOut.begin(), m_vWindowsFadingOut.end(), [&](PHLWINDOWREF& other) { return other.lock() == pWindow; });
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index 458e37a7..242c3b13 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -156,6 +156,7 @@ class CCompositor {
PHLWINDOW getX11Parent(PHLWINDOW);
void scheduleFrameForMonitor(CMonitor*);
void addToFadingOutSafe(PHLLS);
+ void removeFromFadingOutSafe(PHLLS);
void addToFadingOutSafe(PHLWINDOW);
PHLWINDOW getWindowByRegex(const std::string&);
void warpCursorTo(const Vector2D&, bool force = false);
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 0b2e23a3..2eb66440 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -119,6 +119,10 @@ void CLayerSurface::onMap() {
mapped = true;
interactivity = layerSurface->current.interactivity;
+ // this layer might be re-mapped.
+ fadingOut = false;
+ g_pCompositor->removeFromFadingOutSafe(self.lock());
+
// fix if it changed its mon
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
@@ -204,8 +208,6 @@ void CLayerSurface::onUnmap() {
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == surface->resource();
- surface.reset();
-
if (!PMONITOR)
return;
@@ -221,12 +223,25 @@ void CLayerSurface::onUnmap() {
g_pHyprRenderer->damageBox(&geomFixed);
g_pInputManager->sendMotionEventsToFocused();
+
+ g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
}
void CLayerSurface::onCommit() {
if (!layerSurface)
return;
+ if (!mapped) {
+ // we're re-mapping if this is the case
+ if (layerSurface->surface && !layerSurface->surface->current.buffer) {
+ fadingOut = false;
+ geometry = {};
+ g_pHyprRenderer->arrangeLayersForMonitor(monitorID);
+ }
+
+ return;
+ }
+
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
if (!PMONITOR)