From 109136af97547f35f767dae2e7908ab218dfea11 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 14 May 2022 17:23:46 +0200 Subject: Fadein/out now applies to layersurfaces too --- src/Compositor.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 50ce621a..4b6999c7 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -513,7 +513,7 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) { wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list* layerSurfaces, Vector2D* sCoords) { for (auto& l : *layerSurfaces) { - if (!l->layerSurface->mapped) + if (l->fadingOut || (l->layerSurface && !l->layerSurface->mapped)) continue; const auto SURFACEAT = wlr_layer_surface_v1_surface_at(l->layerSurface, pos.x - l->geometry.x, pos.y - l->geometry.y, &sCoords->x, &sCoords->y); @@ -650,6 +650,24 @@ void CCompositor::cleanupWindows() { return; } } + + for (auto& ls : m_lSurfacesFadingOut) { + if (ls->fadingOut && ls->readyToDelete && !ls->alpha.isBeingAnimated()) { + for (auto& m : m_lMonitors) { + for (auto& lsl : m.m_aLayerSurfaceLists) { + lsl.remove(ls); + } + } + + g_pHyprOpenGL->m_mLayerFramebuffers[ls].release(); + g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls); + + m_lSurfacesFadingOut.remove(ls); + delete ls; + + return; + } + } } CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) { @@ -863,4 +881,4 @@ SMonitor* CCompositor::getMonitorInDirection(const char& dir) { return longestIntersectMonitor; return nullptr; -} \ No newline at end of file +} -- cgit v1.2.3 From 6db68917abd4090e1ecf8d75468ea28adeb342a9 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 14 May 2022 17:26:34 +0200 Subject: rename cleanupWindows to cleanupFadingOut --- src/Compositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 4b6999c7..9f11559a 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -632,7 +632,7 @@ void CCompositor::moveWindowToTop(CWindow* pWindow) { } } -void CCompositor::cleanupWindows() { +void CCompositor::cleanupFadingOut() { for (auto& w : m_lWindowsFadingOut) { bool valid = windowExists(w); -- cgit v1.2.3 From f0d52d8a88ca64c4a806bdd1eb8aaf549970d6f6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 14 May 2022 17:28:55 +0200 Subject: log layersurface cleanup --- src/Compositor.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 9f11559a..cd3fed1d 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -665,6 +665,8 @@ void CCompositor::cleanupFadingOut() { m_lSurfacesFadingOut.remove(ls); delete ls; + Debug::log(LOG, "Cleanup: destroyed a layersurface"); + return; } } -- cgit v1.2.3 From deb18af955f5282c1c37a3cfcce85cfbd717d418 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 14 May 2022 20:56:21 +0200 Subject: Protect against crash in focusWindow --- src/Compositor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index cd3fed1d..32a3ffde 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -402,13 +402,13 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { return; } - if (pWindow->m_bNoFocus) { - Debug::log(LOG, "Ignoring focus to nofocus window!"); + if (!pWindow || !windowValidMapped(pWindow)) { + wlr_seat_keyboard_notify_clear_focus(m_sSeat.seat); return; } - if (!pWindow || !windowValidMapped(pWindow)) { - wlr_seat_keyboard_notify_clear_focus(m_sSeat.seat); + if (pWindow->m_bNoFocus) { + Debug::log(LOG, "Ignoring focus to nofocus window!"); return; } -- cgit v1.2.3 From 96cdf8fd5e89928263380a00d007a6b11c59a6b9 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 15 May 2022 18:41:02 +0200 Subject: fix for wlroots-git update --- src/Compositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 32a3ffde..bf98d079 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -67,7 +67,7 @@ CCompositor::CCompositor() { m_sWLRScene = wlr_scene_create(); wlr_scene_attach_output_layout(m_sWLRScene, m_sWLROutputLayout); - m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay); + m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay, 2); m_sWLRCursor = wlr_cursor_create(); wlr_cursor_attach_output_layout(m_sWLRCursor, m_sWLROutputLayout); -- cgit v1.2.3