Summary: | Losing focus of active application window when switching | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | bastimeyer123 |
Component: | activities | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | baltasardelsol, cfeller, kde, kevin.guertin, nate, plasma-bugs-null |
Priority: | NOR | Keywords: | regression |
Version First Reported In: | 5.24.0 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
bastimeyer123
2022-02-09 16:55:12 UTC
Perhaps it's related to wayland-related fixes. Has the source of this bug been found? The issue is still present after upgrading to 5.24.2. What can I do to help getting this resolved?
I use two activies on my desktop, one for regular usage and one for work related stuff, and switching activities is PAINFUL because of this bug, because focus of the active window is lost every single time, and a mouse click, alt+tab or toggling the desktop-grid is required in order to regain focus, which is incredibly annoying.
Please don't ignore this bug.
> Perhaps it's related to wayland-related fixes.
I'm on X11, btw.
Could this commit be related? https://invent.kde.org/plasma/kwin/-/commit/b1686fd4729798f04ddf5980b49ae7f6e40734ce It's the only relevant change in the `Workspace::updateCurrentActivity` (not sure if I'm looking at something unrelated): https://invent.kde.org/plasma/kwin/-/blame/6af5a5e65112d9b24392efd6be461d3b85c1ef86/src/workspace.cpp#L1109-1189 Reverting the linked commit fixes losing focus when switching activities. Nice find, can confirm. Can also confirm: Fedora 36 Plasma Version: 5.25.5 X11 I'm not exactly sure what the commit mentioned in #4 was trying to solve. I'm using KWin's default focus settings and reverting the commit fixes the focus issues when switching activities. I've been including the revert in my KWin builds ever since, without any issues. The revert had to be updated at least twice though due to merge conflicts. I don't want to submit a pull request myself, because as I said, I don't know the intentions of the commit that broke the focus, and I also pretty much don't know anything about KWin's internals, so this should be done by one of the devs/maintainers. Here's the current diff for the master branch which reverts the order of the if-blocks and restores the previous comments: ```diff diff --git a/src/workspace.cpp b/src/workspace.cpp index 8169fcb10..735b4a1a2 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1360,13 +1360,16 @@ void Workspace::updateCurrentActivity(const QString &new_activity) Window *window = nullptr; // FIXME below here is a lot of focuschain stuff, probably all wrong now - // Keep active window focused if it's on the new activity - if (m_activeWindow && m_activeWindow->isShown() && m_activeWindow->isOnCurrentDesktop() && m_activeWindow->isOnCurrentActivity()) { - window = m_activeWindow; - } else if (options->focusPolicyIsReasonable()) { + if (options->focusPolicyIsReasonable()) { // Search in focus chain window = m_focusChain->getForActivation(VirtualDesktopManager::self()->currentDesktop()); } + // If "unreasonable focus policy" and active_client is on_all_desktops and + // under mouse (Hence == old_active_client), conserve focus. + // (Thanks to Volker Schatz <V.Schatz at thphys.uni-heidelberg.de>) + else if (m_activeWindow && m_activeWindow->isShown() && m_activeWindow->isOnCurrentDesktop() && m_activeWindow->isOnCurrentActivity()) { + window = m_activeWindow; + } if (!window) { window = findDesktop(true, VirtualDesktopManager::self()->currentDesktop()); ``` *** Bug 457616 has been marked as a duplicate of this bug. *** |