mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 05:45:59 +01:00
workspace: remove lastFocusedWindow on unmap
This commit is contained in:
parent
af3a61a4e4
commit
2e5b146e57
2 changed files with 12 additions and 0 deletions
|
@ -30,6 +30,13 @@ CWorkspace::CWorkspace(int id, int monitorID, std::string name, bool special) {
|
|||
m_szName = rule.defaultName.value();
|
||||
}
|
||||
|
||||
m_pFocusedWindowHook = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
const auto PWINDOW = std::any_cast<CWindow*>(param);
|
||||
|
||||
if (PWINDOW == m_pLastFocusedWindow)
|
||||
m_pLastFocusedWindow = nullptr;
|
||||
});
|
||||
|
||||
g_pEventManager->postEvent({"createworkspace", m_szName});
|
||||
g_pEventManager->postEvent({"createworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
||||
EMIT_HOOK_EVENT("createWorkspace", this);
|
||||
|
@ -40,6 +47,8 @@ CWorkspace::~CWorkspace() {
|
|||
|
||||
Debug::log(LOG, "Destroying workspace ID {}", m_iID);
|
||||
|
||||
g_pHookSystem->unhook(m_pFocusedWindowHook);
|
||||
|
||||
g_pEventManager->postEvent({"destroyworkspace", m_szName});
|
||||
g_pEventManager->postEvent({"destroyworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
||||
EMIT_HOOK_EVENT("destroyWorkspace", this);
|
||||
|
|
|
@ -66,4 +66,7 @@ class CWorkspace {
|
|||
std::string getConfigName();
|
||||
|
||||
bool matchesStaticSelector(const std::string& selector);
|
||||
|
||||
private:
|
||||
HOOK_CALLBACK_FN* m_pFocusedWindowHook = nullptr;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue