Bug 455228

Summary: focus follows mouse thwarted by libreoffice
Product: [Plasma] kwin Reporter: Éric Brunet <eric.brunet>
Component: coreAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: nate, xaver.hugl
Priority: NOR    
Version First Reported In: 5.24.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: A simple LibreOffice Calc demonstrating the problem

Description Éric Brunet 2022-06-13 22:15:44 UTC
Created attachment 149671 [details]
A simple LibreOffice Calc demonstrating the problem

I am running an uptodate fedora 35, with KDE and Xorg.

kwin is configured with "focus follows mouse", and it usually works.

However, a certain manipulation with libreoffice Calc can lock the focus on libreoffice Calc's window.

In detail, one can specify a list of valid values for some cells in LibreOffice Calc. In the attached file BugFocus.ods file, the only valid valued for cell A1 are "emacs" and "vim". When clicking on cell A1, a down arrow appears on the right of the cell. When clicking on the arrow, a drop-down menu appears to choose one of these values. If one chooses a value (and don't click anywhere else), then the focus is locked to LibreOffice Calc. In particular, even after moving the cursor out of LibreOffice's windows, mouse scroll events and keyboard events are directed to LibreOffice. A mouse click event is first sent to LibreOffice, but breaks the lock and gives the focus to the window under the cursor.

I tried all the possible settings for kwin's focus policy (in particular I tried "extreme focus stealing prevention"), but it doesn't help.

I don't know what horrible thing LibreOffice is doing, but focus stealing prevention is kwin's job.
Comment 1 Éric Brunet 2022-06-16 21:09:31 UTC
Today, I managed to reproduce this bug on a different computer also running XOrg. I also tried to reproduce it on that same computer but with wayland, but I couldn't.

So, the bug only happens with XOrg.
Comment 2 Zamundaaa 2024-06-09 16:15:06 UTC
This sounds like LibreOffice is grabbing the input events for some reason, which it can only do on Xorg. If you can still reproduce this issue, please report it to LibreOffice