aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-03-18 16:30:29 +0000
committervaxerski <[email protected]>2023-03-18 16:30:29 +0000
commit2ba5238b8e985bb5944b16ac657bf3653a812c00 (patch)
treea8c8f1f094aab506d505a8ecb8cecad455492c76
parent00c2ca46973f4bbeca3cf51cc7fc363cb10710d7 (diff)
downloadHyprland-2ba5238b8e985bb5944b16ac657bf3653a812c00.tar.gz
Hyprland-2ba5238b8e985bb5944b16ac657bf3653a812c00.zip
groups: fix moving between displays
-rw-r--r--src/Window.cpp37
-rw-r--r--src/Window.hpp1
-rw-r--r--src/layout/IHyprLayout.cpp2
-rw-r--r--src/managers/KeybindManager.cpp3
4 files changed, 34 insertions, 9 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index c1f7a56f..afa9ba7d 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -271,17 +271,21 @@ void CWindow::updateSurfaceOutputs() {
}
void CWindow::moveToWorkspace(int workspaceID) {
- if (m_iWorkspaceID != workspaceID) {
- m_iWorkspaceID = workspaceID;
+ if (m_iWorkspaceID == workspaceID)
+ return;
- if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); PWORKSPACE) {
- g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
- EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
- }
+ m_iWorkspaceID = workspaceID;
- if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); PMONITOR)
- g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(this), PMONITOR->scale);
+ 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())});
+ 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() {
@@ -615,4 +619,21 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
pWindow->m_sGroupData.pNextWindow = PHEAD;
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;
+ }
} \ No newline at end of file
diff --git a/src/Window.hpp b/src/Window.hpp
index 85144e27..acb4bdb6 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -317,6 +317,7 @@ class CWindow {
CWindow* getGroupCurrent();
void setGroupCurrent(CWindow* pWindow);
void insertWindowToGroup(CWindow* pWindow);
+ void updateGroupOutputs();
private:
// For hidden windows and stuff
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 37f8a9b0..c7dff8e9 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -343,6 +343,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
if (PMONITOR && !SPECIAL) {
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
+ DRAGGINGWINDOW->updateGroupOutputs();
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);
pWindow->m_iMonitorID = PNEWMON->ID;
pWindow->moveToWorkspace(PNEWMON->activeWorkspace);
+ pWindow->updateGroupOutputs();
// save real pos cuz the func applies the default 5,5 mid
const auto PSAVEDPOS = pWindow->m_vRealPosition.goalv();
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index d6cffd41..0693a59f 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -986,8 +986,9 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
PWORKSPACE = g_pCompositor->createNewWorkspace(WORKSPACEID, OLDWORKSPACE->m_iMonitorID, workspaceName);
}
- PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
+ PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
+ PWINDOW->updateGroupOutputs();
if (PWORKSPACE->m_bHasFullscreenWindow) {
g_pCompositor->setWindowFullscreen(g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID), false, FULLSCREEN_FULL);