Bug 499775 - Programs run through wine will cause Kwin to reverse window layers, when the desktop effect Slide Back is active
Summary: Programs run through wine will cause Kwin to reverse window layers, when the ...
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: 6.2.5
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-10 19:36 UTC by unhappy-ending
Modified: 2025-02-19 15:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description unhappy-ending 2025-02-10 19:36:05 UTC
See summary. Sometimes executing windows programs will trigger a reversal of how kwin presents windows. 

I don't have this problem when executing games, it seems to happen at random. For example, this happens every time I have a clean wine prefix and start installing the various vcredist packages. It's also happened with other installers and 2D programs. It happens using built in wined3d and dxvk. It doesn't seem to matter.

STEPS TO REPRODUCE
1. Use kwin
2. Run/install windows programs

OBSERVED RESULT

For example, as I'm typing this on my browser, any drop down menus appear behind the browser and I can't see it, but it's the active window at the time. It affected the Platform: box, I couldn't see it. Restarting the application will temporarily fix it until I click off the window and back.

Another example is once the bug triggers, I can have two windows slightly overlap, click the active window and the inactive one actually slides behind the inactive one.
The issue described above.

EXPECTED RESULT

Windows to present as expected.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Gentoo, Xanmod kernel 6.13.1
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Window System: Wayland

ADDITIONAL INFORMATION

Using Nvidia proprietary drivers.
Multi monitor setup
Using some window rules to override some programs with "keep below" i.e. Konsole.
Comment 1 unhappy-ending 2025-02-10 19:37:29 UTC
I forgot to add, the only way to resolve the issue is to restart the entire plasma session. FWIW.
Comment 2 unhappy-ending 2025-02-10 19:59:44 UTC
I just had something interesting happen. I have not restarted my current session that I reported this bug from, which was affected. I was running an update and wine 10.1 installed, so I ran eselect wine set 2 to the new version. With no windows software running, the windows are now back to their proper layer order.

This doesn't mean the new version fixed the issue since I didn't run any Windows software using the new version, it's simply an interesting observation.
Comment 3 unhappy-ending 2025-02-10 20:11:59 UTC
Sorry for multiple posting, I'm only trying to add more info. This was in my systemlog right after I started the wine program:

2/10/25 3:02 PM	systemd	Started Wine Windows Program Loader.
2/10/25 3:02 PM	kwin_wayland	kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
2/10/25 3:02 PM	plasmashell	kf.windowsystem: static void KX11Extras::forceActiveWindow(WId, long) may only be used on X11

Is forceActiveWindow causing the issue here?
Comment 4 unhappy-ending 2025-02-10 22:07:59 UTC
After more testing, the problem doesn't happen when disabling the following in winecfg:

Allow the window manager to decorate the windows
Allow the window manager to control the windows

The previous comment containing kf.windowsystem: static void KX11Extras::forceActiveWindow(WId, long) may only be used on X11 is invalid, since I ran another installer program and that error did not pop up in my log.

The issue always happens with the Plogue Chipsynth OPS7 installer. It's free so you can download it to test:

https://chipsynth.s3.amazonaws.com/WIN_chipsynth_OPS7_v1.120.exe

Cherry Audio Elka-X also triggers it 100% for me:

https://store.cherryaudio.com/downloads/elka-x-windows-installer

Both links are free to download without any hassle of using an email to sign up for a demo or having to purchase a product prior to downloading. Again, apologies for the multiple posting but I wanted to get as much information for you guys as possible. This is about all the trial and error I can do at this point.

Thank you very much in advance.
Comment 5 TraceyC 2025-02-11 21:15:56 UTC
I'm not able to replicate this on my system

Tested with wine, version: 10.1, release: 198
Plasma 6.2.5 on Wayland

Set a window rule for Konsole to always be behind other windows
In winecfg, left these checked
 Allow the window manager to decorate the windows
 Allow the window manager to control the windows

Steps:
Installed Cherry Audio Elka-X and ran it
Ran the installer for Chipsynth
Exercised drop down menus in Firefox
Exercised having two slightly overlapping windows, and clicking on either
Clicking around the desktop and applications generally


What I suspect is that something in the window rules is conflicting with something else.
Can you create a new test user and see if you can still trigger the bug?
Thanks!
Comment 6 Roke Julian Lockhart Beedell 2025-02-12 12:29:56 UTC
(In reply to TraceyC from comment #5)

> I'm not able to replicate this on my system

Perhaps it's relevant that another bug with this error is caused by running the Kicker plasmoid windowed - it renders its custom-drawn context menus in the wrong location:

1.	~~~sh
	#!/usr/bin/env sh
	plasmawindowed org.kde.plasma.kicker
	~~~

2.	> ~~~YAML
	> kf.plasma.quick: Applet preload policy set to 1
	> kf.plasma.quick: Exposed with no visual parent. Window positioning broken.
	> kf.windowsystem: static void KX11Extras::forceActiveWindow(WId, long int) may only be used on X11
	> qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
	> kf.windowsystem: static void KX11Extras::forceActiveWindow(WId, long int) may only be used on X11
	> kf.windowsystem.wayland: Failed to recreate shadow for ItemListDialog_QMLTYPE_55(0x563cfad71260)
	> qt.qpa.wayland: eglSwapBuffers failed with 0x300d, surface: 0x0
	> ~~~

Is that more reproducible? If it's utterly irrelevant, apologies. I've mentioned this because I suspect the problem may be of a broader scope than merely Wine.

> What I suspect is that something in the window rules is conflicting with something else.

I've got the undermentioned `.KWinRules` set:

~~~desktop
[SNS2RW]
Description=SNS2RW
noborderrule=2

~~~

...though `noborderrule` doesn't work under Wayland.
Comment 7 unhappy-ending 2025-02-13 20:24:29 UTC
(In reply to TraceyC from comment #5)
> I'm not able to replicate this on my system
> 
> Tested with wine, version: 10.1, release: 198
> Plasma 6.2.5 on Wayland
> 
> Set a window rule for Konsole to always be behind other windows
> In winecfg, left these checked
>  Allow the window manager to decorate the windows
>  Allow the window manager to control the windows
> 
> Steps:
> Installed Cherry Audio Elka-X and ran it
> Ran the installer for Chipsynth
> Exercised drop down menus in Firefox
> Exercised having two slightly overlapping windows, and clicking on either
> Clicking around the desktop and applications generally
> 
> 
> What I suspect is that something in the window rules is conflicting with
> something else.
> Can you create a new test user and see if you can still trigger the bug?
> Thanks!

I tried it on a new user. The problem didn't happen there.
I disabled all my window rules on my normal user. Problem persists.
I disabled all my custom env settings in .profile. Problem persists.

I'm at a loss.
Comment 8 unhappy-ending 2025-02-13 20:56:15 UTC
I found it. I reset the Desktop Effects to default, logged out/in and tried again. Problem went away. So I went through each setting I had enabled previously and found it. 

Window Manager > Desktop Effects > Focus > Slide Back

Simply disabling the effect after the bug triggers isn't good enough, it's necessary to log out and back in. Once the effect is disabled, the issues goes away.
Comment 9 TraceyC 2025-02-13 21:16:41 UTC
(In reply to unhappy-ending from comment #8)
> I found it. I reset the Desktop Effects to default, logged out/in and tried
> again. Problem went away. So I went through each setting I had enabled
> previously and found it. 

Well spotted. I'm able to reproduce this on 6.3.0

- Enabled Slide Back
- Ran the Chipsynth installer, keeping the Dolphin window slightly overlapping a Firefox window
- Exercised drop down menus in Firefox and clicked on the overlapping windows
Observed the bug
Comment 10 unhappy-ending 2025-02-13 21:24:16 UTC
(In reply to TraceyC from comment #9)
> (In reply to unhappy-ending from comment #8)
> > I found it. I reset the Desktop Effects to default, logged out/in and tried
> > again. Problem went away. So I went through each setting I had enabled
> > previously and found it. 
> 
> Well spotted. I'm able to reproduce this on 6.3.0
> 
> - Enabled Slide Back
> - Ran the Chipsynth installer, keeping the Dolphin window slightly
> overlapping a Firefox window
> - Exercised drop down menus in Firefox and clicked on the overlapping windows
> Observed the bug

Excellent. If there is anything else I can do, let me know. I'm happy to help.