From 461fab0f27e4913993c6321625b343537aba1bdf Mon Sep 17 00:00:00 2001 From: vaxerski Date: Fri, 6 Jan 2023 13:29:43 +0100 Subject: [PATCH] minor fixes for fakefullscreen --- src/Window.hpp | 2 +- src/events/Windows.cpp | 16 ++++++++++++++-- src/managers/KeybindManager.cpp | 4 +++- src/managers/XWaylandManager.cpp | 2 -- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Window.hpp b/src/Window.hpp index cc872a43..758acd4d 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -158,7 +158,7 @@ class CWindow { bool m_bPinned = false; // fakefullscreen - bool m_bInFullscreenReported = false; + bool m_bFakeFullscreenState = false; // for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window. CWindow* m_pLastCycledWindow = nullptr; diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 2557e0f0..50f58cfc 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -756,18 +756,30 @@ void Events::listener_fullscreenWindow(void* owner, void* data) { if (PWINDOW->isHidden() || PWINDOW->m_bNoFullscreenRequest) return; + bool requestedFullState = false; + if (!PWINDOW->m_bIsX11) { const auto REQUESTED = &PWINDOW->m_uSurface.xdg->toplevel->requested; - if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen) + if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen && !PWINDOW->m_bFakeFullscreenState) g_pCompositor->setWindowFullscreen(PWINDOW, REQUESTED->fullscreen, FULLSCREEN_FULL); + requestedFullState = REQUESTED->fullscreen; + wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg); } else { if (!PWINDOW->m_uSurface.xwayland->mapped) return; - g_pCompositor->setWindowFullscreen(PWINDOW, PWINDOW->m_uSurface.xwayland->fullscreen, FULLSCREEN_FULL); + if (!PWINDOW->m_bFakeFullscreenState) + g_pCompositor->setWindowFullscreen(PWINDOW, PWINDOW->m_uSurface.xwayland->fullscreen, FULLSCREEN_FULL); + + requestedFullState = PWINDOW->m_uSurface.xwayland->fullscreen; + } + + if (!requestedFullState && PWINDOW->m_bFakeFullscreenState) { + g_pXWaylandManager->setWindowFullscreen(PWINDOW, false); // fixes for apps expecting a de-fullscreen (e.g. ff) + g_pXWaylandManager->setWindowFullscreen(PWINDOW, true); } PWINDOW->updateToplevel(); diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 15ed348b..ead93231 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1823,6 +1823,8 @@ void CKeybindManager::bringActiveToTop(std::string args) { void CKeybindManager::fakeFullscreenActive(std::string args) { if (g_pCompositor->m_pLastWindow) { // will also set the flag - g_pXWaylandManager->setWindowFullscreen(g_pCompositor->m_pLastWindow, !g_pCompositor->m_pLastWindow->m_bInFullscreenReported); + g_pCompositor->m_pLastWindow->m_bFakeFullscreenState = !g_pCompositor->m_pLastWindow->m_bFakeFullscreenState; + g_pXWaylandManager->setWindowFullscreen(g_pCompositor->m_pLastWindow, + g_pCompositor->m_pLastWindow->m_bFakeFullscreenState || g_pCompositor->m_pLastWindow->m_bIsFullscreen); } } diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 029a3f31..765738ef 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -257,8 +257,6 @@ void CHyprXWaylandManager::setWindowFullscreen(CWindow* pWindow, bool fullscreen if (pWindow->m_phForeignToplevel) wlr_foreign_toplevel_handle_v1_set_fullscreen(pWindow->m_phForeignToplevel, fullscreen); - - pWindow->m_bInFullscreenReported = fullscreen; } Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {