mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 14:26:00 +01:00
groups: fix moving between displays
This commit is contained in:
parent
00c2ca4697
commit
2ba5238b8e
4 changed files with 34 additions and 9 deletions
|
@ -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)
|
||||||
m_iWorkspaceID = workspaceID;
|
return;
|
||||||
|
|
||||||
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); PWORKSPACE) {
|
m_iWorkspaceID = workspaceID;
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
|
|
||||||
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); PMONITOR)
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(this), PMONITOR->scale);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
|
||||||
|
|
||||||
|
if (PWORKSPACE) {
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
|
||||||
|
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PMONITOR)
|
||||||
|
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(this), PMONITOR->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::X11TransientFor() {
|
CWindow* CWindow::X11TransientFor() {
|
||||||
|
@ -615,4 +619,21 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
|
||||||
pWindow->m_sGroupData.pNextWindow = PHEAD;
|
pWindow->m_sGroupData.pNextWindow = PHEAD;
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue