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

Wayland missing cursor #135

Open
Tesla-Tank opened this issue Mar 12, 2023 · 6 comments
Open

Wayland missing cursor #135

Tesla-Tank opened this issue Mar 12, 2023 · 6 comments
Labels

Comments

@Tesla-Tank
Copy link

I'm using Nobara37 and don't have the option to enable cursor capture on wayland. Any suggestions? Thank you.

@nowrep
Copy link
Owner

nowrep commented Mar 12, 2023

It requires this protocol https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/124 and there is only one implementation currently - patch for sway.

Unless you are capturing native wayland games, you can run OBS under xwayland obs -platform xcb to get cursor capture.

@nowrep nowrep closed this as completed Mar 12, 2023
@Tesla-Tank
Copy link
Author

Tesla-Tank commented Mar 13, 2023

Running obs with xwayland and gamecapture doesn't show anything. I tried using it on AoE and vkcube, nothing is showing up. Any suggestions?

@YellowOnion
Copy link

@nowrep am I wrong in thinking that since we're injecting a dll in to the client app, we should be able to ignore compositor support and just straight wire the cursor to OBS?

Or is this more of a "I don't want the extra work" sort of issue?

It would be nice if there was some way to capture games cursors, without opening OBS in X mode, I want to keep using wlrobs, as pipewire always prompts for capture device (at-least it did this last time I tried).

Also why does this plugin need a special wayland protocol when cursor works fine in wlrobs and pipewire capture?

@nowrep nowrep added the wayland label Sep 12, 2023
@nowrep
Copy link
Owner

nowrep commented Sep 12, 2023

@nowrep am I wrong in thinking that since we're injecting a dll in to the client app, we should be able to ignore compositor support and just straight wire the cursor to OBS?

In theory yes, in practice it's way more complicated. It's pretty simple to get mouse events (I even have a branch with this 5cd5a44) but that's where the simple part ends.

It also needs to get the cursor image data, and it's not possible with the proxy approach above. This needs to either hook libwayland (at runtime, not with LD_PRELOAD because Vulkan layer is loaded late) or use private structs from libwayland (this is already used with xlib but there it's not much of an issue since xlib is not in active development anymore).

And even if we get there, it's not a win yet. Wayland cursors are not special, it's just another wl_surface which means it may be shm buffer or it could also be dma-buf. Not every dma-buf can be cpu mapped (and on nvidia, NO dma-buf can be cpu mapped), so this also adds lot of code.

So it definitely is possible and I think this issue should be re-opened. If this approach is implemented, it would also solve the cursor alignment inside game window.

Also why does this plugin need a special wayland protocol when cursor works fine in wlrobs and pipewire capture?

It uses "software" cursor, eg. it asks the compositor to draw the cursor into the captured buffer.

@nowrep nowrep reopened this Sep 12, 2023
@nowrep nowrep changed the title Wayland missing cursor (Nvidia) Wayland missing cursor Sep 12, 2023
nowrep added a commit that referenced this issue Sep 13, 2023
@nowrep
Copy link
Owner

nowrep commented Sep 13, 2023

There's also another issue with the cursor image: new protocol https://wayland.app/protocols/cursor-shape-v1

So ideally we would get the cursor image from compositor and read the cursor coordinates inside captured window from the process itself (which is what the wip branch already does).

@fililip
Copy link

fililip commented Aug 1, 2024

With this approach, I think there's also the issue of getting the correct cursor image at any given time - when hovering over text inputs, for instance, the cursor should be text. Cursor shape changes work correctly when playing x11 games, of course.

Unless get_pointer() would already let that happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants