Replaced m_pPreviouslySwallowed with a boolean

This commit is contained in:
Tom Benham 2024-04-12 16:26:01 +02:00
parent 5a520914ac
commit 07848e7f59
4 changed files with 18 additions and 18 deletions

View file

@ -208,7 +208,7 @@ static std::string getWindowData(CWindow* w, eHyprCtlOutputFormat format) {
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)), escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass), escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)), escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass),
escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"), escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
(w->m_bIsFullscreen ? "true" : "false"), (w->m_bIsFullscreen ? (w->m_pWorkspace ? (int)w->m_pWorkspace->m_efFullscreenMode : 0) : 0), (w->m_bIsFullscreen ? "true" : "false"), (w->m_bIsFullscreen ? (w->m_pWorkspace ? (int)w->m_pWorkspace->m_efFullscreenMode : 0) : 0),
w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), (uintptr_t)w->m_pSwallowed, getFocusHistoryID(w)); w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), w->m_bCurrentlySwallowing ? (uintptr_t)w->m_pSwallowed : 0, getFocusHistoryID(w));
} else { } else {
return std::format("Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: " return std::format("Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: "
"{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: " "{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
@ -219,7 +219,7 @@ static std::string getWindowData(CWindow* w, eHyprCtlOutputFormat format) {
(!w->m_pWorkspace ? "" : std::to_string(w->workspaceID())), (int)w->m_bIsFloating, (int64_t)w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w), (!w->m_pWorkspace ? "" : std::to_string(w->workspaceID())), (int)w->m_bIsFloating, (int64_t)w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w),
g_pXWaylandManager->getTitle(w), w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen, g_pXWaylandManager->getTitle(w), w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen,
(w->m_bIsFullscreen ? (w->m_pWorkspace ? w->m_pWorkspace->m_efFullscreenMode : 0) : 0), (int)w->m_bFakeFullscreenState, getGroupedData(w, format), (w->m_bIsFullscreen ? (w->m_pWorkspace ? w->m_pWorkspace->m_efFullscreenMode : 0) : 0), (int)w->m_bFakeFullscreenState, getGroupedData(w, format),
(uintptr_t)w->m_pSwallowed, getFocusHistoryID(w)); w->m_bCurrentlySwallowing ? (uintptr_t)w->m_pSwallowed : 0, getFocusHistoryID(w));
} }
} }

View file

@ -341,8 +341,8 @@ class CWindow {
// swallowing // swallowing
CWindow* m_pSwallowed = nullptr; CWindow* m_pSwallowed = nullptr;
CWindow* m_pPreviouslySwallowed = nullptr;
CWindow* m_pSwallowedBy = nullptr; CWindow* m_pSwallowedBy = nullptr;
bool m_bCurrentlySwallowing = false;
// focus stuff // focus stuff
bool m_bStayFocused = false; bool m_bStayFocused = false;

View file

@ -585,6 +585,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
// swallow // swallow
PWINDOW->m_pSwallowed = finalFound; PWINDOW->m_pSwallowed = finalFound;
finalFound->m_pSwallowedBy = PWINDOW; finalFound->m_pSwallowedBy = PWINDOW;
PWINDOW->m_bCurrentlySwallowing = true;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(finalFound); g_pLayoutManager->getCurrentLayout()->onWindowRemoved(finalFound);

View file

@ -1823,25 +1823,24 @@ void CKeybindManager::focusWindow(std::string regexp) {
void CKeybindManager::toggleSwallow(std::string args) { void CKeybindManager::toggleSwallow(std::string args) {
CWindow* pWindow = g_pCompositor->m_pLastWindow; CWindow* pWindow = g_pCompositor->m_pLastWindow;
if (pWindow->m_pSwallowed) {
pWindow->m_pPreviouslySwallowed = pWindow->m_pSwallowed;
if (!pWindow->m_pSwallowed)
return;
if (pWindow->m_bCurrentlySwallowing) {
// Unswallow
pWindow->m_pSwallowed->setHidden(false); pWindow->m_pSwallowed->setHidden(false);
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed); g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed);
pWindow->m_pSwallowed->m_pSwallowedBy = nullptr; pWindow->m_bCurrentlySwallowing = false;
pWindow->m_pSwallowed = nullptr; } else {
// Reswallow
} else if (pWindow->m_pPreviouslySwallowed) { g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pSwallowed);
pWindow->m_pSwallowed = pWindow->m_pPreviouslySwallowed; pWindow->m_pSwallowed->setHidden(true);
pWindow->m_pSwallowed->m_pSwallowedBy = pWindow;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pPreviouslySwallowed);
pWindow->m_pPreviouslySwallowed->setHidden(true);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pWindow->m_iMonitorID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pWindow->m_iMonitorID);
pWindow->m_bCurrentlySwallowing = true;
} }
} }