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

Implement new Input Capture protocol #7919

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

3l0w
Copy link

@3l0w 3l0w commented Sep 26, 2024

Describe your PR, what does it fix/add?

This PR implements the input capture protocol defined in hyprwm/hyprland-protocols#8.
It also fixed a bug where wl_output::geometry x and y arguments where always 0.
The wl_output::geometry event is now sent when the output layout change (Help to follow x and y modifications).

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

One bug that i found and i need to investigate, is when i capture every inputs,i can't shortcut into TTYs anymore.

Is it ready for merging, or does it need work?

It still need work, like sending the keyboard layout.

@@ -1,6 +1,7 @@
[submodule "subprojects/hyprland-protocols"]
path = subprojects/hyprland-protocols
url = https://github.com/hyprwm/hyprland-protocols
url = https://github.com/3l0w/hyprland-protocols
branch = feat/input-capture-impl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marking this one as a blocker until this is removed so we dont forget (don't resolve)

src/protocols/InputCapture.hpp Outdated Show resolved Hide resolved
src/protocols/core/Output.cpp Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
src/protocols/InputCapture.cpp Outdated Show resolved Hide resolved
src/protocols/InputCapture.cpp Outdated Show resolved Hide resolved
src/protocols/InputCapture.cpp Outdated Show resolved Hide resolved
@littleblack111

This comment was marked as off-topic.

@3l0w
Copy link
Author

3l0w commented Oct 7, 2024

just a general question. will this be released in the next release or will it be taking a while, considering it's marked as draft

Idk when it will be finished. if you need it, build it yourself

@littleblack111
Copy link
Contributor

With your fork, will kvm software such as input leap work out of the box?

@3l0w
Copy link
Author

3l0w commented Oct 8, 2024

Yes and i am it to test
But only the capture part (server) will work for now

@littleblack111
Copy link
Contributor

littleblack111 commented Oct 9, 2024

wow it was really troublesome compiling xdg-desktop-portal-hyprland. have to copy over the protocol to my /usr/share/hyprland-protocols(or clone it there), or i just removed the if line and forced it to get it from the repo.

but, it seems to just fail in input-leap:

[2024-10-09T19:43:32] ERROR: Failed to initialize InputCapture session, quitting: CreateSession failed

it was giving a error that it cant find the input-leap location before installing your hyprland & xdg-desktop-portal-hyprland fork. that error is gone. but still failed.

@3l0w
Copy link
Author

3l0w commented Oct 9, 2024

Its strange that you have to copy the protocol file over, did you clone the submodules ? (git submodule init && git submodule update)
Also i forget to mention that you need to copy the file hyprland.portal over to a location that the xdg-desktop-portal will pick it up (on my arch install its over /usr/share/xdg-desktop-portal/portals/hyprland.portal) and dont forget to restart the xdg-desktop-portal after that.
Without that xdg-desktop-portal will not pickup xdph when forwarding InputCapture requests.

@littleblack111
Copy link
Contributor

littleblack111 commented Oct 11, 2024

Its strange that you have to copy the protocol file over, did you clone the submodules ? (git submodule init && git submodule update)

its the cmakelist file, it tried to grab from /usr/share/hyprland-protocols if exist, which doesn't have your protocol as it's not merged in the hyprland-protocol repo, thus i made it only grab from the gh repo.
as seen in here:

if(HYPRLAND_PROTOS_FOUND)
  set(HYPRLAND_PROTOCOLS "${HYPRLAND_PROTOS_PREFIX}/share/hyprland-protocols")
else()
  set(HYPRLAND_PROTOCOLS "${CMAKE_SOURCE_DIR}/subprojects/hyprland-protocols")
endif()

i see, ill try that

EDIT: in the install(from README: cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build cmake --build build sudo cmake --install build) seem to already copy hyprland.portal over

HOLLY! wow, not sure why, but i re-builded it and reinstalled it. and it WORKS! ty!

A suggestion is that, disable this when mouse or keyboard is being capture/binded by programs(e.g. games that uses mouse to move camera)

After two days of use. those are some feedbacks:
first of all, i just wanna say ty, cuz it works!

this is what im using:
kvm software -> input leap
server -> arch linux(with hyprland)
client -> macbook

but i have the following issues:

  1. after a while, modifier keys such as super or ctrl will just be hold on the client, even if i press the button again. Until I relaunch/bind input capture, it will keep doing that
  2. sometimes it will just randomly stop and i have relaunch/bind input capture
  3. after going to macos, hyprland cursor wont disappear
  4. Going from hyprland -> macos does seem to inhert/respect where the cursor is on hyprland, but when im switching back from macOS -> Hyprland, the cursor seem to instead inherit where it left off(described above, it does not disappear)
  5. Clipboard sharing does not work
  6. sometimes hyprland reload when its focused on the client can make everything go to nowhere(supposed their in the client, but client doesnt change), even if the client disconnect, changing tty doesnt work. or moving mouse, can only press the power button or ssh in and soft-reboot etc(kind of like the xwayland crash where when if you're intereacting with ur computer during a hyprland reload, it might crash xwayland)

@3l0w
Copy link
Author

3l0w commented Oct 13, 2024

Thanks for the feedback tho i didn't encounter most of the issues you describe, but i will try to investigate it.
I am currently implementing a shortcut to force release the pointer and give it back to hyprland to prevent softlock.
The portal that i am implementing is not responsible for sharing the clipboard so there is really nothing i can do to make it work, it is a inputleap related issue.
I will try to implement something to make the cursor disappear, and also i need handle the cursor position send by the client when the capture is released maybe it will fix 4.
I am not yet sending modifier keys, i will impl it soon to see if it will fix 1 for you.

@littleblack111
Copy link
Contributor

alright. ty! Appreciate it!

@3l0w
Copy link
Author

3l0w commented Oct 22, 2024

The latest commit added a new shortcut: releaseinputcapture
This shortcut force release the capturing of inputs in case of softlock.

Personally, I bind it like this:

bind = $mainMod SHIFT, escape, releaseinputcapture

@littleblack111
Copy link
Contributor

littleblack111 commented Oct 22, 2024

Nice! I'm currently on vacation without my laptop, so I'll try it when I get back

EDIT: Now i tried it, the new dispatcher works! ill try it when it locks down hyprland again and see if it works then

@littleblack111
Copy link
Contributor

A suggestion is that, disable this when mouse or keyboard is being capture/binded by programs(e.g. games that uses mouse to move camera)

if thats not possible then maybe add a dispatcher so user can script it to do so

@littleblack111
Copy link
Contributor

trim.44B51EBB-2916-40A4-BFBB-7EBA4AF42874.MOV

@3l0w
Copy link
Author

3l0w commented Oct 30, 2024

A suggestion is that, disable this when mouse or keyboard is being capture/binded by programs(e.g. games that uses mouse to move camera)

if thats not possible then maybe add a dispatcher so user can script it to do so

You mean if a 3d game has kinda the mouse captured and move it to a border the input is captured and should not ?
I think its kinda a major issue if its the case, i will look into it

@3l0w
Copy link
Author

3l0w commented Oct 30, 2024

trim.44B51EBB-2916-40A4-BFBB-7EBA4AF42874.MOV

If you have any steps to reproduce it it will be great

@littleblack111
Copy link
Contributor

littleblack111 commented Oct 30, 2024

A suggestion is that, disable this when mouse or keyboard is being capture/binded by programs(e.g. games that uses mouse to move camera)

if thats not possible then maybe add a dispatcher so user can script it to do so

You mean if a 3d game has kinda the mouse captured and move it to a border the input is captured and should not ? I think its kinda a major issue if its the case, i will look into it

yes, for example my macbook is left, and i moved my cursor in game(that i captured) to left, it will eventually go to my mac screen. It does this in X11 too, but hoping it gets fixed as its unintended behavior and is very annoying since i have to quit my kvm software(input leap) in order to play games properly

@3l0w
Copy link
Author

3l0w commented Oct 30, 2024

It is quite strange that you where able to still move the mouse in your primary computer.

@littleblack111
Copy link
Contributor

not sure, it just happend randomly, but before it happend, i was impl a new feature and was opening a nested Hyprland, but i wont try again today cuz it's pretty late and ill sleep

@littleblack111
Copy link
Contributor

A suggestion is that, disable this when mouse or keyboard is being capture/binded by programs(e.g. games that uses mouse to move camera)

if thats not possible then maybe add a dispatcher so user can script it to do so

You mean if a 3d game has kinda the mouse captured and move it to a border the input is captured and should not ? I think its kinda a major issue if its the case, i will look into it

related: https://www.reddit.com/r/kde/comments/u34lg0/wayland_gaming_and_mouse_capture/

@littleblack111
Copy link
Contributor

a window rule to prevent inputcapture will be great too

@3l0w
Copy link
Author

3l0w commented Nov 22, 2024

If you make proposition like don't hesitate to explain it a little bit more, like what is supposed to do precisely. It will make my life simpler.
Also i've work on that since a few weeks, i will get back to it in the nexts weeks

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

Successfully merging this pull request may close these issues.

3 participants