fix dwindle monitors

This commit is contained in:
vaxerski 2022-03-24 19:05:25 +01:00
parent 7d8e8a05c2
commit 3d41dd6c25
2 changed files with 9 additions and 9 deletions

View file

@ -47,14 +47,14 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
try { try {
const long int MONITOR = std::stoi(r.szRule.substr(r.szRule.find(" "))); const long int MONITOR = std::stoi(r.szRule.substr(r.szRule.find(" ")));
Debug::log(LOG, "Rule monitor, applying to window %x", PWINDOW);
if (MONITOR >= (long int)g_pCompositor->m_lMonitors.size() || MONITOR < (long int)0) if (MONITOR >= (long int)g_pCompositor->m_lMonitors.size() || MONITOR < (long int)0)
PWINDOW->m_iMonitorID = 0; PWINDOW->m_iMonitorID = 0;
else else
PWINDOW->m_iMonitorID = MONITOR; PWINDOW->m_iMonitorID = MONITOR;
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace; PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace;
Debug::log(LOG, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
} catch (...) { } catch (...) {
Debug::log(LOG, "Rule monitor failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str()); Debug::log(LOG, "Rule monitor failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
} }
@ -106,7 +106,7 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
if (!PWINDOW->m_bIsModal) if (!PWINDOW->m_bIsModal)
g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PWINDOW);
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.x, PWINDOW->m_vRealPosition.y, PWINDOW->m_vRealSize.x, PWINDOW->m_vRealSize.y); Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vEffectivePosition.x, PWINDOW->m_vEffectivePosition.y, PWINDOW->m_vEffectiveSize.x, PWINDOW->m_vEffectiveSize.y);
} }
void Events::listener_unmapWindow(wl_listener* listener, void* data) { void Events::listener_unmapWindow(wl_listener* listener, void* data) {

View file

@ -42,7 +42,7 @@ int CHyprDwindleLayout::getNodesOnWorkspace(const int& id) {
SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnWorkspace(const int& id) { SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnWorkspace(const int& id) {
for (auto& n : m_lDwindleNodesData) { for (auto& n : m_lDwindleNodesData) {
if (n.workspaceID == id) if (n.workspaceID == id && n.pWindow && g_pCompositor->windowValidMapped(n.pWindow))
return &n; return &n;
} }
return nullptr; return nullptr;
@ -130,13 +130,15 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
SDwindleNodeData* OPENINGON; SDwindleNodeData* OPENINGON;
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor(); const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
if (PMONITOR == MONFROMCURSOR) if (PMONITOR->ID == MONFROMCURSOR->ID)
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal())); OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
else else
OPENINGON = getFirstNodeOnWorkspace(MONFROMCURSOR->activeWorkspace); OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
Debug::log(LOG, "OPENINGON: %x, Workspace: %i, Monitor: %i", OPENINGON, PNODE->workspaceID, PMONITOR->ID);
// if it's the first, it's easy. Make it fullscreen. // if it's the first, it's easy. Make it fullscreen.
if (!OPENINGON) { if (!OPENINGON || OPENINGON->pWindow == pWindow) {
PNODE->position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; PNODE->position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
PNODE->size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; PNODE->size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight;
@ -199,8 +201,6 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
} }
void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) { void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
if (!g_pCompositor->windowValidMapped(pWindow))
return;
const auto PNODE = getNodeFromWindow(pWindow); const auto PNODE = getNodeFromWindow(pWindow);