diff --git a/src/window.cpp b/src/window.cpp index 928ae26..319be54 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1,7 +1,7 @@ #include "window.hpp" #include "windowManager.hpp" -CWindow::CWindow() { this->setRealBorderColor(0); this->setEffectiveBorderColor(0); this->setFirstOpen(true); this->setConstructed(false); this->setTransient(false); this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); 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() { this->setDockHidden(false); this->setRealBorderColor(0); this->setEffectiveBorderColor(0); this->setFirstOpen(true); this->setConstructed(false); this->setTransient(false); this->setLastUpdatePosition(Vector2D(0,0)); this->setLastUpdateSize(Vector2D(0,0)); this->setDock(false); 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 805493a..b8b2c46 100644 --- a/src/window.hpp +++ b/src/window.hpp @@ -99,6 +99,7 @@ public: // Docks EXPOSED_MEMBER(Dock, bool, b); EXPOSED_MEMBER(DockAlign, EDockAlign, e); + EXPOSED_MEMBER(DockHidden, bool, b); // Transient EXPOSED_MEMBER(Children, std::vector, vec); diff --git a/src/windowManager.cpp b/src/windowManager.cpp index 8cbdad0..582e287 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -217,6 +217,9 @@ bool CWindowManager::handleEvent() { sanityCheckOnWorkspace(active); } + // hide ewmh bars if fullscreen + processBarHiding(); + // remove unused workspaces cleanupUnusedWorkspaces(); @@ -334,6 +337,42 @@ void CWindowManager::recieveEvent() { } } +void CWindowManager::processBarHiding() { + for (auto& w : windows) { + if (!w.getDock()) + continue; + + // get the dock's monitor + const auto& MON = monitors[w.getMonitor()]; + + // get the dock's current workspace + auto *const WORK = getWorkspaceByID(activeWorkspaces[MON.ID]); + + if (!WORK) + continue; // weird if happens + + if (WORK->getHasFullscreenWindow() && !w.getDockHidden()) { + const auto COOKIE = xcb_unmap_window(DisplayConnection, w.getDrawable()); + Events::ignoredEvents.push_back(COOKIE.sequence); + w.setDockHidden(true); + } + + else if (!WORK->getHasFullscreenWindow() && w.getDockHidden()) { + const auto COOKIE = xcb_map_window(DisplayConnection, w.getDrawable()); + Events::ignoredEvents.push_back(COOKIE.sequence); + + // restore its params + // Values[0] = (int)w.getDefaultPosition().x; + // Values[1] = (int)w.getDefaultPosition().y; + // xcb_configure_window(DisplayConnection, w.getDrawable(), XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, Values); + // Values[0] = (int)w.getDefaultSize().x; + // Values[1] = (int)w.getDefaultSize().y; + // xcb_configure_window(DisplayConnection, w.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values); + w.setDockHidden(false); + } + } +} + void CWindowManager::cleanupUnusedWorkspaces() { std::deque temp = workspaces; diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 9d785ca..8f26e65 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -168,6 +168,7 @@ private: void dispatchQueuedWarp(); CWindow* getMasterForWorkspace(const int&); int getBarHeightForMonitor(const int&); + void processBarHiding(); }; inline std::unique_ptr g_pWindowManager = std::make_unique();