mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 20:05:58 +01:00
fix events in changeworkspace with bound ws-es
This commit is contained in:
parent
d2a7e22efd
commit
5d39223239
1 changed files with 12 additions and 2 deletions
|
@ -755,7 +755,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the monitor is not the one our cursor's at, warp to it.
|
// If the monitor is not the one our cursor's at, warp to it.
|
||||||
const bool anotherMonitor = PMONITOR != g_pCompositor->getMonitorFromCursor();
|
const bool anotherMonitor = PMONITOR != g_pCompositor->m_pLastMonitor;
|
||||||
if (anotherMonitor) {
|
if (anotherMonitor) {
|
||||||
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
||||||
g_pCompositor->warpCursorTo(middle);
|
g_pCompositor->warpCursorTo(middle);
|
||||||
|
@ -812,6 +812,8 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->createNewWorkspace(workspaceToChangeTo, PMONITOR->ID, workspaceName);
|
const auto PWORKSPACE = g_pCompositor->createNewWorkspace(workspaceToChangeTo, PMONITOR->ID, workspaceName);
|
||||||
|
|
||||||
|
const bool ANOTHERMONITOR = PMONITOR == g_pCompositor->m_pLastMonitor;
|
||||||
|
|
||||||
if (!isSwitchingToPrevious)
|
if (!isSwitchingToPrevious)
|
||||||
// Remember previous workspace.
|
// Remember previous workspace.
|
||||||
PWORKSPACE->m_iPrevWorkspaceID = OLDWORKSPACE;
|
PWORKSPACE->m_iPrevWorkspaceID = OLDWORKSPACE;
|
||||||
|
@ -849,8 +851,16 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
// focus (clears the last)
|
// focus (clears the last)
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
// Event
|
// Events
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACE->m_szName});
|
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACE->m_szName});
|
||||||
|
if (ANOTHERMONITOR) {
|
||||||
|
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
|
||||||
|
g_pCompositor->warpCursorTo(middle);
|
||||||
|
|
||||||
|
// event for focusedmon, as we changed.
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", PMONITOR->szName + "," + PWORKSPACE->m_szName});
|
||||||
|
g_pCompositor->m_pLastMonitor = PMONITOR;
|
||||||
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
|
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue