workspace: small work towards better per-output VDs handling

This commit is contained in:
Yuki Joou 2024-09-16 14:10:30 +02:00
parent 67e3eddf0a
commit 94e2ce9129
2 changed files with 8 additions and 3 deletions

View file

@ -46,6 +46,7 @@ Window *FocusChain::getForActivation(VirtualDesktop *desktop) const
Window *FocusChain::getForActivation(VirtualDesktop *desktop, Output *output) const Window *FocusChain::getForActivation(VirtualDesktop *desktop, Output *output) const
{ {
qInfo("getForActivation");
// TODO: Find windows on other dedsktops that are also currently visible. // TODO: Find windows on other dedsktops that are also currently visible.
auto it = m_desktopFocusChains.constFind(desktop); auto it = m_desktopFocusChains.constFind(desktop);
if (it == m_desktopFocusChains.constEnd()) { if (it == m_desktopFocusChains.constEnd()) {

View file

@ -1015,6 +1015,7 @@ void Workspace::activateWindowOnNewDesktop(VirtualDesktop *desktop)
Window *Workspace::findWindowToActivateOnDesktop(VirtualDesktop *desktop) Window *Workspace::findWindowToActivateOnDesktop(VirtualDesktop *desktop)
{ {
qInfo("findWindowToActivateOnDesktop");
if (m_moveResizeWindow != nullptr && m_activeWindow == m_moveResizeWindow && m_focusChain->contains(m_activeWindow, desktop) && m_activeWindow->isShown() && m_activeWindow->isOnCurrentDesktop()) { if (m_moveResizeWindow != nullptr && m_activeWindow == m_moveResizeWindow && m_focusChain->contains(m_activeWindow, desktop) && m_activeWindow->isShown() && m_activeWindow->isOnCurrentDesktop()) {
// A requestFocus call will fail, as the window is already active // A requestFocus call will fail, as the window is already active
return m_activeWindow; return m_activeWindow;
@ -1111,11 +1112,13 @@ void Workspace::updateCurrentActivity(const QString &new_activity)
window = m_activeWindow; window = m_activeWindow;
} else if (options->focusPolicyIsReasonable()) { } else if (options->focusPolicyIsReasonable()) {
// Search in focus chain // Search in focus chain
window = m_focusChain->getForActivation(VirtualDesktopManager::self()->currentDesktop()); // TODO: Maybe we should give more info to the focuschain for it to find a more suitable window?
window = m_focusChain->getForActivation(VirtualDesktopManager::self()->currentDesktop(window->output()));
} }
if (!window) { if (!window) {
window = findDesktop(true, VirtualDesktopManager::self()->currentDesktop()); // TODO: Maybe we should give more info to the focuschain for it to find a more suitable window?
window = findDesktop(true, VirtualDesktopManager::self()->currentDesktop(window->output()));
} }
if (window != m_activeWindow) { if (window != m_activeWindow) {
@ -2441,7 +2444,8 @@ QRectF Workspace::clientArea(clientAreaOption opt, const Window *window, const O
{ {
const VirtualDesktop *desktop; const VirtualDesktop *desktop;
if (window->isOnCurrentDesktop()) { if (window->isOnCurrentDesktop()) {
desktop = VirtualDesktopManager::self()->currentDesktop(); // TODO: This will likely need serious refactoring in case support for different virtual desktop layouts per-output is needed? Or maybe I just don't undestand how this works at all.
desktop = VirtualDesktopManager::self()->currentDesktop(window->output());
} else { } else {
desktop = window->desktops().constLast(); desktop = window->desktops().constLast();
} }