mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 23:49:49 +01:00
add a focus history vec
This commit is contained in:
parent
6f3548b184
commit
fb2679d5ef
3 changed files with 14 additions and 0 deletions
|
@ -865,6 +865,14 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
|||
}
|
||||
|
||||
g_pInputManager->recheckIdleInhibitorStatus();
|
||||
|
||||
// move to front of the window history
|
||||
const auto HISTORYPIVOT = std::find_if(m_vWindowFocusHistory.begin(), m_vWindowFocusHistory.end(), [&](const auto& other) { return other == pWindow; });
|
||||
if (HISTORYPIVOT == m_vWindowFocusHistory.end()) {
|
||||
Debug::log(ERR, "BUG THIS: Window %x has no pivot in history", pWindow);
|
||||
} else {
|
||||
std::rotate(m_vWindowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
||||
|
|
|
@ -96,6 +96,8 @@ class CCompositor {
|
|||
CWindow* m_pLastWindow = nullptr;
|
||||
CMonitor* m_pLastMonitor = nullptr;
|
||||
|
||||
std::vector<CWindow*> m_vWindowFocusHistory; // first element is the most recently focused.
|
||||
|
||||
SSeat m_sSeat;
|
||||
|
||||
bool m_bReadyToProcess = false;
|
||||
|
|
|
@ -267,6 +267,8 @@ void CWindow::onUnmap() {
|
|||
m_fDimPercent.setCallbackOnEnd(unregisterVar);
|
||||
|
||||
m_vRealSize.setCallbackOnBegin(nullptr);
|
||||
|
||||
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other == this; });
|
||||
}
|
||||
|
||||
void CWindow::onMap() {
|
||||
|
@ -290,6 +292,8 @@ void CWindow::onMap() {
|
|||
|
||||
m_vRealSize.setCallbackOnEnd([&](void* ptr) { g_pHyprOpenGL->onWindowResizeEnd(this); }, false);
|
||||
m_vRealSize.setCallbackOnBegin([&](void* ptr) { g_pHyprOpenGL->onWindowResizeStart(this); }, false);
|
||||
|
||||
g_pCompositor->m_vWindowFocusHistory.push_back(this);
|
||||
}
|
||||
|
||||
void CWindow::setHidden(bool hidden) {
|
||||
|
|
Loading…
Reference in a new issue