mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 16:06:00 +01:00
Merge pull request #557 from xDarksome/main
Add window{open/close/move} IPC events (#549)
This commit is contained in:
commit
c4ba11729f
5 changed files with 21 additions and 4 deletions
|
@ -206,3 +206,14 @@ void CWindow::updateSurfaceOutputs() {
|
||||||
|
|
||||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendEnterIter, PNEWMONITOR->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())});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -151,4 +151,5 @@ public:
|
||||||
void destroyToplevelHandle();
|
void destroyToplevelHandle();
|
||||||
void updateToplevel();
|
void updateToplevel();
|
||||||
void updateSurfaceOutputs();
|
void updateSurfaceOutputs();
|
||||||
|
void moveToWorkspace(int);
|
||||||
};
|
};
|
||||||
|
|
|
@ -331,6 +331,9 @@ 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) {
|
||||||
|
@ -338,6 +341,8 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
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{"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");
|
||||||
PWINDOW->hyprListener_commitWindow.removeCallback();
|
PWINDOW->hyprListener_commitWindow.removeCallback();
|
||||||
|
|
|
@ -206,7 +206,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
||||||
|
|
||||||
if (PMONITOR) {
|
if (PMONITOR) {
|
||||||
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||||
DRAGGINGWINDOW->m_iWorkspaceID = PMONITOR->activeWorkspace;
|
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
DRAGGINGWINDOW->updateToplevel();
|
DRAGGINGWINDOW->updateToplevel();
|
||||||
}
|
}
|
||||||
|
@ -231,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;
|
pWindow->moveToWorkspace(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();
|
||||||
|
|
|
@ -717,7 +717,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
|
|
||||||
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
||||||
|
|
||||||
PWINDOW->m_iWorkspaceID = PWORKSPACE->m_iID;
|
PWINDOW->moveToWorkspace(PWORKSPACE->m_iID);
|
||||||
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
PWINDOW->m_iMonitorID = PWORKSPACE->m_iMonitorID;
|
||||||
PWINDOW->m_bIsFullscreen = false;
|
PWINDOW->m_bIsFullscreen = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue