microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.24k stars 307 forks source link

Moving a wslg window with AltDrag breaks mouse interaction (need local move support) #324

Open nevyn opened 3 years ago

nevyn commented 3 years ago
  1. Install AltDrag
  2. sudo apt install dbus-x11 gnome-terminal
  3. dbus-launch gnome-terminal
  4. Hold Windows key and drag anywhere on the gnome-terminal to move the window. It is moved as expected
  5. Any subsequent mouse interactions with the wslg window has its mouse coordinates offset by the same amount of pixels that the window was moved.

For example, moving the window 100 px to the right means that if you click what is visually 0,0 in the window, the click will end up at 100,0.

Windows build 21390.co_release.210521-1658

$ wsl --status
Default Distribution: Ubuntu
Default Version: 2

Windows Subsystem for Linux was last updated on 2021-06-23
WSL automatic updates are on.

Kernel version: 5.10.16
hideyukn88 commented 3 years ago

@nevyn, thanks for reporting the issue. Yes, this is one of known limitation with WSLg today. If window is moved by Windows without involving WSLg, WSLg doesn't know the window has been moved, thus such misalignment occurs. In order to support this scenario properly, we will need to add so-called "local move" feature in RDP to WSLg, and we will plan to support this in future release. Thanks for trying out WSLg!

crramirez commented 3 years ago

@nevyn What happens if you Alt+Drag the Linux Window with AltDrag Disabled?

hideyukn88 commented 3 years ago

@crramirez @nevyn, as you might notice our rdprail-shell does support this, just like weston's desktop-shell. But it's disabled by default. If you want to enable, you can add below to weston.ini, and rebuild system-distro VHD following the instruction in README.md. We are looking into what would be the best way for user to customize the behavior of system distro without rebuilding system-distro. Thanks!

[shell] binding-modifier=alt

darkguy2008 commented 3 years ago

I used this as a workaround, blacklisting the RAIL_WINDOW classes (and Progman too, to avoid alt-dragging the desktop 😅) so I don't accidentally alt-drag WSLg windows.

image

However, it isn't the ideal solution. I looked at the CONTRIBUTING.md file with some instructions to rebuild the VHD image but it seems a tad overkill and cumbersome for just changing an INI value (that IMO should be the default).

@hideyukn88 is there any known estimate when we can see this working or a way to easily modify the weston.ini file without following such a complicated process?

Thanks :)

P.S. Now that we're here, Windows should natively have some kind of alt-dragging windows...

darkguy2008 commented 2 years ago

@hideyukn88 hello! Are there any news regarding this as of 2022? Any better way than to rebuild the full VHD image for just editing a single file? Maybe a hard/soft link or something on the Linux side? Thanks!

mirage335 commented 1 year ago

Going from the opposite direction, I use mouse macros with 'Alt+Space' . Infuriatingly, this does not work with WSL windows. Modifying this autohotkey script ( https://www.autohotkey.com/docs/v1/scripts/EasyWindowDrag_(KDE).ahk )to only Alt+Click move/resize WSL windows encounters this bug.

So if the titlebar or edges of the window are difficult to get to, WSL windows cannot be moved/resized at all. That is rather bad.

Meantime, running 'plasma' through 'xephyr' is more usable in this regard.