moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4.12k stars 651 forks source link

keep native mouse cursor #959

Open gazugafan opened 3 years ago

gazugafan commented 3 years ago

I'm trying to use Moonlight on a low power Android device for remote desktop, and it's working shockingly well! I'm using a Bluetooth mouse and keyboard, but I've noticed that the native Android mouse cursor is hidden/disabled when using Moonlight. This sort've makes sense, as you would end up with two mouse cursors otherwise--the Android cursor, and the one being streamed. However, I think I would prefer that.

As it is now, there's enough lag between moving the mouse and seeing the streamed cursor's position update to make working like this a little unconformable. I have to move the mouse and then wait a moment to see exactly where the cursor lands before clicking. If the native Android cursor were still visible, though, I would see where it lands instantly--even if the resulting streamed cursor lags behind slightly.

Is there an option to keep the native Android mouse cursor visible? If not, would that be an easy thing to add?

I've looked through some Android developer options and for apps that draw an overlay mouse cursor, but haven't really found anything.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

gazugafan commented 3 years ago

I still think this would be a good option to add, but feel free to close if you don't agree.

Heath123 commented 3 years ago

https://github.com/loki-47-6F-64/sunshine/issues/145#issuecomment-890157298

Heath123 commented 3 years ago

This would be useful on Chrome OS

GoD-Tony commented 3 years ago

This is also affecting my Android TV and USB mouse.

According to the Android docs:

[requestPointerCapture()](https://developer.android.com/reference/android/view/View#requestPointerCapture()) Requests pointer capture mode. When the window has pointer capture, the mouse pointer icon will disappear and will not change its position.

This means Android's native cursor is effectively disabled. Would it be possible for Moonlight to redraw a custom mouse pointer locally overtop of the video stream?

jorbig commented 2 years ago

Any progress on this?

In the Android client, we can use CTRL + ALT + SHIFT + N to hide/unhide the cursor on the host, but the shortcut CTRL + ALT + SHIFT + C does nothing, so we can't hide/unhide the cursor on the client in order to have the mouse cursor rendered locally.

cgutman commented 2 years ago

This means Android's native cursor is effectively disabled. Would it be possible for Moonlight to redraw a custom mouse pointer locally overtop of the video stream?

Potentially, but right now we use MediaCodec to draw straight to the SurfaceView for the best possible efficiency. We could possibly do it now with the remote desktop mouse mode I added in 81a3bbd5e8ba07990d901c0b6d77276c8ee43b1b, but there may be performance issues with moving an ImageView around constantly.

jorbig commented 2 years ago

This feature missing is the only reason I keep switching back to Parsec and RDP apps.The remote mouse cursor just doesn't feel smooth enough.

noaho commented 1 year ago

I agree, this would be great for remote desktop applications

On Linux, there's not much except sunshine/moonlight that is a smooth remote desktop experience, but, the further away you get from the host system (eg, if the system is in another country) the more the mouse lag become intolerable. For most RDP applications lag is perfectly tolerable, so long as the mouse cursor updates immediately.

rogtheo commented 1 year ago

This is possibly the only feature that parsec has, giving it an edge over the moonlight sunshine combo.

I use VNC, RDP and Parsec for general remote desktop usage but moonlight for game streaming. With moonlight i get the best video performance but it feels slower than even rdp on desktop just because of the mouse responsiveness.

There is already a function to hide remote mouse and show local mouse (hide remote mouse doesn't always work). With the local mouse moonlight feels miles better but the local mouse doesn't recognise what you hover on.

If this gets implemented it'll make moonlight/sunshine all in one for desktop and gaming!

CristianPi commented 1 year ago

Can someone explain to me what to do so that i can do a pr? i need this feature ASAP as using linux with wayland and gnome gives me no way to use remote cursor sunshine issue

rockyqp commented 1 year ago

I noticed that the Qt version of Moonlight has this feature and can be toggled with "ctrl+shift+alt+c". Is it possible for the Android version to receive an update with this feature? It is indeed a very useful feature.

cgutman commented 1 year ago

The problem with supporting local cursor on Android is that pointer capture and local cursor are incompatible on Android. To support showing the local cursor, we'd have to avoid capturing the cursor. Doing that would unlock the cursor from Moonlight, so it would trigger System UI elements when your cursor reaches the borders of the screen.

jorbig commented 1 year ago

@cgutman That's why Android solutions like Samsung DeX support a few seconds time-out before triggering an action when reaching the border. So I would still love this functionality!

ashesofdream commented 11 months ago

Is this feature will be implemented? On some games ,the mouse lag make the experience bad.

silvernode commented 9 months ago

Well I don't get a mouse cursor at all on my host linux machine running wayland though I am not sure if I am in the right issue thread for that topic. I can't see the android mouse cursor either so I have no idea where I am clicking which makes using moonlight completely unusable.

rogtheo commented 9 months ago

I have found that if you don't see a mouse at all, is usually because you do not have a mouse device plugged into your host. Moonlight emulates the "state" of the host mouse. So if there isn't a mouse plugged into the host, then it "emulates" no mouse icon. If you have a mouse plugged in, then it might be related to this issue here, https://github.com/moonlight-stream/moonlight-chrome/issues/408

-------- Original message -------- From: silvernode @.> Date: 11/01/2024 19:52 (GMT+00:00) To: moonlight-stream/moonlight-android @.> Cc: rogtheo @.>, Comment @.> Subject: Re: [moonlight-stream/moonlight-android] keep native mouse cursor (#959)

Well I don't get a mouse cursor at all on my host linux machine running wayland though I am not sure if I am in the right issue thread for that topic. I can't see the android mouse cursor either so I have no idea where I am clicking which makes using moonlight completely unusable.

— Reply to this email directly, view it on GitHubhttps://github.com/moonlight-stream/moonlight-android/issues/959#issuecomment-1887864111, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANTS6CWA43XNM2PZ3XIQPHDYOA7JPAVCNFSM42GCASH2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYG44DMNBRGEYQ. You are receiving this because you commented.Message ID: @.***>

cgutman commented 9 months ago

Well I don't get a mouse cursor at all on my host linux machine running wayland though I am not sure if I am in the right issue thread for that topic. I can't see the android mouse cursor either so I have no idea where I am clicking which makes using moonlight completely unusable.

That bug you are describing is https://github.com/LizardByte/Sunshine/issues/93 which has already been fixed in Sunshine nightly builds.

jorbig commented 9 months ago

The problem with supporting local cursor on Android is that pointer capture and local cursor are incompatible on Android. To support showing the local cursor, we'd have to avoid capturing the cursor. Doing that would unlock the cursor from Moonlight, so it would trigger System UI elements when your cursor reaches the borders of the screen.

Please reconsider your position on this issue, because for most people, triggering System UI elements isn't a bad thing at all. At least consider supporting the local mouse as an option! It would be great for office work, and give me the one last reason to switch from Parsec/RDP solutions which do support local mouse mode (Parsec even by default).

lattice0 commented 8 months ago

just tested on Galaxy Tab S9 Ultra. Control Shift Alt C indeed makes the cursor appear, but then I cannot click on anything (cliking has no effect when mouse is visible, and works when invisible)

sffetlio commented 6 months ago

Just tried ctrl+shift+alt+c and ctrl+shift+alt+n on a Samsung S20FE connecting to win 11 and it works quite well in DEX. When the mouse is moved to the top edge the window controls are displayed after a delay so that's fine. The only small issue is that the back and forward mouse buttons are done on the client (android) but as a workaround they can be disabled in the mouse settings and then work perfectly through moonlight.