fix incorrect opens when focused on different monitor

This commit is contained in:
vaxerski 2022-01-08 20:21:46 +01:00
parent fb190885d9
commit d8c819fe7f
1 changed files with 5 additions and 0 deletions

View File

@ -462,6 +462,11 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
}
}
if (g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow) && forcemonitor == -1 && PMONITOR->ID != g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow)->getMonitor()) {
// If the monitor of the last window doesnt match the current screen force the monitor of the cursor
forcemonitor = PMONITOR->ID;
}
const auto CURRENTSCREEN = forcemonitor != -1 ? forcemonitor : PMONITOR->ID;
PWINDOWINARR->setWorkspaceID(g_pWindowManager->activeWorkspaces[CURRENTSCREEN]);
PWINDOWINARR->setMonitor(CURRENTSCREEN);