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 Input Capture Desktop Portal #268

Draft
wants to merge 13 commits into
base: master
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 desktop portal with the new protocol defined in hyprwm/hyprland-protocols#8.

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

Nothing to declare yet.

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

It work when used with hyprwm/Hyprland#7919, but still need work, like sending the keyboard layout, or security concerns.

@@ -1,6 +1,7 @@
[submodule "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)

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

a bit of a lengthy review, mostly style and guidelines. Many comments apply to the entirety of the PR

src/core/PortalManager.cpp Outdated Show resolved Hide resolved
src/core/PortalManager.hpp Outdated Show resolved Hide resolved
src/portals/InputCapture.cpp Outdated Show resolved Hide resolved
src/portals/InputCapture.cpp Outdated Show resolved Hide resolved
src/portals/InputCapture.cpp Outdated Show resolved Hide resolved
src/shared/Eis.cpp Outdated Show resolved Hide resolved
src/shared/Eis.cpp Outdated Show resolved Hide resolved
src/shared/Eis.cpp Outdated Show resolved Hide resolved
src/shared/Eis.cpp Outdated Show resolved Hide resolved
src/shared/Eis.hpp Outdated Show resolved Hide resolved
@vaxerski
Copy link
Member

tag me for review when ready

@littleblack111
Copy link

littleblack111 commented Oct 25, 2024

hey, uh the new version did not compile with the following error:

[ 22%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o
/home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::init()’:
/home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:211:58: error: no matching function for call to ‘createSessionBusConnection(const char [45])’
  211 |         m_pConnection = sdbus::createSessionBusConnection("org.freedesktop.impl.portal.desktop.hyprland");
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/sdbus-c++/sdbus-c++.h:27,
                 from /home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:4,
                 from /home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:1:
/usr/include/sdbus-c++/IConnection.h:481:55: note: candidate: ‘std::unique_ptr<sdbus::IConnection> sdbus::createSessionBusConnection()’
  481 |     [[nodiscard]] std::unique_ptr<sdbus::IConnection> createSessionBusConnection();
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sdbus-c++/IConnection.h:481:55: note:   candidate expects 0 arguments, 1 provided
/usr/include/sdbus-c++/IConnection.h:491:55: note: candidate: ‘std::unique_ptr<sdbus::IConnection> sdbus::createSessionBusConnection(const ServiceName&)’
  491 |     [[nodiscard]] std::unique_ptr<sdbus::IConnection> createSessionBusConnection(const ServiceName& name);
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sdbus-c++/IConnection.h:491:101: note:   no known conversion for argument 1 from ‘const char [45]’ to ‘const sdbus::ServiceName&’ {aka ‘const sdbus::BusName&’}
  491 |     [[nodiscard]] std::unique_ptr<sdbus::IConnection> createSessionBusConnection(const ServiceName& name);
      |                                                                                  ~~~~~~~~~~~~~~~~~~~^~~~
/home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::startEventLoop()’:
/home/system/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:366:35: error: ‘class sdbus::IConnection’ has no member named ‘processPendingRequest’; did you mean ‘processPendingEvent’?
  366 |             while (m_pConnection->processPendingRequest()) {
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   processPendingEvent
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics
make[2]: *** [CMakeFiles/xdg-desktop-portal-hyprland.dir/build.make:125: CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/xdg-desktop-portal-hyprland.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
-- Install configuration: ""
CMake Error at build/hyprland-share-picker/cmake_install.cmake:52 (file):
  file INSTALL cannot find
  "/home/system/xdg-desktop-portal-hyprland/build/hyprland-share-picker/hyprland-share-picker":
  No such file or directory.
Call Stack (most recent call first):
  build/cmake_install.cmake:47 (include)

@3l0w 3l0w force-pushed the feat/input-capture-impl branch from 37c5d83 to 75a754a Compare October 25, 2024 23:33
@3l0w
Copy link
Author

3l0w commented Oct 25, 2024

I am aware, it is due to the sdbus version bumb, it should be good now

@Azodox
Copy link

Azodox commented Oct 26, 2024

I am having this:

In file included from /home/luke/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:11,
                 from /home/luke/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:1:
/home/luke/xdg-desktop-portal-hyprland/src/core/../portals/InputCapture.hpp:2:10: fatal error: dbusDefines.hpp: No such file or directory
    2 | #include "dbusDefines.hpp"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/xdg-desktop-portal-hyprland.dir/build.make:125: CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/xdg-desktop-portal-hyprland.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
-- Install configuration: ""
-- Installing: /usr/bin/hyprland-share-picker
-- Up-to-date: /usr/bin/hyprland-share-picker
CMake Error at build/cmake_install.cmake:81 (file):
  file INSTALL cannot find
  "/home/luke/xdg-desktop-portal-hyprland/build/xdg-desktop-portal-hyprland":
  No such file or directory.

@@ -0,0 +1,100 @@
#pragma once
#include "dbusDefines.hpp"

Choose a reason for hiding this comment

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

Suggested change
#include "dbusDefines.hpp"
#include "../dbusDefines.hpp"

@littleblack111
Copy link

@3l0w
Copy link
Author

3l0w commented Oct 26, 2024

I pushed the fix

@littleblack111
Copy link

i gave feedback in hyprwm/Hyprland#7919

@gptlang
Copy link

gptlang commented Nov 5, 2024

Hyprland 0.44.0 built from branch  at commit 189f6152f1354ae936cafffa7b7dd62af8dd5bd4  (input-capture: fix rebase issues).

Deskflow:

[2024-11-05T00:39:23] ERROR: failed to initialize input capture session, quitting: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.InputCapture” on object at path /org/freedesktop/portal/desktop

Is this currently working?

@littleblack111
Copy link

it works for me. restart ur xdg-desktop-portals after installation

@3l0w
Copy link
Author

3l0w commented Nov 5, 2024

Also make sure that the hyprland.portal file has been copied over /usr/share/xdg-desktop-portal/portals

@littleblack111
Copy link

littleblack111 commented Nov 5, 2024

also, as an update, still consistently have my modifiers always held down on the client and have to restart input leap/the connection(stop then start again) to fix

@gptlang
Copy link

gptlang commented Nov 5, 2024

It seems to work fine now as the server. org.freedesktop.portal.RemoteDesktop is still needed for the client though.

@littleblack111
Copy link

littleblack111 commented Nov 9, 2024

also @3l0w, input capture should not work in ext-session-lock. i.e. rn in hyprlock, you can still control other device via input leap

@littleblack111
Copy link

It seems to work fine now as the server. org.freedesktop.portal.RemoteDesktop is still needed for the client though.

dont know if this will work: https://github.com/waycrate/xdg-desktop-portal-luminous since hyprland is no longer wlroots. but it does have org.freedesktop.portal.RemoteDesktop

@3l0w 3l0w force-pushed the feat/input-capture-impl branch from a1d88df to b645519 Compare January 9, 2025 12:25
@mewoocat
Copy link

Any updates on the status of this PR?

@littleblack111
Copy link

littleblack111 commented Jan 15, 2025

Any updates on the status of this PR?

have you tested it? I believe the following problems have to be solved before merge:

  1. instability, still have to restart it few times a day
  2. not sure why, i did not bind anything on top of my display, but it will attempt to capture my mouse when i put it on the edge of the top of my display(doesnt happen to right or bottom, i binded left), behavoir can be seen as the mouse disappearing(captured) then reappearing shortly after(since it's input-leap have nothing to put it to or just refused or sth)
  3. prob need an configurable option to release the current keys/modi when switching screens
  4. isLock() delay meaning if your mouse is captured by an application on ur server, and around the same time, you put ur cursor to the edge, it can be going thru(so either fix isLock()(which idk how to do), or fix: forcerelease when locked && captured 3l0w/Hyprland#3 which have on going discussion on how should the release be done

EDIT: did not relize there is new commits here in xdph too, will test them out

@3l0w
Copy link
Author

3l0w commented Jan 21, 2025

Any updates on the status of this PR?

have you tested it? I believe the following problems have to be solved before merge:

1. instability, still have to restart it few times a day

2. not sure why, i did not bind anything on top of my display, but it will attempt to capture my mouse when i put it on the edge of the top of my display(doesnt happen to right or bottom, i binded left), behavoir can be seen as the mouse disappearing(captured) then reappearing shortly after(since it's input-leap have nothing to put it to or just refused or sth)

3. prob need an configurable option to release the current keys/modi when switching screens

4. isLock() delay meaning if your mouse is captured by an application on ur server, and around the same time, you put ur cursor to the edge, it can be going thru(so either fix isLock()(which idk how to do), or [fix: forcerelease when locked && captured 3l0w/Hyprland#3](https://github.com/3l0w/Hyprland/pull/3) which have on going discussion on how should the release be done

EDIT: did not relize there is new commits here in xdph too, will test them out

Top capturing don't work ? do you have a screen binded on top ? Even disabled ?

@littleblack111
Copy link

littleblack111 commented Jan 21, 2025

Any updates on the status of this PR?

have you tested it? I believe the following problems have to be solved before merge:

1. instability, still have to restart it few times a day

2. not sure why, i did not bind anything on top of my display, but it will attempt to capture my mouse when i put it on the edge of the top of my display(doesnt happen to right or bottom, i binded left), behavoir can be seen as the mouse disappearing(captured) then reappearing shortly after(since it's input-leap have nothing to put it to or just refused or sth)

3. prob need an configurable option to release the current keys/modi when switching screens

4. isLock() delay meaning if your mouse is captured by an application on ur server, and around the same time, you put ur cursor to the edge, it can be going thru(so either fix isLock()(which idk how to do), or [fix: forcerelease when locked && captured 3l0w/Hyprland#3](https://github.com/3l0w/Hyprland/pull/3) which have on going discussion on how should the release be done

EDIT: did not relize there is new commits here in xdph too, will test them out

Top capturing don't work ? do you have a screen binded on top ? Even disabled ?

nope. no screen binded on top. only when enabled

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

Successfully merging this pull request may close these issues.

6 participants