mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-30 03:45:59 +01:00
Impl CCompositor::moveWindowToWorkspace
This commit is contained in:
parent
844c33c980
commit
37e1450a4d
5 changed files with 23 additions and 16 deletions
|
@ -876,6 +876,20 @@ 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) {
|
void CCompositor::cleanupFadingOut(const int& monid) {
|
||||||
for (auto& w : m_vWindowsFadingOut) {
|
for (auto& w : m_vWindowsFadingOut) {
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ public:
|
||||||
bool doesSeatAcceptInput(wlr_surface*);
|
bool doesSeatAcceptInput(wlr_surface*);
|
||||||
bool isWindowActive(CWindow*);
|
bool isWindowActive(CWindow*);
|
||||||
void moveWindowToTop(CWindow*);
|
void moveWindowToTop(CWindow*);
|
||||||
|
void moveWindowToWorkspace(CWindow*, int);
|
||||||
void cleanupFadingOut(const int& monid);
|
void cleanupFadingOut(const int& monid);
|
||||||
CWindow* getWindowInDirection(CWindow*, char);
|
CWindow* getWindowInDirection(CWindow*, char);
|
||||||
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);
|
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);
|
||||||
|
|
|
@ -295,8 +295,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
|
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
|
||||||
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
|
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"mapwindow", getFormat("%x,%s,%s,%s", PWINDOW, PWORKSPACE->m_szName.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
|
|
||||||
|
|
||||||
if (workspaceSilent) {
|
if (workspaceSilent) {
|
||||||
// move the window
|
// move the window
|
||||||
if (g_pCompositor->m_pLastWindow == PWINDOW) {
|
if (g_pCompositor->m_pLastWindow == PWINDOW) {
|
||||||
|
@ -331,13 +329,17 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->updateToplevel();
|
PWINDOW->updateToplevel();
|
||||||
|
|
||||||
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
||||||
|
|
||||||
|
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
CWindow* PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
Debug::log(LOG, "Window %x unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
|
Debug::log(LOG, "Window %x unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"unmapwindow", getFormat("%x", PWINDOW)});
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%x", PWINDOW)});
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsX11) {
|
if (!PWINDOW->m_bIsX11) {
|
||||||
Debug::log(LOG, "Unregistered late callbacks XDG");
|
Debug::log(LOG, "Unregistered late callbacks XDG");
|
||||||
|
|
|
@ -206,15 +206,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
||||||
|
|
||||||
if (PMONITOR) {
|
if (PMONITOR) {
|
||||||
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||||
|
g_pCompositor->moveWindowToWorkspace(DRAGGINGWINDOW, PMONITOR->activeWorkspace);
|
||||||
if (DRAGGINGWINDOW->m_iWorkspaceID != PMONITOR->activeWorkspace) {
|
|
||||||
DRAGGINGWINDOW->m_iWorkspaceID = PMONITOR->activeWorkspace;
|
|
||||||
|
|
||||||
auto PWORKSPACE = g_pCompositor->getWorkspaceByID(DRAGGINGWINDOW->m_iWorkspaceID);
|
|
||||||
if (PWORKSPACE) {
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", DRAGGINGWINDOW, PWORKSPACE->m_szName.c_str())});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DRAGGINGWINDOW->updateToplevel();
|
DRAGGINGWINDOW->updateToplevel();
|
||||||
}
|
}
|
||||||
|
@ -239,7 +231,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
if (!TILED) {
|
if (!TILED) {
|
||||||
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->m_iWorkspaceID = PNEWMON->activeWorkspace;
|
g_pCompositor->moveWindowToWorkspace(pWindow, PNEWMON->activeWorkspace);
|
||||||
|
|
||||||
// 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.vec();
|
const auto PSAVEDPOS = pWindow->m_vRealPosition.vec();
|
||||||
|
|
|
@ -629,7 +629,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
|
|
||||||
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
||||||
|
|
||||||
PWINDOW->m_iWorkspaceID = PWORKSPACE->m_iID;
|
g_pCompositor->moveWindowToWorkspace(PWINDOW, PWORKSPACE->m_iID);
|
||||||
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
||||||
PWINDOW->m_bIsFullscreen = false;
|
PWINDOW->m_bIsFullscreen = false;
|
||||||
|
|
||||||
|
@ -670,8 +670,6 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
PWINDOW->updateToplevel();
|
PWINDOW->updateToplevel();
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", PWINDOW, PWORKSPACE->m_szName.c_str())});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
|
|
Loading…
Reference in a new issue