mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-21 10:48:24 +00:00
groups: fix moving between displays
This commit is contained in:
@@ -271,17 +271,21 @@ void CWindow::updateSurfaceOutputs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::moveToWorkspace(int workspaceID) {
|
void CWindow::moveToWorkspace(int workspaceID) {
|
||||||
if (m_iWorkspaceID != workspaceID) {
|
if (m_iWorkspaceID == workspaceID)
|
||||||
|
return;
|
||||||
|
|
||||||
m_iWorkspaceID = workspaceID;
|
m_iWorkspaceID = workspaceID;
|
||||||
|
|
||||||
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); PWORKSPACE) {
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
|
||||||
|
|
||||||
|
if (PWORKSPACE) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
|
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
|
||||||
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
|
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); PMONITOR)
|
if (PMONITOR)
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(this), PMONITOR->scale);
|
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(this), PMONITOR->scale);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::X11TransientFor() {
|
CWindow* CWindow::X11TransientFor() {
|
||||||
@@ -616,3 +620,20 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
|
|||||||
|
|
||||||
setGroupCurrent(pWindow);
|
setGroupCurrent(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWindow::updateGroupOutputs() {
|
||||||
|
if (!m_sGroupData.pNextWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CWindow* curr = m_sGroupData.pNextWindow;
|
||||||
|
|
||||||
|
while (curr != this) {
|
||||||
|
curr->m_iMonitorID = m_iMonitorID;
|
||||||
|
curr->moveToWorkspace(m_iWorkspaceID);
|
||||||
|
|
||||||
|
curr->m_vRealPosition = m_vRealPosition.goalv();
|
||||||
|
curr->m_vRealSize = m_vRealSize.goalv();
|
||||||
|
|
||||||
|
curr = curr->m_sGroupData.pNextWindow;
|
||||||
|
}
|
||||||
|
}
|
@@ -317,6 +317,7 @@ class CWindow {
|
|||||||
CWindow* getGroupCurrent();
|
CWindow* getGroupCurrent();
|
||||||
void setGroupCurrent(CWindow* pWindow);
|
void setGroupCurrent(CWindow* pWindow);
|
||||||
void insertWindowToGroup(CWindow* pWindow);
|
void insertWindowToGroup(CWindow* pWindow);
|
||||||
|
void updateGroupOutputs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For hidden windows and stuff
|
// For hidden windows and stuff
|
||||||
|
@@ -343,6 +343,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||||||
if (PMONITOR && !SPECIAL) {
|
if (PMONITOR && !SPECIAL) {
|
||||||
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||||
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
|
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
DRAGGINGWINDOW->updateGroupOutputs();
|
||||||
|
|
||||||
DRAGGINGWINDOW->updateToplevel();
|
DRAGGINGWINDOW->updateToplevel();
|
||||||
}
|
}
|
||||||
@@ -374,6 +375,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
|||||||
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.vec() + pWindow->m_vRealSize.vec() / 2.f);
|
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.vec() + pWindow->m_vRealSize.vec() / 2.f);
|
||||||
pWindow->m_iMonitorID = PNEWMON->ID;
|
pWindow->m_iMonitorID = PNEWMON->ID;
|
||||||
pWindow->moveToWorkspace(PNEWMON->activeWorkspace);
|
pWindow->moveToWorkspace(PNEWMON->activeWorkspace);
|
||||||
|
pWindow->updateGroupOutputs();
|
||||||
|
|
||||||
// save real pos cuz the func applies the default 5,5 mid
|
// save real pos cuz the func applies the default 5,5 mid
|
||||||
const auto PSAVEDPOS = pWindow->m_vRealPosition.goalv();
|
const auto PSAVEDPOS = pWindow->m_vRealPosition.goalv();
|
||||||
|
@@ -986,8 +986,9 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||||||
PWORKSPACE = g_pCompositor->createNewWorkspace(WORKSPACEID, OLDWORKSPACE->m_iMonitorID, workspaceName);
|
PWORKSPACE = g_pCompositor->createNewWorkspace(WORKSPACEID, OLDWORKSPACE->m_iMonitorID, workspaceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
|
|
||||||
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
||||||
|
PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
|
||||||
|
PWINDOW->updateGroupOutputs();
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||||
g_pCompositor->setWindowFullscreen(g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID), false, FULLSCREEN_FULL);
|
g_pCompositor->setWindowFullscreen(g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID), false, FULLSCREEN_FULL);
|
||||||
|
Reference in New Issue
Block a user