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

xinput support #115

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

xinput support #115

wants to merge 13 commits into from

Conversation

iacore
Copy link

@iacore iacore commented Aug 6, 2022

This pull request is as reference.

I did a few things:

  • translate the build system for gui-daemon to Zig, which allowed me to do the following
  • make it C99-compliant (include fnctl.h for O_CREAT and remove __STRING (non-standard) )
  • removed dependency on glib
  • make it compile with musl (other dynamic libraries, however, still need glibc, or be built from source)
  • use libunwind to replace glibc's stacktrace
  • prototype the xinput extension in Zig, than implement it in C (this is basically the same code as in my drop-repeat branch)
  • Added qubes-common as git submodule (since I updated the protocol to include new things)

TODO

  • version detection, instead of blasting new message types like MSG_XI_KEY to all clients
  • bump version in qubes-gui-protocol.h too
  • proper xinput multi-device driver in client-side

Old problems

  • lift all keys after the last window in an VM is closed (the client does't get notified key-up for some reason)
  • allow focus negotiation (let client switch focused window within its own VM)

Future plans (existing requests)

  • send raw events exclusively to client if any of its window is focused (this will help with all input devices)
  • allow other XInput event types, also get input feedback from client

Squashed commit of the following:

commit 8fd4e7f
Author: Locria Cyber <[email protected]>
Date:   Fri Jun 17 03:08:10 2022 +0800

    Add more error handling

commit 403a952
Author: Locria Cyber <[email protected]>
Date:   Sun Mar 13 13:34:04 2022 +0100

    Fix double keypresses

commit 110a6a9
Author: Locria Cyber <[email protected]>
Date:   Tue Mar 8 08:31:49 2022 +0800

    Handle clipboard hotkeys properly

commit cabf231
Author: Locria Cyber <[email protected]>
Date:   Sun Mar 6 03:31:58 2022 +0800

    Use Focus events from XInput, dropping less keytrokes

commit 2f91894
Merge: 8ec6f01 954fb64
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 13:44:40 2022 +0800

    Merge branch 'drop-repeat' of github.com:locriacyber/qubes-gui-daemon into drop-repeat

commit 8ec6f01
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 13:34:13 2022 +0800

    Use base Focus events

commit 954fb64
Merge: 035be7f 14bbf21
Author: Locria Cyber <[email protected]>
Date:   Sat Jun 18 04:42:33 2022 +0800

    Merge branch 'master' into drop-repeat

commit ee70785
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 13:23:32 2022 +0800

    Pass Focus type

commit 035be7f
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 13:34:13 2022 +0800

    Use base Focus events

commit a4a1488
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 13:19:36 2022 +0800

    Don't ignore grab events

commit 576fa94
Author: Locria Cyber <[email protected]>
Date:   Sat Mar 5 12:38:13 2022 +0800

    Don't send evnts to unfocused window

commit 5219d2a
Author: Locria Cyber <[email protected]>
Date:   Sat Feb 26 01:27:14 2022 +0800

    Add XInput/libXi as build dependencies for debian & rpm

commit 70da7d1
Author: Locria Cyber <[email protected]>
Date:   Sat Feb 26 01:24:28 2022 +0800

    Update .gitignore

commit 1bf52ea
Author: Locria Cyber <[email protected]>
Date:   Fri Feb 25 23:05:02 2022 +0800

    Remove duplicate #include

commit cb824aa
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 21:37:34 2022 +0800

    Free X resource as well

commit 48323cd
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 21:22:56 2022 +0800

    Add libxi in Makefile

commit 0611392
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 13:22:42 2022 +0100

    Use XInput Key events instead of X basic events

commit 6bddd0e
Merge: dc60cd4 60ee007
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 12:47:39 2022 +0100

    Merge branch 'xinput' into drop-repeat

commit dc60cd4
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 19:34:20 2022 +0800

    WIP check for XInput events

commit 60ee007
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 01:23:44 2022 +0800

    Process xinput raw events too

commit 86eb904
Author: Locria Cyber <[email protected]>
Date:   Thu Feb 24 01:11:41 2022 +0800

    WIP: use XInput extension
@iacore iacore mentioned this pull request Aug 6, 2022
@iacore
Copy link
Author

iacore commented Aug 11, 2022

Related pull requests

protocol: QubesOS/qubes-gui-common#19
client: QubesOS/qubes-gui-agent-linux#169
server: (you are here)

Disable XInput extension when protocol version < 1.5
@iacore
Copy link
Author

iacore commented Aug 11, 2022

Should be good for testing.

TODO

  • 1.5 server work with 1.3 client
  • 1.5 server work with 1.5 client
  • release all keys (e.g. D) when all windows of a VM are closed
  • change git submodule URL to official repo

@iacore iacore marked this pull request as ready for review August 11, 2022 11:46
for key repeat detection on client side
@DemiMarie
Copy link
Contributor

It turns out that wlroots 0.16.2 uses the following fields from xcb_input_key_press_event_t and xcb_input_key_release_event_t:

  • flags
  • mods (including all subfields)
  • detail
  • time

The following fields are used from xcb_input_button_press_event_t and xcb_input_button_press_event_t:

  • event (window ID in Qubes)
  • detail
  • time

I will update this comment with more details.

@andrewdavidwong
Copy link
Member

Suggestion: If you intend for this pull request to resolve QubesOS/qubes-issues#7231 and would like for it to be linked to the issue automatically, you can put Closes QubesOS/qubes-issues#7231 in the PR message. Closes is one of several special keywords that GitHub will recognize. If and when the PR is merged, GitHub will automatically close the associated issue.

@iacore
Copy link
Author

iacore commented Jul 9, 2024

If you intend for this pull request to resolve QubesOS/qubes-issues#7231

No that's not the intention.

As I stated:

This pull request is as reference.

If I remember this correctly, this was to show how to forward xinput events from domU to low-priv VMs.

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.

3 participants