Skip to content

Fix Alt+click being consumed by Linux window managers - #2063

Closed
Xamaneone wants to merge 1 commit into
moonlight-stream:masterfrom
Xamaneone:fix-linux-alt-click
Closed

Xamaneone wants to merge 1 commit into
moonlight-stream:masterfrom
Xamaneone:fix-linux-alt-click

Conversation

@Xamaneone

Copy link
Copy Markdown

Problem

On Linux, window managers commonly bind Alt+left click to moving or resizing
windows. Since 6.2 no longer captures the mouse by default in windowed mode,
the window manager's passive grab consumes Alt+click before Moonlight sees it,
so the click never reaches the host.

Adding Ctrl or Shift changes the modifier state and bypasses the binding, so
Ctrl+Alt+click and Shift+Alt+click worked while Alt+click, W+Alt+click and
Space+Alt+click did not.

Fix

Grab or constrain the pointer while Alt is held, and release it on Alt release,
focus loss, or when capture is disabled:

  • X11/XWayland: active pointer grab.
  • Wayland: pointer constraint via SDL_SetWindowMouseGrab, which makes KWin
    skip its global window actions.

The first click in windowed uncaptured mode still performs the normal
click-to-capture, matching existing behavior.

Testing

  • Client: Ubuntu 22.04.5 LTS, X11
  • Alt+LMB now reach the host.
  • Ctrl+Alt+Shift+Z still toggles capture; Ctrl+Alt+Shift+Q still disconnects.
  • Alt+Tab and normal window interaction are unaffected.

validated manually

Window managers commonly bind Alt+left click to moving or resizing windows.
Since 6.2 no longer captures the mouse by default in windowed mode, that
passive grab consumes Alt+click before Moonlight receives it, so the click
never reaches the host. Adding Ctrl or Shift changes the modifier state and
bypasses the window-manager binding, which is why Ctrl+Alt+click and
Shift+Alt+click still appeared to work.

Grab or constrain the pointer while Alt is held, and release it on Alt
release, focus loss, or when capture is disabled. On X11 this is an active
pointer grab. On Wayland the pointer constraint makes KWin skip its global
window actions.
@cgutman

cgutman commented Oct 24, 2026

Copy link
Copy Markdown
Member

Why are you pressing Alt+LMB to start mouse capture instead of just LMB?

@Xamaneone

Copy link
Copy Markdown
Author

Games that require you to hold ALT to unlock the mouse cursor, so you can click on UI elements.
Some software also require you to hold ALT and LMB to do special action like rotating object for example.
And I'm sure there are plenty more use cases out there!

@cgutman

cgutman commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Maybe I'm not understanding what your bug report is describing. I don't see how what an app on your host needs the Alt button for has to do with the default non-captured mouse behavior in Moonlight.

Am I correct in stating that Alt+Click works fine when the mouse is captured by Moonlight but doesn't work when it isn't?

@Xamaneone

Copy link
Copy Markdown
Author

You were right to question this. I dug in properly and it isn't a Moonlight bug. A GNOME extension I had installed was interfering with Alt: while Alt is held, it adds a full-screen input overlay that swallows clicks before any window gets them. A plain xev window loses Alt+click the same way, and disabling the extension fixes it in the 6.2 snap.

It showed up after 6.2 for me because my old build used native SDL2, whose pointer grab in relative mode got past the overlay. The SDL3/sdl2-compat build doesn't, which is fine since an extension eating clicks isn't something Moonlight should work around.

Closing this. Sorry for the noise, and thanks for asking the right question.

@Xamaneone Xamaneone closed this Oct 24, 2026
@Xamaneone
Xamaneone deleted the fix-linux-alt-click branch October 24, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants