Add mapwindow, unmapwindow and movewindow IPC events

This commit is contained in:
Darksome 2022-08-18 22:23:28 +03:00
parent 4c1dba643e
commit 844c33c980
3 changed files with 14 additions and 1 deletions

View file

@ -295,6 +295,8 @@ 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) {
@ -335,6 +337,7 @@ 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)});
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
Debug::log(LOG, "Unregistered late callbacks XDG"); Debug::log(LOG, "Unregistered late callbacks XDG");

View file

@ -206,7 +206,15 @@ 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;
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();
} }

View file

@ -670,6 +670,8 @@ 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) {