mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 15:25:59 +01:00
move ignore to eventmanager and fix double focus in changeworkspace
This commit is contained in:
parent
ff49f22440
commit
4a3f9ccba2
4 changed files with 12 additions and 12 deletions
|
@ -105,6 +105,12 @@ void CEventManager::startThread() {
|
|||
}
|
||||
|
||||
void CEventManager::postEvent(const SHyprIPCEvent event) {
|
||||
|
||||
if (m_bIgnoreEvents) {
|
||||
Debug::log(WARN, "Suppressed (ignoreevents true) event of type %s, content: %s");
|
||||
return;
|
||||
}
|
||||
|
||||
std::thread([&](const SHyprIPCEvent ev) {
|
||||
eventQueueMutex.lock();
|
||||
m_dQueuedEvents.push_back(ev);
|
||||
|
|
|
@ -19,6 +19,8 @@ public:
|
|||
|
||||
void startThread();
|
||||
|
||||
bool m_bIgnoreEvents = false;
|
||||
|
||||
private:
|
||||
|
||||
std::mutex eventQueueMutex;
|
||||
|
|
|
@ -280,9 +280,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
// start anim on new workspace
|
||||
PWORKSPACETOCHANGETO->startAnim(true, ANIMTOLEFT);
|
||||
|
||||
// Event ONLY if workspace is actually "changed" and we arent just focusing
|
||||
if (!m_bSuppressWorkspaceChangeEvents)
|
||||
g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACETOCHANGETO->m_szName));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACETOCHANGETO->m_szName));
|
||||
}
|
||||
|
||||
// If the monitor is not the one our cursor's at, warp to it.
|
||||
|
@ -291,9 +289,6 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, middle.x, middle.y);
|
||||
}
|
||||
|
||||
// focus the first window
|
||||
g_pCompositor->focusWindow(g_pCompositor->getFirstWindowOnWorkspace(workspaceToChangeTo));
|
||||
|
||||
// set active and deactivate all other in wlr
|
||||
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle);
|
||||
PWORKSPACETOCHANGETO->setActive(true);
|
||||
|
@ -360,8 +355,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
g_pInputManager->refocus();
|
||||
|
||||
// Event
|
||||
if (!m_bSuppressWorkspaceChangeEvents)
|
||||
g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACE->m_szName));
|
||||
g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACE->m_szName));
|
||||
|
||||
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
|
||||
}
|
||||
|
@ -491,7 +485,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
const auto POLDWORKSPACEONMON = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDONMONITOR);
|
||||
const auto POLDWORKSPACEIDRETURN = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDRETURN);
|
||||
|
||||
m_bSuppressWorkspaceChangeEvents = true;
|
||||
g_pEventManager->m_bIgnoreEvents = true;
|
||||
|
||||
moveActiveToWorkspace(args);
|
||||
|
||||
|
@ -510,7 +504,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
POLDWORKSPACEONMON->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(255.f);
|
||||
|
||||
m_bSuppressWorkspaceChangeEvents = false;
|
||||
g_pEventManager->m_bIgnoreEvents = false;
|
||||
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ private:
|
|||
|
||||
bool handleInternalKeybinds(xkb_keysym_t);
|
||||
|
||||
inline static bool m_bSuppressWorkspaceChangeEvents = false;
|
||||
|
||||
// -------------- Dispatchers -------------- //
|
||||
static void killActive(std::string);
|
||||
static void spawn(std::string);
|
||||
|
|
Loading…
Reference in a new issue