From 002247629ec624257e92736bbb45c1a6892bbb1b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:42:07 +0100 Subject: [PATCH] Hypr bar treated as EWMH, fix for reserved and no_gaps_when_only --- src/bar/Bar.cpp | 3 --- src/bar/Bar.hpp | 1 - src/events/events.cpp | 4 ---- src/ipc/ipc.cpp | 2 +- src/windowManager.cpp | 17 ++++++----------- src/windowManager.hpp | 1 - 6 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/bar/Bar.cpp b/src/bar/Bar.cpp index ded37b8..b8ec70f 100644 --- a/src/bar/Bar.cpp +++ b/src/bar/Bar.cpp @@ -446,9 +446,6 @@ void CStatusBar::drawErrorScreen() { void CStatusBar::draw() { - if (m_bIsCovered) - return; // Do not draw a bar on a fullscreen window. - if (m_bIsDestroyed) return; diff --git a/src/bar/Bar.hpp b/src/bar/Bar.hpp index 0e48827..68079bc 100644 --- a/src/bar/Bar.hpp +++ b/src/bar/Bar.hpp @@ -64,7 +64,6 @@ public: EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better EXPOSED_MEMBER(LastWindowName, std::string, sz); EXPOSED_MEMBER(LastWindowClass, std::string, sz); - EXPOSED_MEMBER(IsCovered, bool, b); EXPOSED_MEMBER(HasTray, bool, b); EXPOSED_MEMBER(IsDestroyed, bool, b); // for not deleting nulls diff --git a/src/events/events.cpp b/src/events/events.cpp index 0b1ba1c..c63731d 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -600,10 +600,6 @@ void Events::eventMapWindow(xcb_generic_event_t* event) { // Map the window xcb_map_window(g_pWindowManager->DisplayConnection, E->window); - // bar - if (E->window == g_pWindowManager->barWindowID) - return; - // We check if the window is not on our tile-blacklist and if it is, we have a special treatment procedure for it. // this func also sets some stuff diff --git a/src/ipc/ipc.cpp b/src/ipc/ipc.cpp index 8d2d941..03ce82a 100644 --- a/src/ipc/ipc.cpp +++ b/src/ipc/ipc.cpp @@ -136,7 +136,7 @@ void IPCRecieveMessageB(const std::string path) { } else if (PROPNAME == "lastwindowclass") { g_pWindowManager->statusBar->setLastWindowClass(PROPVALUE); } else if (PROPNAME == "barfullscreenwindow") { - g_pWindowManager->statusBar->setIsCovered(PROPVALUE == "1" ? true : false); + // deprecated } } } catch(...) { diff --git a/src/windowManager.cpp b/src/windowManager.cpp index b8f1f59..e65a27d 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -465,12 +465,12 @@ void CWindowManager::refreshDirtyWindows() { const auto MONITOR = getMonitorFromWindow(&window); - Values[0] = (int)MONITOR->vecSize.x; - Values[1] = window.getFullscreen() ? (int) MONITOR->vecSize.y : MONITOR->vecSize.y - getBarHeightForMonitor(window.getMonitor()); + Values[0] = window.getFullscreen() ? (int)MONITOR->vecSize.x : MONITOR->vecSize.x - MONITOR->vecReservedTopLeft.x - MONITOR->vecReservedBottomRight.x; + Values[1] = window.getFullscreen() ? (int) MONITOR->vecSize.y : MONITOR->vecSize.y - MONITOR->vecReservedTopLeft.y - MONITOR->vecReservedBottomRight.y; window.setEffectiveSize(Vector2D(Values[0], Values[1])); - Values[0] = (int)MONITOR->vecPosition.x; - Values[1] = window.getFullscreen() ? (int)MONITOR->vecPosition.y : MONITOR->vecPosition.y + getBarHeightForMonitor(window.getMonitor()); + Values[0] = window.getFullscreen() ? (int)MONITOR->vecPosition.x : MONITOR->vecPosition.x + MONITOR->vecReservedTopLeft.x; + Values[1] = window.getFullscreen() ? (int)MONITOR->vecPosition.y : MONITOR->vecPosition.y + MONITOR->vecReservedTopLeft.y; window.setEffectivePosition(Vector2D(Values[0], Values[1])); Values[0] = (int)window.getRealPosition().x; @@ -895,7 +895,6 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) { return; const auto MONITOR = getMonitorFromWindow(pWindow); - const auto BARHEIGHT = getBarHeightForMonitor(pWindow->getMonitor()); // set some flags. const bool DISPLAYLEFT = STICKS(pWindow->getPosition().x, MONITOR->vecPosition.x); @@ -911,7 +910,7 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) { pWindow->setEffectiveSize(pWindow->getSize() - (Vector2D(BORDERSIZE, BORDERSIZE) * 2)); const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? GAPSOUT + MONITOR->vecReservedTopLeft.x : GAPSIN, - DISPLAYTOP ? GAPSOUT + MONITOR->vecReservedTopLeft.y + BARHEIGHT : GAPSIN); + DISPLAYTOP ? GAPSOUT + MONITOR->vecReservedTopLeft.y : GAPSIN); const auto OFFSETBOTTOMRIGHT = Vector2D( DISPLAYRIGHT ? GAPSOUT + MONITOR->vecReservedBottomRight.x : GAPSIN, DISPLAYBOTTOM ? GAPSOUT + MONITOR->vecReservedBottomRight.y : GAPSIN); @@ -1026,7 +1025,7 @@ void CWindowManager::calculateNewTileSetOldTile(CWindow* pWindow) { int CWindowManager::getWindowsOnWorkspace(const int& workspace) { int number = 0; for (auto& w : windows) { - if (w.getWorkspaceID() == workspace && w.getDrawable() > 0) { + if (w.getWorkspaceID() == workspace && w.getDrawable() > 0 && !w.getDock()) { ++number; } } @@ -2419,10 +2418,6 @@ bool CWindowManager::shouldBeManaged(const int& window) { return true; } -int CWindowManager::getBarHeightForMonitor(const int& mon) { - return (mon == ConfigManager::getInt("bar:monitor") ? (ConfigManager::getInt("bar:enabled") == 1 ? ConfigManager::getInt("bar:height") : ConfigManager::parseError == "" ? 0 : ConfigManager::getInt("bar:height")) : 0); -} - SMonitor* CWindowManager::getMonitorFromCoord(const Vector2D coord) { for (auto& m : monitors) { if (VECINRECT(coord, m.vecPosition.x, m.vecPosition.y, m.vecPosition.x + m.vecSize.x, m.vecPosition.y + m.vecSize.y)) diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 8f26e65..d1444dc 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -167,7 +167,6 @@ private: void focusOnWorkspace(const int&); void dispatchQueuedWarp(); CWindow* getMasterForWorkspace(const int&); - int getBarHeightForMonitor(const int&); void processBarHiding(); };