summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarksome <dev@darkso.me>2022-08-21 18:01:26 +0300
committerDarksome <dev@darkso.me>2022-08-21 18:01:26 +0300
commitf7f34468823b15e7a6d75710df0bff274a8e1981 (patch)
tree3fde1f547587b0f553ceb269841351b32926de35 /src
parent0f25f3aee36c4f312a3fb36a7abb63fe78f5254e (diff)
CCompositor::moveWindowToWorkspace -> CWindow::moveToWorkspace
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp14
-rw-r--r--src/Compositor.hpp1
-rw-r--r--src/Window.cpp11
-rw-r--r--src/Window.hpp1
-rw-r--r--src/layout/IHyprLayout.cpp4
-rw-r--r--src/managers/KeybindManager.cpp2
6 files changed, 15 insertions, 18 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 3a73c1b4..088440f1 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -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) {
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index 8e380c94..2e8c8dfe 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -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);
diff --git a/src/Window.cpp b/src/Window.cpp
index 926d2da6..e9af0349 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -205,4 +205,15 @@ void CWindow::updateSurfaceOutputs() {
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendLeaveIter, PLASTMONITOR->output);
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())});
+ }
+ }
} \ No newline at end of file
diff --git a/src/Window.hpp b/src/Window.hpp
index 181ae74e..6504ef99 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -151,4 +151,5 @@ public:
void destroyToplevelHandle();
void updateToplevel();
void updateSurfaceOutputs();
+ void moveToWorkspace(int);
};
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index f641ebc1..09ca27c7 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -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();
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index a79c0396..3f2e0a2c 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -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;