MolotovCherry / virtual-display-rs

A Windows virtual display driver to add multiple virtual monitors to your PC! For Win10+. Works with VR, obs, streaming software, etc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cursor repeat

hhmfs opened this issue · comments

When I create and open a virtual screen and use remote software streaming connection, two cursors appear on my screen, one on the controlled side and one on the master side, and there is a slight ghost as I move. How to solve this problem? Thank you very much!

This has been a reported problem on the c++ driver implementations as well (also the example driver project). Unfortunately, it's currently unknown how to solve it.

If anyone knows the cause, feel free to add them here.

OP: Can you add reproducible steps?

You will get double cursor on Parsec or similar remote desktop apps when the hardware cursor is not supported in your virtual display. One cursor on local screen and another one on remote client.

image

To solve it, just call IddCxMonitorSetupHardwareCursor in your assign_swap_chain().

self.swap_chain_processor = Some(processor);

Here's the C++ example:

void IndirectMonitorContext::AssignSwapChain(IDDCX_SWAPCHAIN SwapChain, LUID RenderAdapter, HANDLE NewFrameEvent)
{
  // after successfully assigning swapchain processor

  // create an event to get notified new cursor data
  HANDLE mouseEvent = CreateEventA(
    nullptr, //TODO set proper SECURITY_ATTRIBUTES
    false, 
    false,
    "arbitraryMouseEventName");;

  // set up cursor capabilities
  IDDCX_CURSOR_CAPS cursorInfo = {};
  cursorInfo.Size = sizeof(cursorInfo);
  cursorInfo.AlphaCursorSupport = true;
  cursorInfo.MaxX = 64; //TODO figure out correct maximum value
  cursorInfo.MaxY = 64; //TODO figure out correct maximum value
  cursorInfo.ColorXorCursorSupport = IDDCX_XOR_CURSOR_SUPPORT_NONE; //TODO play around with XOR cursors

  // prepare IddCxMonitorSetupHardwareCursor arguments
  IDARG_IN_SETUP_HWCURSOR hwCursor = {};
  hwCursor.CursorInfo = cursorInfo;
  hwCursor.hNewCursorDataAvailable = mouseEvent; // this event will be called when new cursor data is available

  NTSTATUS Status = IddCxMonitorSetupHardwareCursor(
    m_Monitor, // handle to the monitor we want to enable hardware mouse on
    &hwCursor
  );
  
  // handle [Status] error
}

@nomi-san Thank you very much! I'll try to reproduce this later (along with the fix)!

Anybody reading this, would you mind testing out this hardware cursor implementation?
I tested locally and think it's working, but I need more eyes on this before I can mark it as solved.

(note: this release only has a cli. make sure you completely uninstall and remove old driver before installation)

(there's a download link for the files under "artifacts")
https://github.com/MolotovCherry/virtual-display-rs/actions/runs/8457389727

I've tested and it works properly.
You should provide user script to install the driver with ease.

start /wait .\nefconw.exe --remove-device-node --hardware-id Root\VirtualDisplayDriver --class-guid "4D36E968-E325-11CE-BFC1-08002BE10318"
start /wait .\nefconw.exe --create-device-node --class-name Display --class-guid "4D36E968-E325-11CE-BFC1-08002BE10318" --hardware-id Root\VirtualDisplayDriver
start /wait .\nefconw.exe --install-driver --inf-path ".\VirtualDisplayDriver.inf"

I've opened a PR to add it to the README #107.
You also should change the portable release by adding the nefconw CLI, and remove the manual installation (via device manager) in README.

I've tested and it works properly.

Perfect! Thanks for testing it