Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor repeat #81

Closed
hhmfs opened this issue Feb 5, 2024 · 6 comments
Closed

cursor repeat #81

hhmfs opened this issue Feb 5, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@hhmfs
Copy link

hhmfs commented Feb 5, 2024

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!

@hhmfs hhmfs added the bug Something isn't working label Feb 5, 2024
@MolotovCherry
Copy link
Owner

MolotovCherry commented Feb 5, 2024

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?

@nomi-san
Copy link
Contributor

nomi-san commented Feb 22, 2024

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
}

@MolotovCherry
Copy link
Owner

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

MolotovCherry added a commit that referenced this issue Mar 27, 2024
@MolotovCherry
Copy link
Owner

MolotovCherry commented Mar 27, 2024

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

@nomi-san
Copy link
Contributor

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.

@MolotovCherry
Copy link
Owner

I've tested and it works properly.

Perfect! Thanks for testing it

nomi-san added a commit to nomi-san/parsec-vdd that referenced this issue Mar 29, 2024
- add vdd 0.45 download
- add nefconw, remove devcon
- ref: MolotovCherry/virtual-display-rs#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants