https://bugs.kde.org/show_bug.cgi?id=449873

--- Comment #8 from [email protected] ---
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());
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to