debauchee / barrier

Open-source KVM software
Other
27.67k stars 1.52k forks source link

Remote Desktop Client captures mouse input on server while on client #880

Open BrockU-CentreForDigitalHumanities opened 4 years ago

BrockU-CentreForDigitalHumanities commented 4 years ago

Describe the bug Remote Desktop window incorrectly displays cursor (jittering near 0,0) and registers intermittent input from mouse on Barrier Server (MacOS) even if cursor is moved to Barrier Client (MacOS). Leads to spurious input on remote machine (dangerous).

To Reproduce

Steps to reproduce the behavior:

  1. Install Barrier 2.3.3 Server (macOS) client (macOS), Install Microsoft Remote Desktop Client Version 10.4.0 (1811) (MSRDC) on Barrier Server computer.
  2. Start Barrier Server and Client.
  3. Launch Remote Desktop Session. When you are logged into Remote Desktop window move cursor to Barrier Client. Cursor will hover and jitter around 0,0 on Remote Desktop window and occasionally register input events (happens in both windows and fullscreen).
  4. See error [2020-09-23T13:35:40] DEBUG2: no-op from [2020-09-23T13:35:40] DEBUG2: mouse move +997.308594,+586.960938 [2020-09-23T13:35:40] DEBUG2: onMouseMoveSecondary -26,+11

Expected behavior When Remote Desktop is running on Barrier Server and Cursor is moved to Barrier Client, Cursor should only appear on client and provide events on client. Cursor should not appear or provide input on Remote Desktop Window until cursor is moved back to Barrier Server. There are no issues when Remote Desktop is running on Barrier Client.

Desktop:

Additional context

Likely a problem with secondary display handling due to Remote Desktop Window appearing on Barrier Server. Problem Function seems to be OSXScreen::onMouseMove()

maelcum commented 4 years ago

Can confirm behavior - to some extent - with Microsoft Remote Desktop v10.4.1 (1825) and Apple macOS 10.15.7.


Moving from Barrier_server to Barrier_client:

My observation is that the mouse pointer successfully changes from (the screen of) Barrier_server to (the screen of) Barrier_client.

on the Barrier_server: At this point, the mouse pointer is placed in the middle of the monitor (horizontally as well as vertically). It should now disappear. i. If a Remote Desktop client window has been open, but not been active, the mouse pointer disappears as expected. ii. If a Remote Desktop client window has been active, the mouse pointer does not disappear. This is also true when the Remote Desktop client has been in fullscreen mode (as it is the active window at this point). iii. (Only) If a Remote Desktop client window overlaps the middle of the screen, the mouse pointer (which is placed in the middle of the screen) is placed in the Remote Desktop client window.

on the Barrier_client: The mouse pointer shows up and continuing to move the mouse, moves the pointer as expected. No problem yet.

If the Remote Desktop client on Barrier_Server has been in Fullscreen mode, then (and only then) will moving the mouse pointer on the Barrier_client make the mouse pointer on Barrier_Server jitter.


Moving back from Barrier_client to Barrier_server:

Moving the mouse pointer back from Barrier_client to Barrier_server works as well.

If a Remote Desktop client window had happened to overlap the position in the middle of the screen (and the mouse pointer thus been placed there visibly) (eg. case iii from above), it sometimes happens that the mouse pointer does not snap back to where the mouse pointer should enter the screen on Barrier_server. Instead, movement of the mouse pointer (which should start at the screen border) starts from the position on the middle of the screen, making it look as if the Remote Desktop client window had somehow snatched the pointer. In my experiments, this happens most often when the mouse pointer was moved rapidly from one screen to the other.

Cursor should not appear or provide input on Remote Desktop Window until cursor is moved back to Barrier Server.

At no point have I observed the Barrier_server Remote Desktop client window actually acted upon anything the mouse pointer does on the Barrier_client. It just looks that way, because the mouse pointer changes its shape from Mac to Windows, and in case of a fullscreen Remote Desktop, the mouse pointer jitters.


Testing was done with the Barrier_server to the right and the Barrier_client to the left. An active Remote Desktop client window was moved in the middle of Barrier_server, and to the very side left and right side of the screen to observe the mouse pointer in different states.

From my view, this might be a unique problem in combination with the Microsoft Remote Desktop client. A VMware Fusion client window, also prone to capturing the mouse pointer, does not cause any problem.

I've attached a screenshot, which shows

Barrier_server_while_mouse_pointer_is_on_Barrier_client_while_RDP_session_is_open

I've attached another screenshot, which shows

The screenshots were made with a timeout of 5 secs, during which I moved the mouse to Barrier_client. :) Barrier_server_while_mouse_pointer_is_on_Barrier_client_while_RDP_session_is_open2

Update: And FWIW another screenshot where the Remote Desktop client is fullscreen, with the mouse pointer dead center. Barrier_server_while_mouse_pointer_is_on_Barrier_client_and_RDP_session_is_fullscreen