From 95d0e67f5cd489f54e78c9cd7bb531208749a8f8 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 9 Jan 2022 15:13:17 +0100 Subject: [PATCH] Revert "give bullshit windows 500ms to unbullshit themselves before unmanaging" This reverts commit e886d957d92b0c5cb6f316884ce62e61ec71a2d5. --- src/events/events.cpp | 15 +++++++++++++-- src/window.cpp | 3 +-- src/window.hpp | 2 -- src/windowManager.cpp | 20 -------------------- src/windowManager.hpp | 1 - 5 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/events/events.cpp b/src/events/events.cpp index fe767b5..cf67931 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -175,6 +175,11 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) { return nullptr; } + if (PWINDOWINARR->getClassName() == "") { + Debug::log(WARN, "remapFloatingWindow with Error, not managing."); + return nullptr; + } + PWINDOWINARR->setIsFloating(true); PWINDOWINARR->setDirty(true); @@ -416,6 +421,12 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) { return nullptr; } + if (PWINDOWINARR->getClassName() == "Error") { + Debug::log(LOG, "Class error -> we wont manage this."); + return nullptr; + } + + PWINDOWINARR->setIsFloating(false); PWINDOWINARR->setDirty(true); @@ -624,8 +635,8 @@ void Events::eventMapWindow(xcb_generic_event_t* event) { } } - if (!pNewWindow) { - Debug::log(LOG, "Removing, NULLPTR."); + if (!pNewWindow || pNewWindow->getClassName() == "") { + Debug::log(LOG, "Removing, NULL."); g_pWindowManager->removeWindowFromVectorSafe(E->window); return; } diff --git a/src/window.cpp b/src/window.cpp index 038553a..928ae26 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1,8 +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(""); - this->m_tOpenTimestamp = std::chrono::high_resolution_clock::now(); } +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() { } void CWindow::generateNodeID() { diff --git a/src/window.hpp b/src/window.hpp index 8f008cb..805493a 100644 --- a/src/window.hpp +++ b/src/window.hpp @@ -3,7 +3,6 @@ #include "defines.hpp" #include "utilities/Workspace.hpp" #include "utilities/Util.hpp" -#include class CWindow { public: @@ -39,7 +38,6 @@ public: EXPOSED_MEMBER(RoleName, std::string, sz); EXPOSED_MEMBER(Constructed, bool, b); EXPOSED_MEMBER(FirstOpen, bool, b); - EXPOSED_MEMBER(OpenTimestamp, std::chrono::high_resolution_clock::time_point, t); // Tells the window manager to reload the window's params EXPOSED_MEMBER(Dirty, bool, b); diff --git a/src/windowManager.cpp b/src/windowManager.cpp index cb867ee..4e06f23 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -2280,23 +2280,3 @@ void CWindowManager::dispatchQueuedWarp() { warpCursorTo(QueuedPointerWarp); QueuedPointerWarp = Vector2D(-1,-1); } - -void CWindowManager::unmanageUnnamedWindows() { - std::deque toRemove; - - for (auto& w : windows) { - - if (w.getClassName() == "Error" || w.getClassName() == "") { - const auto DELTA = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - w.getOpenTimestamp()).count(); - - if (DELTA > 500) { - Debug::log(LOG, "Class error after 500ms -> we wont manage this."); - toRemove.push_back(w.getDrawable()); - } - } - } - - for (auto& wid : toRemove) { - closeWindowAllChecks(wid); - } -} \ No newline at end of file diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 1210fd1..7afb3db 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -164,7 +164,6 @@ private: void focusOnWorkspace(const int&); void dispatchQueuedWarp(); CWindow* getMasterForWorkspace(const int&); - void unmanageUnnamedWindows(); }; inline std::unique_ptr g_pWindowManager = std::make_unique();