CCompositor::moveWindowToWorkspace -> CWindow::moveToWorkspace

This commit is contained in:
Darksome 2022-08-21 18:01:26 +03:00
parent 0f25f3aee3
commit f7f3446882
6 changed files with 15 additions and 18 deletions

View file

@ -884,20 +884,6 @@ void CCompositor::moveWindowToTop(CWindow* pWindow) {
}
}
void CCompositor::moveWindowToWorkspace(CWindow* pWindow, int workspaceID) {
if (!windowValidMapped(pWindow))
return;
if (pWindow->m_iWorkspaceID != workspaceID) {
pWindow->m_iWorkspaceID = workspaceID;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
if (PWORKSPACE) {
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", pWindow, PWORKSPACE->m_szName.c_str())});
}
}
}
void CCompositor::cleanupFadingOut(const int& monid) {
for (auto& w : m_vWindowsFadingOut) {

View file

@ -132,7 +132,6 @@ public:
bool doesSeatAcceptInput(wlr_surface*);
bool isWindowActive(CWindow*);
void moveWindowToTop(CWindow*);
void moveWindowToWorkspace(CWindow*, int);
void cleanupFadingOut(const int& monid);
CWindow* getWindowInDirection(CWindow*, char);
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);

View file

@ -206,3 +206,14 @@ void CWindow::updateSurfaceOutputs() {
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendEnterIter, PNEWMONITOR->output);
}
void CWindow::moveToWorkspace(int workspaceID) {
if (m_iWorkspaceID != workspaceID) {
m_iWorkspaceID = workspaceID;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
if (PWORKSPACE) {
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
}
}
}

View file

@ -151,4 +151,5 @@ public:
void destroyToplevelHandle();
void updateToplevel();
void updateSurfaceOutputs();
void moveToWorkspace(int);
};

View file

@ -206,7 +206,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
if (PMONITOR) {
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
g_pCompositor->moveWindowToWorkspace(DRAGGINGWINDOW, PMONITOR->activeWorkspace);
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
DRAGGINGWINDOW->updateToplevel();
}
@ -231,7 +231,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
if (!TILED) {
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.vec() + pWindow->m_vRealSize.vec() / 2.f);
pWindow->m_iMonitorID = PNEWMON->ID;
g_pCompositor->moveWindowToWorkspace(pWindow, PNEWMON->activeWorkspace);
pWindow->moveToWorkspace(PNEWMON->activeWorkspace);
// save real pos cuz the func applies the default 5,5 mid
const auto PSAVEDPOS = pWindow->m_vRealPosition.vec();

View file

@ -679,7 +679,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
OLDWORKSPACE->m_bHasFullscreenWindow = false;
g_pCompositor->moveWindowToWorkspace(PWINDOW, PWORKSPACE->m_iID);
PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
PWINDOW->m_bIsFullscreen = false;