neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.65k stars 1.73k forks source link

Double mouse cursor #2046

Closed rayrapetyan closed 2 years ago

rayrapetyan commented 2 years ago

I'm running some dosbox games inside the docker container.

Whenever app provides it's own cursor, there are two mouse cursors present on the screen: the default one (from desktop) and the app's native one, e.g. like on the image below:

homm2

They are going out of sync when the default one goes beyond window borders.

Here are some customizations I've tried to get rid of the desktop cursor:

  1. Specify nparam=-nocursor in xorg config in sesman.ini - this changes primary cursor look and shape, but it's still always present on the screen
  2. Changing cursor theme and replacing the "arrow" pointer with an invisible dot - this works, but there is still feeling of the presence of the second cursor, e.g. game cursor hits "invisible walls" sometimes.

What's the right way to disable the desktop mouse cursor? Thanks.

matt335672 commented 2 years ago

Interesting use case.

This isn't an area I'm that familiar with, but I'm pretty sure the xorgxrdp plugin doesn't support operation with -nocursor. In the X server code, using this flag sets the EnableCursor global, and this isn't referenced within xorgxrdp.

Are you in as position to try the Xvnc backend with your docker container?

rayrapetyan commented 2 years ago

Using VNC resolves the issue with the double cursor, thanks. However, now I have issues with the sound etc.

Btw, is there a way to start vnc server using xrdp\sesman? It looks like xrdp assumes vnc server is already running, but I can't run vnc server before X session is created (chicken and egg problem), here is my entrypoint:

/usr/local/sbin/xrdp-sesman
/usr/local/sbin/xrdp --nodaemon
matt335672 commented 2 years ago

If you've got an entry like the following in /etc/xrdp/xrdp.ini you should be able to start Xvnc in the same way as xorg, by selecting Xvnc from the login screen. The default entry on the login screen is whichever section is first in the file.

[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1

You'll need a corresponding entry in /etc/xrdp/sesman.ini to tell it how to run the server:-

[Xvnc]
param=Xvnc
param=-bs
param=-nolisten
param=tcp
param=-localhost
param=-dpi
param=96

If you start Xvnc in this way it will also start xrdp-chansrv automatically. This is the component that provides the sound channels.

These definitions are from the standard files which are installed with the xrdp dpkg (or whatever you're building your container from).

HTH

rayrapetyan commented 2 years ago

Thanks for clarification! Yeah, mouse cursor is not doubling in this proxy mode too. Any ideas of why it happens with RDP and how to fix that?

matt335672 commented 2 years ago

I suspect that we need to add code to xorgxrdp to honour the -nocursor setting. That could take a while I'm afraid.

matt335672 commented 2 years ago

How about your other issues? Does this mode work well enough for your DOS sessions?

rayrapetyan commented 2 years ago

I wouldn't say it's ideal, e.g. when cursor reaches border of the visible area it then suddenly jumps into unpredictable direction. This is especially annoying for apps using border interaction for navigation (e.g. Heroes 2). But this seems is not an RDP\VNC issue and most probably is related to the DosBox itself ("autolock=true" mouse feature)

matt335672 commented 2 years ago

You're probably right about the DosBox cursor, but I'm not really able to comment about that.

Did you get the sound sorted out?

rayrapetyan commented 2 years ago

Yes, sound works with no problems when VNC is used through the RDP proxy, thanks! Not sure if we should close this ticket. Double cursor is not just a DosBox issue, double cursor appear in any app which uses non-system provided cursors, so I believe it's pretty critical. Not sure how it went unnoticed before.

matt335672 commented 2 years ago

Well, the default use-case for xrdp is providing a desktop with an X server.

I'm not a dosbox user, but presumably if you run your application is a window on an X11 or Wayland desktop (rather than full screen) the same thing happens. Is that the case?

This isn't something that's been raised before here, at least not that I'm aware of. Given the workaround in this case (use Xvnc back end) is more than adequate, I'd be happy to close this. It is of course possible to get -nocursor working for the xorg backend, but at the moment I can't see a justification for the implementation and test effort required.

rayrapetyan commented 2 years ago

Np, thanks, sounds good for me!

rbreaves commented 2 years ago

I'm running into this issue as well. Really surprised there is not a way to disable the double cursor issue :/. I had to enable this myself as the proper cursor was not being sent to the remote client so keeping it on the server end was the only way to make things work for me.

Sadly I am left with double cursors now and no easy way to fix this. VNC for me just doesn't have any decent clients available for it compared to RDP to make it a viable alternative for me.

matt335672 commented 2 years ago

Hi @rbreaves

Can you clarify your use-case? Are you using DOSBox as well?

Also, I don't understand your last line. In the context of the conversation above, we're talking about using the VNC backend to xrdp (i.e. the Xvnc server) rather than you needing to use a VNC client.

rbreaves commented 2 years ago

Can you clarify your use-case? Are you using DOSBox as well?

I am not using dosbox, just vnc direct typically. Although I did setup xrdp too just to see how things would work in it too.

I am just trying to code remotely & seeing that my cursors are double given my settings on x11vnc. I need the ability to shut off my 2nd cursor & leave the first one since it looks the best to have it rendered on the remote.

I did find a work around to just render it on my local pc that is going into the remote but it requires that I cut the cursor size in half which leaves it looking low res.

matt335672 commented 2 years ago

OK - thanks for clarifying.

When you say 'no decent VNC clients are available', what are the limitations? Is it sound, performance, security or something else? What's your client platform?

Thanks.

rbreaves commented 2 years ago

When you say 'no decent VNC clients are available', what are the limitations? Is it sound, performance, security or something else? What's your client platform?

Windows and macOS are the 2 platforms I have been testing as the local machine lately, although I am equally likely to use another Linux desktop as well, but I just haven't tested with that since setting up all this VNC server stuff on Linux specifically. On Windows and macOS though most RDP and VNC clients are bad at not allowing you to access the local Desktop (taskbar, Dock & local apps) while in your remote session.

Specifically what I mean by that is that many of the client apps on Windows will prevent the local taskbar from the OS from being accessible when going fullscreen, or on macOS it ends up creating a new Space (aka virtual desktop) on fullscreen and if you try and access another app, even if it is set to appear on all desktops, it'll kick you out of view of that Desktop (aka you go to another Virtual desktop).. so you no longer see the fullscreen remote session that you were just on.

All of this to say.. I am finding things very difficult to obtain a cohesive experience where the remote machines do not feel like remote machines - I am actually trying to create the illusion that all the remote devices I am accessing are local period. So while much of that backstory is irrelevant to the mouse cursor component/issue it does play into that effect I am trying to build which is make things feel seamless.

To be honest I am now happy using macOS w/ Jump Desktop for RDP and VNC as I have found Preferences in it to prevent the creation of "new Spaces" when going fullscreen. Also laying xrdp with x11vnc actually seems to introduce some noticeable lag compared to using VNC over ssh, so I believe I will be foregoing xrdp due to that. If the scrolling and image refresh happened faster or close to on par with what I now have on VNC I might reconsider.

As far as I can tell I now have x11vnc performing better than NoMachine & w/o the overhead of all the heavy encoding and decoding it does, probably at the cost of bandwidth, but I am mostly doing this stuff on a LAN so I am not overly concerned about bandwidth as I am about being easy on the resources.

matt335672 commented 2 years ago

It's all useful information - thanks for adding it.

At best, x11vnc is a bit of a bandaid. xrdp with xorgxrdp is often more performant (especially on a LAN), but there are still cases where VNC is preferable for various reasons. It sounds like you have one of those.

rbreaves commented 2 years ago

Well if you have any suggestions on how I can grab the uinput or create a uinput /dev/input device for the keyboard while in an xorg session then I would love to hear it! As far as I know xorg will want to create a virtual xinput device which is a no go for me and my remapper :/.