Bug 478556 - Sometimes the stacking order is out of sync with Xorg
Summary: Sometimes the stacking order is out of sync with Xorg
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.0.0
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
: 483162 483270 483532 483998 484218 484932 485346 486058 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-15 13:37 UTC by Troplo
Modified: 2024-05-01 22:41 UTC (History)
40 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Video demonstrating the bug. (3.85 MB, video/mp4)
2023-12-15 13:37 UTC, Troplo
Details
Requested xwininfo output (28.64 KB, text/plain)
2024-02-23 12:37 UTC, Troplo
Details
Requested screenshot for xwininfo output (500.07 KB, image/png)
2024-02-23 12:37 UTC, Troplo
Details
Wayland window layer bug (deleted)
2024-04-12 17:42 UTC, Kim Andersen
Details
qdbus org.kde.KWin /KWin supportInformation (6.42 KB, text/plain)
2024-04-17 10:59 UTC, Odd
Details
xprop -root (13.31 KB, text/plain)
2024-04-17 11:00 UTC, Odd
Details
supportInformation (XWayland) (6.80 KB, text/plain)
2024-04-17 11:13 UTC, Cristian Le
Details
xprop -root (XWayland) (2.99 KB, text/plain)
2024-04-17 11:14 UTC, Cristian Le
Details
xwininfo (XWayland) (15.67 KB, text/plain)
2024-04-17 12:18 UTC, Cristian Le
Details
screencast showing a window that is only partially “transparent” for mouse events (422.71 KB, video/webm)
2024-05-01 16:25 UTC, Flupp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Troplo 2023-12-15 13:37:20 UTC
Created attachment 164192 [details]
Video demonstrating the bug.

SUMMARY
Sometimes, seemingly randomly, I'm unable to click/interact with applications, upon clicking on them, it interacts with the desktop, and will activate any widgets I click on if they're present. Additionally, right clicking brings up the context items for the desktop. I can still interact with the program with the keyboard.

I've had this happen with OBS, WebStorm (Java/IntelliJ), and Discord, so it doesn't appear to be a problem with the application itself.

As I have no idea the cause, I'm unable to provide reproduction instructions, I'm happy to provide any logs, however I see nothing out of the ordinary in the journal. A video has been attached demonstrating the bug.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.6.7 Plasma 6 Beta 1
KDE Plasma Version:  5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Comment 1 Nate Graham 2024-01-17 23:19:22 UTC
Unfortunately the video seems to be corrupt. However based on the description, I think it might be the same issue as Bug 479926 which was just fixed today. If you're using a top or left screen edge floating panel, and if the issue only happens on *part* of the Task Manager icons, then it's the same thing.

Can you confirm that, or else upload a new video?
Comment 2 Troplo 2024-01-18 01:21:27 UTC
I don't think it's the same issue since I have floating panels disabled and it effects the entire window as you'll see in the video, the video plays just fine for me, I've uploaded it here as a mirror though, https://i.troplo.com/i/30edc9d44518.mp4 (maybe try refreshing if it looks like it's loading forever, or try downloading the file)
Comment 3 Nate Graham 2024-01-18 22:05:23 UTC
Thanks. Doesn't look like the issue I mentioned, indeed. What kind of GPU are you using?
Comment 4 Troplo 2024-01-18 23:45:36 UTC
(In reply to Nate Graham from comment #3)
> Thanks. Doesn't look like the issue I mentioned, indeed. What kind of GPU
> are you using?

NVIDIA RTX 2070 with the latest proprietary drivers on Arch Linux
Comment 5 Nate Graham 2024-01-19 19:47:37 UTC
Thanks.
Comment 6 Vlad Zahorodnii 2024-02-22 14:59:25 UTC
Does this still happen? If yes, can you check if it's still reproducible when toggling compositing. Also could you provide the output of `xwininfo -root -tree` command and a screenshot of the monitor when you ran that command?
Comment 7 Troplo 2024-02-23 12:37:18 UTC
Created attachment 166036 [details]
Requested xwininfo output
Comment 8 Troplo 2024-02-23 12:37:44 UTC
Created attachment 166037 [details]
Requested screenshot for xwininfo output
Comment 9 Troplo 2024-02-23 12:39:19 UTC
(In reply to Vlad Zahorodnii from comment #6)
> Does this still happen? If yes, can you check if it's still reproducible
> when toggling compositing. Also could you provide the output of `xwininfo
> -root -tree` command and a screenshot of the monitor when you ran that
> command?

I recently switched to an AMD GPU (still using X11), so I don't think it's NVIDIA specific, although strangely, I know in the original report I mentioned it happened with multiple applications, I assume the other applications breaking is a side effect of IntelliJ (WebStorm), since I just had it re-occur while using WebStorm which I haven't used in a while and it hasn't happened since I last used it.

Toggling the compositor does actually fix it, not sure why I didn't think to try that a few months ago. I've attached the xwininfo output, and a screenshot to the original issue. Please let me know if there's anything else I can provide.
Comment 10 Troplo 2024-02-23 12:40:54 UTC
Side note, the xwininfo command was executed after toggling the compositor which fixed the problem.
Comment 11 Jonathan Lopes 2024-03-19 01:23:13 UTC
I'm running Plasma 6 on Wayland and have the exact same problem with all IntelliJ IDEs. The problem happens whenever I have an XWayland application behind the IDE. My current “workaround” is to bring a native Wayland window to the foreground before switching to the IDE so I never have an XWayland application below it.

To illustrate it better (I hope bugzilla does not break the formatting), imagine that I opened Dolphin maximized, then opened IntelliJ IDEA:

> |----  Dolphin ----|
> |  |---- IntelliJ ----|
> |  |                  |
> |  |                  |
> |--|                  |
>    |------------------|

IntelliJ is on top of Dolphin, so this problem never happens. Also, if there's nothing behind it (i.e. only the desktop) the problem doesn't happen as well.

Now if I open Steam, which is runs on XWayland, It will go on top of IntelliJ:

> |----  Dolphin ----|
> |  |---- IntelliJ ----|
> |  |  |----   Steam  ----|
> |  |  |                  |
> |--|  |                  |
>    |--|                  |
>       |------------------|

Anything that I type on Steam gets captured by the Steam window as expected, but if I bring IntelliJ to the front:

> |----  Dolphin ----|
> |  |----   Steam  ----|
> |  |  |---- IntelliJ ----|
> |  |  |                  |
> |--|  |                  |
>    |--|                  |
>       |------------------|

The *Icons-only Task Manager* shows that IntelliJ is focused, but anything that I type or click on IntelliJ,
gets sent to Steam instead (which is very awkward). The same happens with applications like Slack that also runs on XWayland:
I type on IntelliJ, but the keys go to Slack instead.

I notice this problem very often because it's not uncommon for me to have IntelliJ, RustRover, PyCharm and WebStorm
all running at the same time, and I very often find myself trying to type on IntelliJ only to find out that all
the keystrokes went to PyCharm (despite the Task Manager showing that IntelliJ is focused).

Reproducing this problem is very tricky, there are days that I start and finish my job without it ever happening,
but once it starts happening, not even closing all IDEA instances and opening again fixes it. The only workaround is to either
minimize all windows and only have the desktop behind the IDE, or to have a native Wayland application behind the IDE,
like Firefox for example:

> |----  Dolphin ----|
> |  |----   Steam  ----|
> |  |  |----  Firefox ----|
> |  |  |  |---- IntelliJ ----|
> |  |  |  |                  |
> |--|  |  |                  |
>    |--|  |                  |
>       |--|                  |
>          |------------------|

This is something that never happened on Plasma 5 (at least for me), but TBF, it's only happening with IntelliJ, no other
X11 application running under XWayland suffers from this, and Java applications have always been problematic under XWayland.

One small problem I noticed was that when I launched Steam, IntelliJ was forcefully brought to the foreground and RustRover got highlighted
in the Task Manager (as if it requested focus). This was the first time that something stole the focus forcefully even
with the “Focus Stealing Prevention” set to “High”. 

Note that I don't think “Focus Stealing Prevention” has anything to do with the problem as I only changed this setting
a couple of days ago, but I've been experiencing this “input being sent to the wrong window” since the official release
of Plasma 6 (only with IntelliJ tho).

System:

> Operating System: Arch Linux 
> KDE Plasma Version: 6.0.2
> KDE Frameworks Version: 6.0.0
> Qt Version: 6.6.2
> Kernel Version: 6.8.1-arch1-1 (64-bit)
> Graphics Platform: Wayland
> Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
> Memory: 62,7 GiB of RAM
> Graphics Processor: AMD Radeon RX 6800
Comment 12 Nate Graham 2024-03-19 19:29:19 UTC
*** Bug 483270 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2024-04-02 16:31:14 UTC
*** Bug 484932 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2024-04-02 16:46:47 UTC
*** Bug 484932 has been marked as a duplicate of this bug. ***
Comment 15 Oded Arbel 2024-04-09 09:05:43 UTC
This is possibly the same bug as bug #483998, bug #483532, and/or bug #483162

I'm not 100% sure so I didn't go and dup all of them.
Comment 16 Cristian Le 2024-04-09 09:42:59 UTC
I've noticed that the issue is a bit more granular in its behavior, e.g.: between IntelliJ and Element, initially the clicks are going to Element in the background, but after I activate IntelliJ, the focus is fixed. This is not the case between multiple IntelliJ windows where the focus continues to be on the background window.
Comment 17 Nate Graham 2024-04-09 19:51:06 UTC
*** Bug 483998 has been marked as a duplicate of this bug. ***
Comment 18 Nate Graham 2024-04-09 19:51:27 UTC
*** Bug 483532 has been marked as a duplicate of this bug. ***
Comment 19 fanzhuyifan 2024-04-11 16:54:16 UTC
*** Bug 485346 has been marked as a duplicate of this bug. ***
Comment 20 Andreas Schneider 2024-04-12 09:53:16 UTC
I have that happen quite a lot. I also can't find a way to fix the IntelliJ window, besides moving it to my left-most monitor, so I assume there might be some scaling included.

My setup: 100% scaled 1280x1024 on the left, 125% scaled 3440x1440 on the right. The right one is the main monitor.
I typically have IntelliJ in the left-half-quick-tile block of the big monitor.
I also have multiple virtual desktops I switch between.

Switching focus a few times between different windows, it can happen that IntelliJ can't focus anymore. Mouse-over and click events seem to "fall through" to the window below. Moving the window to the other monitor fixes it in the meantime. Moving it back sometimes works for a while and then fails again. I haven't had it fail on the left-most monitor yet. As long as the window was there, all was fine.
Comment 21 Andreas Schneider 2024-04-12 12:35:45 UTC
Now I have it happen to an open Goland instance. Moving it to my left monitor it works, moving it back to the main monitor and it's immediately "broken" again. I can Meta+Left-Click to move and Meta+Right-Click to resize, but otherwise the mouse only interacts with the window "below". Keyboard input is forwarded (i.e. I can navigate using the keyboard and also type stuff), though, as long as the window has focus.
Comment 22 Andreas Schneider 2024-04-12 13:05:36 UTC
And another addition/observation (hoping that this helps narrowing down where the problem could come from): I now closed a few other windows (especially those on the left monitor) and suddenly Goland takes mouse inputs again - even on the main screen.
Comment 23 Kim Andersen 2024-04-12 17:42:20 UTC
Created attachment 168426 [details]
Wayland window layer bug

This is another video showing how interacting with the window on top, affects the window beneath
Comment 24 Kim Andersen 2024-04-12 17:51:12 UTC
Comment on attachment 168426 [details]
Wayland window layer bug

>
Comment 25 Kim Andersen 2024-04-12 17:53:04 UTC
Comment on attachment 168426 [details]
Wayland window layer bug

> ftypisomisomiso2avc1mp41moovlmvhdè!V@ötrak\tkhd!H@T$edtselst!Hnmdia mdhd2ªUÄ-
Comment 26 Kim Andersen 2024-04-12 20:48:10 UTC
Will you please delete that clip, it was a wrong one I uploaded.


On 12/04/2024 21.20, Oded Arbel wrote:
> https://bugs.kde.org/show_bug.cgi?id=478556
>
> Oded Arbel <oded@geek.co.il> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>   Attachment #168426 [details]|1                           |0
>             is patch|                            |
>   Attachment #168426 [details]|text/plain                  |video/mp4
>            mime type|                            |
>
Comment 27 Oded Arbel 2024-04-12 21:05:48 UTC
Comment on attachment 168426 [details]
Wayland window layer bug

I don't have access to delete attachments from tickets. I'm not sure it is possible.
Comment 28 Nate Graham 2024-04-12 21:10:44 UTC
Sysadmins can. I've contacted them about it.
Comment 29 Nicolás Alvarez 2024-04-12 21:19:30 UTC
The content of attachment 168426 [details] has been deleted for the following reason:

requested by user
Comment 30 Luc 2024-04-16 10:50:51 UTC
Same issue here since updated to Plasma 6. Randomly the mouse click (left and right, it doesn't matter) goes through top level window (from the z order perspective) and generates the corresponding click events on the window beneath it, so instead of focusing the desired top level window the focus is given to the window beneath it (or desktop, if no lower level window present). It is really frustrating because you cannot interact at all with the window. Changing *any* option in System Settings -> Window Management -> Window Behavior and click Apply would temporary fix the issue (for example change "Delay focus by" from default 300 ms to anything else and click Apply (the same with any option etc.). After a certain time interval (minutes, tens of minutes) or may some event (I didn't investigate for the moment), the problem manifests itself again.

It happens on both X11 and Wayland.
I'm using nvidia driver (470.239.06) on a GeForce GTX 765M graphics card.
I tried to test on nouveau but there are so many issues with nouveau (from freezing to segfaults etc.) that I couldn't use it at all.

I will get back with more information if / when I get more time to investigate it.
Thank you.
Comment 31 Zamundaaa 2024-04-16 23:02:01 UTC
*** Bug 483162 has been marked as a duplicate of this bug. ***
Comment 32 Zamundaaa 2024-04-16 23:02:15 UTC
*** Bug 484218 has been marked as a duplicate of this bug. ***
Comment 33 Luc 2024-04-17 05:37:04 UTC
I noticed the Version field is 5.90.0 for this bug, but it is affecting all 6.x versions (currently I'm on 6.0.3.1 for example).
It never happened for 5.x versions (not considering 5.90.x versions), basically this problem started only after updating to 6.x.

To avoid having this bug fix postponed due to triage criteria (based on Version field), is it possible please to adjust the Version field accordingly?

Thank you.
Comment 34 Luc 2024-04-17 05:42:22 UTC
One more thing, the title mentions "Xorg", but in reality it happens on both X and Wayland with the same occurrence probability.

Thank you.
Comment 35 Cristian Le 2024-04-17 06:51:06 UTC
## Summary

It may be worth summarizing what we know so far:
- No linked MR thus far
- Affected KDE: Current Plasma 6, but also traceable to 5.90
- Easily replicable, but must be between select window types. To replicate, alt+tab to switch focus between offending windows
  (IntelliJ is commonly reported so alt+tab between CLion and Pycharm windows that are overlapping) 
- Affects native X11 and XWayland windows. No report between X windows and native wayland or between wayland windows thus far
- Not related to graphics card, HighDPI scaling etc.
- Focus Stealing Prevention etc. does not affect it
- Meta + Left/Right Click affects the **correct** window

## Requested debug info

Nothing new requested.

`xwininfo -root -tree` was requested at some point and provided. If still needed, I can provide a video of `watch` and replicating the bug if there is some guidance on how to filter the relevant windows.

## Discussed fixes

### Toggle compositor (Alt+Shift+F12)

This does not seem to have any effect, navigating the dbus interface (/org.kde.kwin.Compositing.active is always True). Does not affect the bug's reproducibility. (I.e. even if I do use Alt+Shift+F12 I am still replicating the issue)

### Changing any option in System Settings -> Window Management -> Window Behavior

Does not affect the bug's reproducibility. Still replicable on my side with the alt+tab.

---

That's all I have so far

(it's unfortunate with bugzilla we can't edit comments, otherwise it would be nice to keep top most comment up-to-date with the current status, will try to summarize every now and then)
Comment 36 Odd 2024-04-17 07:54:38 UTC
Is any KDE dev looking into this or actually tried to reproduce it?
(Don't know who's who here)
Comment 37 Cristian Le 2024-04-17 08:15:25 UTC
Regarding the summary written, I am not saying that this is not looked by KDE-devs, I am sure this is major bug that is being looked into given how prevalent it is and how many duplicate issues are being triaged. Nate seems also quite concerned about this bug?

It's just that we (KDE users) haven't been updated on where to follow the work for this bug, and we weren't asked for more debug information in a while.
Comment 38 Odd 2024-04-17 08:25:02 UTC
(In reply to Cristian Le from comment #37)
> It's just that we (KDE users) haven't been updated on where to follow the
> work for this bug, and we weren't asked for more debug information in a
> while.
I don't expect to be able to follow their work, but I haven't seen any requests for further info or some indication it's actively being looked into right now (or maybe I missed it) - hence my question.

There are other regressions/bugs coming from 5.2x that I have encountered but this is the most annoying one, to the point it's making me consider switching DEs.
Comment 39 ratijas 2024-04-17 10:40:35 UTC
I am hitting what seems to be the same bug lately.

NVIDIA GTX 970M, proprietary drivers
X11
Plasma 6 from git

Is it consistent? No.
How to reproduce it? I have no idea so far.

I was given some ideas how to debug it using KWin support information, so I'll do that next time(s) it happens:

$ qdbus org.kde.KWin /KWin supportInformation
$ xprop -root

FWIW I'm a KDE dev, although not much in KWin area. Let me assure you, we want this bug fixed, however it is hard to do so without reliable steps to reproduce it, and it seems to be quite random so far.
Comment 40 Odd 2024-04-17 10:47:46 UTC
Thanks for lettings us now you are on it!
I'll try those commands the next time it happens and upload.
Comment 41 Odd 2024-04-17 10:59:50 UTC
Created attachment 168608 [details]
qdbus org.kde.KWin /KWin supportInformation

Output of the command 'qdbus org.kde.KWin /KWin supportInformation' while the bug is happening.
Comment 42 Odd 2024-04-17 11:00:47 UTC
Created attachment 168609 [details]
xprop -root

Output of the command 'xprop -root' while the bug is happening.
Comment 43 Odd 2024-04-17 11:01:43 UTC
Well it just happened again as soon as I switched back to WebStorm, maximized and then unmaximized the window.
I have attached files of the output of the two commands.
Comment 44 Cristian Le 2024-04-17 11:13:34 UTC
Created attachment 168610 [details]
supportInformation (XWayland)
Comment 45 Cristian Le 2024-04-17 11:14:00 UTC
Created attachment 168611 [details]
xprop -root (XWayland)
Comment 46 Cristian Le 2024-04-17 11:14:07 UTC
(In reply to ratijas from comment #39)
> Is it consistent? No.
> How to reproduce it? I have no idea so far.

I don't suppose you have the IntelliJ IDEs do you? I have 99% reproducibility with them just because there are 2 equivalent apps with multiple windows, it is very easy to reproduce (and encounter randomly). My reproduction steps:

1. Open 2 IDEs with multiple windows
2. Move focus away from all windows, e.g. go to Firefox and let everything "settle"
3. Go into one of the IDE windows
4. Alt+tab to another window (often can be within the same IDE) and try to interact with the window that became focused
5. Commands are forwarded to background app, move the windows, minimize etc. to actually bring the "foreground" app into "full" focus

My understanding is that the files there give you mostly static info (mine are equivalent other than X11->XWayland), but are there anyway to give some debug info about the active focus changes? Maybe some `qbus` listeners or a `watch` command that we can record the full process?
Comment 47 Sebastian E. 2024-04-17 11:51:20 UTC
The output of "xwininfo -root -all" could be useful. But you need to check it for personal information, it contains Window titles.

By the way, there's an issue at the Jetbrains issue tracker, too: https://youtrack.jetbrains.com/issue/JBR-6921
Comment 48 Sebastian E. 2024-04-17 12:03:20 UTC
And "xev -root", at least on X11.
Comment 49 Cristian Le 2024-04-17 12:18:15 UTC
Created attachment 168615 [details]
xwininfo (XWayland)

Here is my `xwininfo`. One thing I notice is that it has `FocusProxy` on the content windows. I don't have a reproducible flow for non-IntelliJ windows that I could check if this is the case for those as well
Comment 50 Luc 2024-04-17 18:36:46 UTC
(In reply to Cristian Le from comment #35)
> ## Summary

Hello Cristian,

good summary, thank you.

I would like to add that I disabled the compositor today (System Settings -> Compositor -> Enable on startup [unchecked] -> restart KWin / reboot) and I didn't encountered the issue anymore (I was constantly and continuously using 3 Rider instances + 1 CLion instance for about 11 hours). I really don't know why I didn't try that sooner.

Thanks.
Comment 51 Pedro Boschi 2024-04-18 12:32:03 UTC
A workaround I found to be able to not get too annoyed with this bug is to click on the "minimize window" until the actual window being displayed matches the "real" window with focus.
Comment 52 Cristian Le 2024-04-18 13:03:39 UTC
Quick comment, changing compositor option does not seem possible on KDE6? Or at least not on the F40 beta branch


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: F40 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Comment 53 Troplo 2024-04-18 13:13:44 UTC
(In reply to Cristian Le from comment #52)
> Quick comment, changing compositor option does not seem possible on KDE6? Or
> at least not on the F40 beta branch
> 
> 
> SOFTWARE/OS VERSIONS
> Linux/KDE Plasma: F40 
> KDE Plasma Version: 6.0.3
> KDE Frameworks Version: 6.0.0
> Qt Version: 6.6.2

Are you on Wayland? Disabling/toggling the compositor is only available on X11, although if you are on X11 and the option is missing, you could try ALT + SHIFT + F12 and iirc it remembers the compositor toggle state on subsequent reboots.
Comment 54 Cristian Le 2024-04-18 13:19:28 UTC
Indeed I am on Wayland, and at least by navigating the dbus environment it doesn't seem to have any effect. Not sure if it counts odd/even how many times I Alt+Shift+F12, but I don't think that's the case. Is the compositor an X11/XWayland specific thing?
Comment 55 Troplo 2024-04-18 13:34:40 UTC
(In reply to Cristian Le from comment #54)
> Indeed I am on Wayland, and at least by navigating the dbus environment it
> doesn't seem to have any effect. Not sure if it counts odd/even how many
> times I Alt+Shift+F12, but I don't think that's the case. Is the compositor
> an X11/XWayland specific thing?

Yeah it's X11 specific, that shortcut won't do anything on Wayland due to the Wayland server being a compositor itself
Comment 56 Steve Ramage 2024-04-23 14:59:21 UTC
Just wanted to say this is affecting me as  well, how I fix it , is by killing kwin_x11  that seems to recover everything. Although maybe that is horrible.
Comment 57 Cristian Le 2024-04-23 15:05:06 UTC
> Just wanted to say this is affecting me as  well, how I fix it , is by killing kwin_x11  that seems to recover everything. Although maybe that is horrible.

Lol, just have a "Nuke X11" button on a shortcut :)). But speaking of which, it would be worth confirming for the others that would want a dirty fix in the meantime, does killing kwin_x11 restart the applications smoothly from where they were left off? I remember this being a major implementation for Plasma6 and Wayland.
Comment 58 Steve Ramage 2024-04-23 15:10:40 UTC
> Lol, just have a "Nuke X11" button on a shortcut :)). But speaking of which, it would be worth confirming for the others that would want a dirty fix in the meantime, does killing kwin_x11 restart the applications smoothly from where they were left off? 

Yes sorry, to be clear when I do that, it takes about 5 seconds but my session continues without any negative side effects, the side effects are minimum. All my applications seem unaffected, no crashes or anything.
Comment 59 Odd 2024-04-23 15:27:54 UTC
Everybody talking about workarounds instead of asking the relevant question: are the devs able to "reliably" reproduce the bug with JetBrains' products at this point, as opposed to waiting for the bug to occur in "normal" use?

It's enough the keep any of the JetBrains IDEs open and interacting with the IDE a little while doing other work, and the bug will inevitably appear, several times a day.
Comment 60 Ondřej Hruška 2024-04-23 18:09:35 UTC
I can confirm switching between X11 and Wayland session has no effect for me regarding this bug, I get it many times a day either way. Jetbrains IDEs run in XWayland anyway. I have bound "killall kwin_x11" to Meta+F1 for now, horrible or not, if it works it's not stupid :)
Comment 61 Zamundaaa 2024-04-24 13:48:11 UTC
*** Bug 486058 has been marked as a duplicate of this bug. ***
Comment 62 vm 2024-04-25 00:06:49 UTC
I've found quite fast repro, it's still random, but breaks by 2-15 slow clicks (after `reboot` or `killall kwin_x11`):

https://youtu.be/zjreuC6gPDQ

3 IntelliJ IDEA + 1 Kitty + 1 Chrome
Note: for me it breaks ONLY with IDEA, i've tried DBeaver and OBS - no such problem.
Hope it may help.
Comment 63 Gladox114 2024-04-25 05:02:56 UTC
(In reply to vm from comment #62)
> I've found quite fast repro, it's still random, but breaks by 2-15 slow
> clicks (after `reboot` or `killall kwin_x11`):
> 
> https://youtu.be/zjreuC6gPDQ
> 
> 3 IntelliJ IDEA + 1 Kitty + 1 Chrome
> Note: for me it breaks ONLY with IDEA, i've tried DBeaver and OBS - no such
> problem.
> Hope it may help.


If you want something that is mit random. Try Apex Legends. It ses to trigger it exactly the same, always in an instant
Comment 64 Andrew Shark 2024-04-25 06:58:54 UTC
The bug in the JetBrains youtrack: https://youtrack.jetbrains.com/issue/PY-72228/Input-events-are-passed-to-underlying-X11-window
Comment 65 Sebastian E. 2024-04-25 07:18:43 UTC
Unfortunately, that bug will probably be resolved as duplicate of https://youtrack.jetbrains.com/issue/JBR-6921, which is already resolved as third-party problem.

I reproduced the issue using the method demonstrated by Vm in his video above. It works well, but took more clicks for me. I also tried two other applications instead of IntelliJ: a Java Swing app and a Compose Desktop app, both using the default JRE and and Jetbrains' JRE (found in ~/.jbr/). It didn't happen with them.
Comment 66 Andrew Shark 2024-04-25 18:44:23 UTC
Unfortunately, I did not found that bug report before reporting mine.

But for that developer who will go fixing this, I want to make a note, that it is worth checking Comment #64 link, because I have extensively described there two other reproduce methods and attached a video.
Comment 67 Cristian Le 2024-04-26 10:10:38 UTC
Thank you Sebastian for the link, so far the "experimental" fix in https://youtrack.jetbrains.com/issue/JBR-6921/Plasma-6-Cannot-click-on-one-IDE-instance-when-a-second-one-is-running#focus=Comments-27-9734185.0-0 seems to be working for me. It even fixes the High-DPI scaling issue :)
Comment 68 danct12 2024-04-26 10:24:43 UTC
Another way to reproduce this bug is to run FastTracker II Clone (ft2-clone). As soon it runs I lose ability to interact with anything except for the desktop.
Comment 69 NoPH8 2024-04-29 10:24:57 UTC
This is not an IDEA issue because it has no effect before plasma6.
And this makes plasma6 completely unusable for developers that uses IDEA-based IDE.
So it has to have a highest prioirty.
Comment 70 Andrew Shark 2024-04-29 10:29:37 UTC
As a crutch idea, I think one could make a kwin script that switches the virtual desktop forward and backward at any time the jetbrains window (or any x11 window? but experienced most with jetbrains) is moved, resised, activated.
Comment 71 Ondřej Hruška 2024-04-29 10:44:56 UTC
(In reply to NoPH8 from comment #69)
> This is not an IDEA issue because it has no effect before plasma6.
> And this makes plasma6 completely unusable for developers that uses
> IDEA-based IDE.
> So it has to have a highest prioirty.

One winning strategy here is to just live with this bug long enough that Jetbrains finish their Wayland support :-)
Comment 72 NoPH8 2024-04-29 10:50:13 UTC
(In reply to Ondřej Hruška from comment #71)
> 
> One winning strategy here is to just live with this bug long enough that
> Jetbrains finish their Wayland support :-)

The joke is funny, the situation is sad =(

It's look like I'll switch to Mac before.
Comment 73 vm 2024-04-30 22:22:14 UTC
After a lot of debugging i think i've found at least a better workaround.

Workaround: 

Quite simple - disable ALL effects in "Window Open/Close Animation" group.

Details:

It looks like when any of these effect are enabled KWin starts leaking Window instances, as they sometimes not getting deleted. 

In IDEA every button (such as Run/Debug, Settings, left panel buttons) - has a tooltip.
When you hover over any of these IDEA button it creates new X window to display a tooltip. 
When mouse leaves that button - tooltip window is destroyed.
KWin tries to animate destruction of that tooltip (...yeah tooltip death animation...)
And sometimes it causes that Window instances (previously used by tooltips) are never be deleted (a lot of X11Window instances holding m_client = 0x0), because m_refCount counter never reaches zero.
Why and where it leaks exactly i'm still don't understand, but the problem somewhere in this effects implementation.
A few moments later this leaked Window instances start causing a lot of stacking issues.

Look:

https://youtu.be/1jiKEP-MJQQ

What i've done - added simple logging to Workspace::updateStackingOrder (and some quite simple helpers - such as refCount() to Window.h for debugging reasons):

    void Workspace::updateStackingOrder(bool propagate_new_windows)
    {
        if (m_blockStackingUpdates > 0) {
            if (propagate_new_windows) {
                m_blockedPropagatingNewWindows = true;
            }
            return;
        }
        QList<Window *> new_stacking_order = constrainedStackingOrder();
        bool changed = (force_restacking || new_stacking_order != stacking_order);
        force_restacking = false;
        stacking_order = new_stacking_order;
        if (changed || propagate_new_windows) {
            propagateWindows(propagate_new_windows);

            for (int i = 0; i < stacking_order.size(); ++i) {
                stacking_order[i]->setStackingOrder(i);
            }

            Workspace::debugStacking("Stacking order changed!!!", stacking_order); // <----------------------------------

            Q_EMIT stackingOrderChanged();

            if (m_activeWindow) {
                m_activeWindow->updateMouseGrab();
            }
        }
    }

    void Workspace::debugStacking(const char* prefix, const QList<Window*>& stacking) {
        QString debugString;
        for (Window* w: stacking) {
            X11Window* x11w = static_cast<X11Window*>(w);
            debugString.append(QString("  instance = 0x%1 refCount = %2 window = 0x%3 desc = %4\n")
                .arg(reinterpret_cast<uintptr_t>(x11w), 0, 16)
                .arg(x11w->refCount())
                .arg(x11w->window(), 0, 16)
                .arg(x11w->windowDesc()));
        }
        qDebug("%s!!!\n%s", prefix, qUtf8Printable(debugString));
    }

Also i've launched gdb to get backtraces with this commands:

    gdb ./kwin_x11
    
    break window.cpp:113
    commands
    silent
    bt 6
    continue
    end

    break window.cpp:118
    commands
    silent
    bt 6
    continue
    end

    run --replace`

But without success as i didn't find a real reason - looks like Window references are hold by EffectWindowDeletedRef, but why... 

With all this in mind:

What i clearly know - KWin Window leaking - doesn't look like IDEA problem. 
I think this is also reproducible with ANY software which can create/delete windows as fast as IDEA does.
Comment 74 Andrew Shark 2024-04-30 22:38:56 UTC
@vm Thanks for sharing!
And wow, I did not know that you can click on radio button to disable that. Very counter-intuitive... It should be a radio-button with the check mark ("V") inside, instead of circle, to indicate that you can disable it as a checkbox.
Comment 75 Sebastian E. 2024-05-01 00:42:42 UTC
Thanks, vm, for keeping digging and figuring this out!
Comment 76 Flupp 2024-05-01 16:25:42 UTC
Created attachment 169076 [details]
screencast showing a window that is only partially “transparent” for mouse events

I am affected too, and there is a detail that I have not seen in the discussion yet: I managed to end up in a situation where only a fraction of the affected window is “transparent” for mouse events. If this is an already known symptom, then sorry for the noise.

The problem can be reliably reproduced with Firefox as follows:

- Right-click toolbar and choose “Customize Toolbar …”.
- Disable “Title Bar”.
- Resize the window as you like. This will define the normal behaving region.
- Enable “Title Bar”.
- Resize to a larger window.
- Now the window is “transparent” for mouse events in the area that was added by the previous resize.
- Note that the added width of the title bar is not affected.
- Disabling “Title Bar” again undoes the effect. (You might have to make the window smaller again before being able to click the check box.)

According to `qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole`, Firefox is a Wayland window

Software versions:

- Arch Linux
- KWin package version 6.0.4.1-1
- Firefox package version 125.0.3-1

I attach a screencast showing some right-clicks in the Firefox window, where some open a Firefox context-menu while others open the Plasma desktop menu.
Comment 77 Oded Arbel 2024-05-01 19:17:59 UTC
I can 100% reproduce the behavior in comment #76 on Neon Plasma Wayland 6.0.4. Showing this issue with a non-Intellij application, especially one that is easily reproducable is awesome - great work @Flupp!

A lot of people in this ticket are talking about running on Xorg and not on Wayland, and I thought that the Wayland ticket for this behavior was bug #483162 - but that was apparently closed as a dup of this one, though I'm not convinced that the Wayland behavior and the Xorg behavior is exactly the same thing. I would be interested in seeing if any of the Xorg running folks can repro the Firefox problem described above.

A few notes about the Firefox reproduction:
- When reproing with a single window, note that when the desktop menu shows, the Firefox window becomes inactive - if there was a second window under the problematic window then it would have been raised - I don't think this happened with the Intellij repro, leading me to suspect that it is not exactly the same bug.
- With the issue presenting, you can still drag the window from the kwin decoration or resize the window from the border.
- In the region where clicks "pass through" to the underlying surface, no other mouse event will be received by the window - you can see that hover events do not activate, but also trying to use the window operations modification key (normally META) would not let you drag the window or resize it from that region.
Comment 78 vm 2024-05-01 19:24:38 UTC
(In reply to Oded Arbel from comment #77)
> I can 100% reproduce the behavior in comment #76 on Neon Plasma Wayland
> 6.0.4. Showing this issue with a non-Intellij application, especially one
> that is easily reproducable is awesome - great work @Flupp!
> 
> A lot of people in this ticket are talking about running on Xorg and not on
> Wayland, and I thought that the Wayland ticket for this behavior was bug
> #483162 - but that was apparently closed as a dup of this one, though I'm
> not convinced that the Wayland behavior and the Xorg behavior is exactly the
> same thing. I would be interested in seeing if any of the Xorg running folks
> can repro the Firefox problem described above.
> 
> A few notes about the Firefox reproduction:
> - When reproing with a single window, note that when the desktop menu shows,
> the Firefox window becomes inactive - if there was a second window under the
> problematic window then it would have been raised - I don't think this
> happened with the Intellij repro, leading me to suspect that it is not
> exactly the same bug.
> - With the issue presenting, you can still drag the window from the kwin
> decoration or resize the window from the border.
> - In the region where clicks "pass through" to the underlying surface, no
> other mouse event will be received by the window - you can see that hover
> events do not activate, but also trying to use the window operations
> modification key (normally META) would not let you drag the window or resize
> it from that region.

Yes, its also reproduces on Xorg. I think it the same problem.
Comment 79 Nate Graham 2024-05-01 21:17:54 UTC
Fantastic, I can reproduce that as well.
Comment 80 Zamundaaa 2024-05-01 22:41:49 UTC
Firefox being click-through in some parts of the window is a Firefox bug, see https://bugzilla.mozilla.org/show_bug.cgi?id=1844497 (also happens on Wayland, or at least one with similar symptoms). It's not the same issue as described in this bug report.

(In reply to vm from comment #73)
> After a lot of debugging i think i've found at least a better workaround.
> 
> Workaround: 
> 
> Quite simple - disable ALL effects in "Window Open/Close Animation" group.
> 
> But without success as i didn't find a real reason - looks like Window
> references are hold by EffectWindowDeletedRef, but why... 

I checked the code and added some logging too, but I haven't been able to see anything that's wrong with window references so far