From 00eebae66c96976fcf64aade71f1149784228fa0 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 11 Dec 2021 14:50:29 +0100 Subject: [PATCH] more vlc fixes --- src/KeybindManager.cpp | 6 ++++++ src/events/events.cpp | 6 ++++-- src/window.cpp | 2 +- src/window.hpp | 1 + src/windowManager.cpp | 22 ++++++++++++++++++++-- src/windowManager.hpp | 3 +++ 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/KeybindManager.cpp b/src/KeybindManager.cpp index 6d3a163..539a50b 100644 --- a/src/KeybindManager.cpp +++ b/src/KeybindManager.cpp @@ -156,6 +156,12 @@ void KeybindManager::toggleActiveWindowFullscreen(std::string unusedArg) { PWINDOW->setFullscreen(!PWINDOW->getFullscreen()); g_pWindowManager->getWorkspaceByID(PWINDOW->getWorkspaceID())->setHasFullscreenWindow(PWINDOW->getFullscreen()); + + // Fix windows over and below fullscreen. + if (PWINDOW->getFullscreen()) + g_pWindowManager->setAllWorkspaceWindowsUnderFullscreen(g_pWindowManager->activeWorkspaces[MONITOR->ID]); + else + g_pWindowManager->setAllWorkspaceWindowsAboveFullscreen(g_pWindowManager->activeWorkspaces[MONITOR->ID]); } void KeybindManager::toggleActiveWindowFloating(std::string unusedArg) { diff --git a/src/events/events.cpp b/src/events/events.cpp index 317d235..9c84539 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -230,8 +230,6 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) { g_pWindowManager->Values[0] = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_FOCUS_CHANGE; xcb_change_window_attributes_checked(g_pWindowManager->DisplayConnection, windowID, XCB_CW_EVENT_MASK, g_pWindowManager->Values); - g_pWindowManager->setFocusedWindow(windowID); - // Make all floating windows above g_pWindowManager->setAllFloatingWindowsTop(); @@ -403,6 +401,10 @@ void Events::eventMapWindow(xcb_generic_event_t* event) { // Do ICCCM g_pWindowManager->getICCCMWMProtocols(pNewWindow); + + // Set not under + pNewWindow->setUnderFullscreen(false); + pNewWindow->setDirty(true); } void Events::eventButtonPress(xcb_generic_event_t* event) { diff --git a/src/window.cpp b/src/window.cpp index c6dc0a7..4940c1b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1,7 +1,7 @@ #include "window.hpp" #include "windowManager.hpp" -CWindow::CWindow() { this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); } +CWindow::CWindow() { this->setUnderFullscreen(false); this->setIsSleeping(true); this->setFirstAnimFrame(true); this->setIsAnimated(false); this->setDead(false); this->setMasterChildIndex(0); this->setMaster(false); this->setCanKill(false); this->setImmovable(false); this->setNoInterventions(false); this->setDirty(true); this->setFullscreen(false); this->setIsFloating(false); this->setParentNodeID(0); this->setChildNodeAID(0); this->setChildNodeBID(0); this->setName(""); } CWindow::~CWindow() { } void CWindow::generateNodeID() { diff --git a/src/window.hpp b/src/window.hpp index 94ea48e..894ed11 100644 --- a/src/window.hpp +++ b/src/window.hpp @@ -61,6 +61,7 @@ public: // For floating EXPOSED_MEMBER(DefaultSize, Vector2D, vec); EXPOSED_MEMBER(DefaultPosition, Vector2D, vec); + EXPOSED_MEMBER(UnderFullscreen, bool, b); // Monitors EXPOSED_MEMBER(Monitor, int, i); diff --git a/src/windowManager.cpp b/src/windowManager.cpp index 417543b..8061eb0 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -345,9 +345,9 @@ void CWindowManager::refreshDirtyWindows() { bool bHasFullscreenWindow = getWorkspaceByID(window.getWorkspaceID())->getHasFullscreenWindow(); // first and foremost, let's check if the window isn't on a hidden workspace - // or that it is not a non-fullscreen window in a fullscreen workspace + // or that it is not a non-fullscreen window in a fullscreen workspace thats under if (!isWorkspaceVisible(window.getWorkspaceID()) - || (bHasFullscreenWindow && !window.getFullscreen())) { + || (bHasFullscreenWindow && !window.getFullscreen() && (window.getUnderFullscreen() || !window.getIsFloating()))) { // Move it to hades Values[0] = (int)1500000; // hmu when monitors actually have that many pixels Values[1] = (int)1500000; // and we are still using xorg =) @@ -1697,6 +1697,8 @@ void CWindowManager::moveWindowToMapped(int64_t id) { unmappedWindows.push_back(t); } + windows[windows.size() - 1].setUnderFullscreen(false); + return; } } @@ -1710,4 +1712,20 @@ bool CWindowManager::isWindowUnmapped(int64_t id) { } return false; +} + +void CWindowManager::setAllWorkspaceWindowsAboveFullscreen(const int& workspace) { + for (auto& w : windows) { + if (w.getWorkspaceID() == workspace && w.getIsFloating()) { + w.setUnderFullscreen(false); + } + } +} + +void CWindowManager::setAllWorkspaceWindowsUnderFullscreen(const int& workspace) { + for (auto& w : windows) { + if (w.getWorkspaceID() == workspace && w.getIsFloating()) { + w.setUnderFullscreen(true); + } + } } \ No newline at end of file diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 159eeb5..9a19b24 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -121,6 +121,9 @@ public: void moveWindowToMapped(int64_t); bool isWindowUnmapped(int64_t); + void setAllWorkspaceWindowsAboveFullscreen(const int&); + void setAllWorkspaceWindowsUnderFullscreen(const int&); + private: // Internal WM functions that don't have to be exposed