mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:05:58 +01:00
fix dwindle monitors
This commit is contained in:
parent
7d8e8a05c2
commit
3d41dd6c25
2 changed files with 9 additions and 9 deletions
|
@ -47,14 +47,14 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
|||
try {
|
||||
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)
|
||||
PWINDOW->m_iMonitorID = 0;
|
||||
else
|
||||
PWINDOW->m_iMonitorID = MONITOR;
|
||||
|
||||
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 (...) {
|
||||
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)
|
||||
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) {
|
||||
|
|
|
@ -42,7 +42,7 @@ int CHyprDwindleLayout::getNodesOnWorkspace(const int& id) {
|
|||
|
||||
SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnWorkspace(const int& id) {
|
||||
for (auto& n : m_lDwindleNodesData) {
|
||||
if (n.workspaceID == id)
|
||||
if (n.workspaceID == id && n.pWindow && g_pCompositor->windowValidMapped(n.pWindow))
|
||||
return &n;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -130,13 +130,15 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||
SDwindleNodeData* OPENINGON;
|
||||
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
||||
|
||||
if (PMONITOR == MONFROMCURSOR)
|
||||
if (PMONITOR->ID == MONFROMCURSOR->ID)
|
||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
||||
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 (!OPENINGON) {
|
||||
if (!OPENINGON || OPENINGON->pWindow == pWindow) {
|
||||
PNODE->position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
|
||||
PNODE->size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight;
|
||||
|
||||
|
@ -199,8 +201,6 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||
}
|
||||
|
||||
void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
||||
return;
|
||||
|
||||
const auto PNODE = getNodeFromWindow(pWindow);
|
||||
|
||||
|
|
Loading…
Reference in a new issue