wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Graphic applications have a misaligned mouse and menu location when using FancyZones

Open pkmnsnfrn opened this issue 2 years ago • 13 comments

Windows build number:

10.0.19045.0

Your Distribution version:

22.04

Your WSL versions:

WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.3448

Steps to reproduce:

Misaligned Mouse

  1. Open the graphic application in question
  2. Attempt to use the mouse on said application
  3. Expected: ability to normally use mouse
  4. Actual: mouse is seemingly offset on both axes, rendering application unusable

After killing and restarting the application once or twice within the same WSL session, this problem goes away. The cycle always repeats with a new instance of WSL. Then this problem starts and never goes away

Menus Pinned to Top

  1. Open the graphic application in question
  2. Attempt to open menus at the top of the application
  3. Expected: ability to normally use menus
  4. Actual: menu contents are stuck at the top of the screen, and interacting with them does nothing.

When opening a menu that is at the top of an application, the contents of the menu are stuck to the top of the screen, regardless of the position or size of the window. This renders them unusable because I cannot mouse over them.

Video

https://youtu.be/_tycMkbZCmQ

WSL logs:

(https://github.com/microsoft/wslg/files/12679620/WslLogs-2023-09-20_19-55-14.zip) pulseaudio.log stderr.log versions.txt weston.log wlog.log

WSL dumps:

No response

Expected behavior:

No response

Actual behavior:

Mouse is not correctly aligned with application and menus are stuck to the top of the screen, rendering applications unusable. Both behaviors also apply to new windows created from the application, as well as right click menus.

This was working correctly three weeks ago, and I have not made any changes aside from regular program updates for Windows and other applications. (The application in question was compiled from source and has not changed).

pkmnsnfrn avatar Sep 21 '23 03:09 pkmnsnfrn

I can confirm that when I disable FancyZones for the monitor in question, this problem goes away. Is this a FancyZones problem or a WSLg problem?

pkmnsnfrn avatar Sep 23 '23 14:09 pkmnsnfrn

I can also confirm what @pkmnsnfrn said: when FancyZones is disabled, the menu and mouse misalignment is fixed in JetBrains products and WSLg. If FancyZones needs to be enabled, you can add msrdc.exe (Remote Desktop) to FancyZones' Excluded apps, and the menus will work!

jarikain avatar Feb 06 '24 17:02 jarikain

I can also confirm what @pkmnsnfrn said: when FancyZones is disabled, the menu and mouse misalignment is fixed in JetBrains products and WSLg. If FancyZones needs to be enabled, you can add msrdc.exe (Remote Desktop) to FancyZones' Excluded apps, and the menus will work!

this works, but I'll leave the issue open so in the hopes that it actually gets fixed. thanks!

pkmnsnfrn avatar Feb 06 '24 18:02 pkmnsnfrn

I think I may have the same issue, do you have the "Move newly created windows to the current active monitor" setting on? I think the issue may happen because PT is trying to move the WSLg windows to the second monitor and, in my case, freezes the window (also I see the same cursor icon when hovering the title) and it returns to normal after I do Win+Shift+Left/Right Arrow quickly to bring it back to the main monitor briefly.

JotaRata avatar Jun 22 '24 03:06 JotaRata

I think I may have the same issue, do you have the "Move newly created windows to the current active monitor" setting on? I think the issue may happen because PT is trying to move the WSLg windows to the second monitor and, in my case, freezes the window (also I see the same cursor icon when hovering the title) and it returns to normal after I do Win+Shift+Left/Right Arrow quickly to bring it back to the main monitor briefly.

I've had PowerToys turned off since I first ran into this. I just reinstalled it and that option was off, and things seem to work now? I'll get it a go and if things permanently get better.

pkmnsnfrn avatar Jun 22 '24 17:06 pkmnsnfrn

I think I may have the same issue, do you have the "Move newly created windows to the current active monitor" setting on? I think the issue may happen because PT is trying to move the WSLg windows to the second monitor and, in my case, freezes the window (also I see the same cursor icon when hovering the title) and it returns to normal after I do Win+Shift+Left/Right Arrow quickly to bring it back to the main monitor briefly.

I can confirm that turning off "Move newly created windows to the current active monitor" makes the problem go away. I'm not closing to close the bug, but this mitigation has been helpful. Thanks!

pkmnsnfrn avatar Jul 14 '24 05:07 pkmnsnfrn

Sounds like this probably should also be reported to https://github.com/microsoft/PowerToys/, it maybe that they may have a fix / workaround for this issue for fancyzones?

unitysipu avatar Sep 05 '24 12:09 unitysipu

I just observed that on my personal desktop box with a 4090 and a relatively virgin Ubuntu wsl2 setup this doesn't reproduce straight up. There's probably something else that impacts this. I only have one primary monitor, the same one i use on my laptop when it's connected.

On my work laptop with an integrated intel gpu and a discrete nvidia geforce gtx 1650 this happens. I've also used mesa utils on the laptop with an environment variable to force the wsl2 to use the discrete GPU to prevent performance issues with the gui apps running in WSL2.

unitysipu avatar Sep 05 '24 20:09 unitysipu

toggling "move newly created windows to their last known zone" off makes the issue go away and come back on my laptop, but it doesn't reproduce on my desktop.

unitysipu avatar Sep 05 '24 20:09 unitysipu

fascinating. my issue is on a triple monnitor desktop but idk what graphics card I have (I can check if that helps). Also happy to figure out exactly what is causing this issue.

pkmnsnfrn avatar Sep 05 '24 21:09 pkmnsnfrn

fascinating. my issue is on a triple monnitor desktop but idk what graphics card I have (I can check if that helps). Also happy to figure out exactly what is causing this issue.

It may be related to multimonitor in theory. If you have some powertoys logs to provide in the fancyzones case in powertoys side that would help, also if you can provide more data. I don't feel comfortable grabbing extensive logs off my work laptop and sharing it in a public post.

unitysipu avatar Sep 06 '24 12:09 unitysipu

fascinating. my issue is on a triple monnitor desktop but idk what graphics card I have (I can check if that helps). Also happy to figure out exactly what is causing this issue.

It may be related to multimonitor in theory. If you have some powertoys logs to provide in the fancyzones case in powertoys side that would help, also if you can provide more data. I don't feel comfortable grabbing extensive logs off my work laptop and sharing it in a public post.

Sure, just let me know which logs I should be uploading and/or how to generate.

Also i'm running an RTX 2060.

pkmnsnfrn avatar Sep 06 '24 13:09 pkmnsnfrn

Sure, just let me know which logs I should be uploading and/or how to generate.

If you right-click on the tray icon and select "report a bug", it will start generating logs and drop them into a zip file on your desktop. It doesn't give you any feedback until the package is done and that may take like 20+ seconds so have patience. Ultimately you will have a package with logs from all the features on the environment.

unitysipu avatar Sep 09 '24 18:09 unitysipu

I found that this issue can be easily triggered by calling SetWindowPos or similar APIs from UIAutomation. It looks like the windows from the Linux side completely ignored these programmatic ways to manipulate windows from the Windows side. E.g. if you moved a window with SetWindowPos, the Linux window would stay at its old coordinates, making the displayed UI and actual UI positions misaligned.

I'm building a window manager for Windows, but all WSLg windows are unmanageable due to this issue.

I tried to do things from the Linux side, by using e.g. xdotool to manipulate the WSLg windows. It kinda worked, but was very unresponsive, since calling Linux commands using wsl.exe was too slow for interactive use.

agent-kilo avatar Oct 29 '24 00:10 agent-kilo

Maybe (But perhaps this is better in the PowerToys thread) WSLg windows could somehow be excluded from the automatic window placement done by FancyZones, in that way you could still have the benefits of it for just Windows' windows only

JotaRata avatar Nov 20 '24 17:11 JotaRata

I can also confirm what @pkmnsnfrn said: when FancyZones is disabled, the menu and mouse misalignment is fixed in JetBrains products and WSLg. If FancyZones needs to be enabled, you can add msrdc.exe (Remote Desktop) to FancyZones' Excluded apps, and the menus will work!

Thank you for this workaround! I can confirm that adding msrdc.exe to FancyZones excluded apps resolves the issue that X11/Wayland windows from WSLg can't be clicked until minimizing / maximizing them at least once (such a pain)!

coezbek avatar Apr 29 '25 20:04 coezbek

Sure, just let me know which logs I should be uploading and/or how to generate.

If you right-click on the tray icon and select "report a bug", it will start generating logs and drop them into a zip file on your desktop. It doesn't give you any feedback until the package is done and that may take like 20+ seconds so have patience. Ultimately you will have a package with logs from all the features on the environment.

PowerToysReport_2025-04-29-22-18-09.zip

pkmnsnfrn avatar Apr 30 '25 12:04 pkmnsnfrn