From 183026e2b73982efccc11caef44b09a7702eac14 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 10 Dec 2021 22:12:42 +0100 Subject: [PATCH] Fixed #16 --- src/bar/Bar.cpp | 3 +++ src/utilities/AnimationUtil.cpp | 2 +- src/windowManager.cpp | 15 +++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/bar/Bar.cpp b/src/bar/Bar.cpp index 3021d1f..91ac3f1 100644 --- a/src/bar/Bar.cpp +++ b/src/bar/Bar.cpp @@ -428,6 +428,9 @@ void CStatusBar::draw() { if (m_bIsCovered) return; // Do not draw a bar on a fullscreen window. + if (m_bIsDestroyed) + return; + if (!m_pCairo) { Debug::log(ERR, "Cairo is null but attempted to draw!"); return; diff --git a/src/utilities/AnimationUtil.cpp b/src/utilities/AnimationUtil.cpp index f069630..36dced1 100644 --- a/src/utilities/AnimationUtil.cpp +++ b/src/utilities/AnimationUtil.cpp @@ -33,7 +33,7 @@ void AnimationUtil::move() { } } - if (ConfigManager::getInt("anim:enabled") == 0 || window.getIsFloating()) { + if (ConfigManager::getInt("anim:enabled") == 0 || window.getIsFloating() || window.getFullscreen()) { // Disabled animations. instant warps. if (VECTORDELTANONZERO(window.getRealPosition(), window.getEffectivePosition()) diff --git a/src/windowManager.cpp b/src/windowManager.cpp index bbba999..fa75211 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -366,9 +366,6 @@ void CWindowManager::refreshDirtyWindows() { Values[0] = 0; xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_BORDER_WIDTH, Values); - Values[0] = window.getRealBorderColor().getAsUint32(); - xcb_change_window_attributes(DisplayConnection, window.getDrawable(), XCB_CW_BORDER_PIXEL, Values); - const auto MONITOR = getMonitorFromWindow(&window); Values[0] = (int)MONITOR->vecSize.x; @@ -710,6 +707,7 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) { return; const auto MONITOR = getMonitorFromWindow(pWindow); + const auto BARHEIGHT = ConfigManager::getInt("bar:enabled") == 1 ? ConfigManager::getInt("bar:height") : ConfigManager::parseError == "" ? 0 : ConfigManager::getInt("bar:height"); // set some flags. const bool DISPLAYLEFT = STICKS(pWindow->getPosition().x, MONITOR->vecPosition.x); @@ -721,9 +719,9 @@ void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) { pWindow->setEffectiveSize(pWindow->getSize() - (Vector2D(ConfigManager::getInt("border_size"), ConfigManager::getInt("border_size")) * 2)); // do gaps, set top left - pWindow->setEffectivePosition(pWindow->getEffectivePosition() + Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? ConfigManager::getInt("bar:height") : 0) : ConfigManager::getInt("gaps_in"))); + pWindow->setEffectivePosition(pWindow->getEffectivePosition() + Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? BARHEIGHT : 0) : ConfigManager::getInt("gaps_in"))); // fix to old size bottom right - pWindow->setEffectiveSize(pWindow->getEffectiveSize() - Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? ConfigManager::getInt("bar:height") : 0) : ConfigManager::getInt("gaps_in"))); + pWindow->setEffectiveSize(pWindow->getEffectiveSize() - Vector2D(DISPLAYLEFT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYTOP ? ConfigManager::getInt("gaps_out") + (MONITOR->ID == ConfigManager::getInt("bar:monitor") ? BARHEIGHT : 0) : ConfigManager::getInt("gaps_in"))); // set bottom right pWindow->setEffectiveSize(pWindow->getEffectiveSize() - Vector2D(DISPLAYRIGHT ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"), DISPLAYBOTTOM ? ConfigManager::getInt("gaps_out") : ConfigManager::getInt("gaps_in"))); } @@ -1448,6 +1446,10 @@ void CWindowManager::updateBarInfo() { // - Workspace data // - Active Workspace + // If bar disabled, ignore + if (ConfigManager::getInt("bar:enabled") == 0) + return; + SIPCMessageMainToBar message; if (!getMonitorFromCursor()) { @@ -1455,11 +1457,8 @@ void CWindowManager::updateBarInfo() { return; } - - message.activeWorkspace = activeWorkspaces[getMonitorFromCursor()->ID]; - auto winname = getWindowFromDrawable(LastWindow) ? getWindowFromDrawable(LastWindow)->getName() : ""; auto winclassname = getWindowFromDrawable(LastWindow) ? getWindowFromDrawable(LastWindow)->getClassName() : "";