layout: Fix toggling fullscreen special workspace on different monitor (#5000)

* fix toggling fullscreen special ws on different monitor

* add for dwindle

* fix change regular workspace when special fullscreen
This commit is contained in:
thejch 2024-03-07 05:27:58 -08:00 committed by GitHub
parent bf71026b8d
commit 6c4e2489a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 53 additions and 0 deletions

View File

@ -603,6 +603,12 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal, bool
g_pConfigManager->ensureVRR(this);
g_pCompositor->updateSuspendedStates();
if (specialWorkspaceID) {
const auto PSPECIALWS = g_pCompositor->getWorkspaceByID(specialWorkspaceID);
if (PSPECIALWS->m_bHasFullscreenWindow)
g_pCompositor->updateFullscreenFadeOnWorkspace(PSPECIALWS);
}
}
void CMonitor::changeWorkspace(const int& id, bool internal, bool noMouseMove, bool noFocus) {
@ -649,6 +655,10 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
PMONITORWORKSPACEOWNER->specialWorkspaceID = 0;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITORWORKSPACEOWNER->ID);
g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", "," + PMONITORWORKSPACEOWNER->szName});
const auto PACTIVEWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITORWORKSPACEOWNER->activeWorkspace);
g_pCompositor->updateFullscreenFadeOnWorkspace(PACTIVEWORKSPACE);
animate = false;
}

View File

@ -549,6 +549,27 @@ void CHyprDwindleLayout::recalculateMonitor(const int& monid) {
g_pHyprRenderer->damageMonitor(PMONITOR);
if (PMONITOR->specialWorkspaceID) {
const auto PSPECIALWS = g_pCompositor->getWorkspaceByID(PMONITOR->specialWorkspaceID);
if (PSPECIALWS->m_bHasFullscreenWindow) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PSPECIALWS->m_iID);
if (PSPECIALWS->m_efFullscreenMode == FULLSCREEN_FULL) {
PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
} else if (PSPECIALWS->m_efFullscreenMode == FULLSCREEN_MAXIMIZED) {
SDwindleNodeData fakeNode;
fakeNode.pWindow = PFULLWINDOW;
fakeNode.box = {PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight};
fakeNode.workspaceID = PSPECIALWS->m_iID;
PFULLWINDOW->m_vPosition = fakeNode.box.pos();
PFULLWINDOW->m_vSize = fakeNode.box.size();
fakeNode.ignoreFullscreenChecks = true;
applyNodeDataToWindow(&fakeNode);
}
}
const auto TOPNODE = getMasterNodeOnWorkspace(PMONITOR->specialWorkspaceID);
if (TOPNODE && PMONITOR) {

View File

@ -296,6 +296,28 @@ void CHyprMasterLayout::recalculateMonitor(const int& monid) {
g_pHyprRenderer->damageMonitor(PMONITOR);
if (PMONITOR->specialWorkspaceID) {
const auto PSPECIALWS = g_pCompositor->getWorkspaceByID(PMONITOR->specialWorkspaceID);
if (PSPECIALWS->m_bHasFullscreenWindow) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PSPECIALWS->m_iID);
if (PSPECIALWS->m_efFullscreenMode == FULLSCREEN_FULL) {
PFULLWINDOW->m_vRealPosition = PMONITOR->vecPosition;
PFULLWINDOW->m_vRealSize = PMONITOR->vecSize;
} else if (PSPECIALWS->m_efFullscreenMode == FULLSCREEN_MAXIMIZED) {
SMasterNodeData fakeNode;
fakeNode.pWindow = PFULLWINDOW;
fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight;
fakeNode.workspaceID = PSPECIALWS->m_iID;
PFULLWINDOW->m_vPosition = fakeNode.position;
PFULLWINDOW->m_vSize = fakeNode.size;
fakeNode.ignoreFullscreenChecks = true;
applyNodeDataToWindow(&fakeNode);
}
}
calculateWorkspace(PMONITOR->specialWorkspaceID);
}