mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-12-26 03:09:49 +01:00
give bullshit windows 500ms to unbullshit themselves before unmanaging
This commit is contained in:
parent
d8c819fe7f
commit
e886d957d9
5 changed files with 27 additions and 14 deletions
|
@ -175,11 +175,6 @@ 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);
|
||||
|
||||
|
@ -421,12 +416,6 @@ 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);
|
||||
|
||||
|
@ -635,8 +624,8 @@ void Events::eventMapWindow(xcb_generic_event_t* event) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!pNewWindow || pNewWindow->getClassName() == "") {
|
||||
Debug::log(LOG, "Removing, NULL.");
|
||||
if (!pNewWindow) {
|
||||
Debug::log(LOG, "Removing, NULLPTR.");
|
||||
g_pWindowManager->removeWindowFromVectorSafe(E->window);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#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->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() { }
|
||||
|
||||
void CWindow::generateNodeID() {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "defines.hpp"
|
||||
#include "utilities/Workspace.hpp"
|
||||
#include "utilities/Util.hpp"
|
||||
#include <chrono>
|
||||
|
||||
class CWindow {
|
||||
public:
|
||||
|
@ -38,6 +39,7 @@ 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);
|
||||
|
|
|
@ -2277,3 +2277,23 @@ void CWindowManager::dispatchQueuedWarp() {
|
|||
warpCursorTo(QueuedPointerWarp);
|
||||
QueuedPointerWarp = Vector2D(-1,-1);
|
||||
}
|
||||
|
||||
void CWindowManager::unmanageUnnamedWindows() {
|
||||
std::deque<int64_t> toRemove;
|
||||
|
||||
for (auto& w : windows) {
|
||||
|
||||
if (w.getClassName() == "Error" || w.getClassName() == "") {
|
||||
const auto DELTA = std::chrono::duration_cast<std::chrono::milliseconds>(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);
|
||||
}
|
||||
}
|
|
@ -164,6 +164,7 @@ private:
|
|||
void focusOnWorkspace(const int&);
|
||||
void dispatchQueuedWarp();
|
||||
CWindow* getMasterForWorkspace(const int&);
|
||||
void unmanageUnnamedWindows();
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CWindowManager> g_pWindowManager = std::make_unique<CWindowManager>();
|
||||
|
|
Loading…
Reference in a new issue