mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 21:45:58 +01:00
don't find a new candidate to refocus on unfocused unmap
This commit is contained in:
parent
29696d046e
commit
9366c187dc
1 changed files with 19 additions and 12 deletions
|
@ -370,7 +370,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
// Allow the renderer to catch the last frame.
|
// Allow the renderer to catch the last frame.
|
||||||
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
|
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
|
||||||
|
|
||||||
|
bool wasLastWindow = false;
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
||||||
|
wasLastWindow = true;
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow = nullptr;
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -388,22 +391,26 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
// do this after onWindowRemoved because otherwise it'll think the window is invalid
|
// do this after onWindowRemoved because otherwise it'll think the window is invalid
|
||||||
PWINDOW->m_bIsMapped = false;
|
PWINDOW->m_bIsMapped = false;
|
||||||
|
|
||||||
// refocus on a new window
|
// refocus on a new window if needed
|
||||||
auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f);
|
if (wasLastWindow) {
|
||||||
|
auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f);
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && (!PWINDOWCANDIDATE->m_bCreatedOverFullscreen || !PWINDOW->m_bIsFloating))
|
if (PWORKSPACE->m_bHasFullscreenWindow && (!PWINDOWCANDIDATE->m_bCreatedOverFullscreen || !PWINDOW->m_bIsFloating))
|
||||||
PWINDOWCANDIDATE = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
PWINDOWCANDIDATE = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
||||||
|
|
||||||
if (!PWINDOWCANDIDATE || PWINDOW == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->m_bHidden || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
if (!PWINDOWCANDIDATE || PWINDOW == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->m_bHidden || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
||||||
PWINDOWCANDIDATE = nullptr;
|
PWINDOWCANDIDATE = nullptr;
|
||||||
|
|
||||||
Debug::log(LOG, "On closed window, new focused candidate is %x", PWINDOWCANDIDATE);
|
Debug::log(LOG, "On closed window, new focused candidate is %x", PWINDOWCANDIDATE);
|
||||||
|
|
||||||
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow) {
|
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow) {
|
||||||
if (!PWINDOWCANDIDATE)
|
if (!PWINDOWCANDIDATE)
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
else
|
else
|
||||||
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
|
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
|
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
|
||||||
|
|
Loading…
Reference in a new issue