49 Commits

Author SHA1 Message Date
Ty Smith
27225ed564 fix(macos): forward back/forward mouse buttons in capture and emulation (#392)
* fix(macos): forward back/forward mouse buttons in capture and emulation

OtherMouseDown/Up events on macOS carry a button number field that
distinguishes middle (2), back (3), and forward (4) buttons. The
capture backend was unconditionally mapping all OtherMouse events to
BTN_MIDDLE, silently dropping back/forward. The emulation backend had
no match arms for BTN_BACK/BTN_FORWARD, causing them to be dropped
with a warning.

Fix capture by reading MOUSE_EVENT_BUTTON_NUMBER and mapping 3->BTN_BACK,
4->BTN_FORWARD. Fix emulation by adding match arms for BTN_BACK/BTN_FORWARD
and setting MOUSE_EVENT_BUTTON_NUMBER on the emitted CGEvent so macOS
apps receive the correct button identity.

* fix(macos): track button state and double-clicks by evdev code instead of CGMouseButton

Back, forward, and middle buttons all map to CGMouseButton::Center on
macOS, which caused them to share a single pressed-state boolean and
alias in double-click detection. Replace the ButtonState struct with a
HashSet<u32> keyed by evdev button code so each button is tracked
independently.

---------

Co-authored-by: Ferdinand Schober <ferdinandschober20@gmail.com>
2026-02-22 17:45:53 +01:00
Kenichi Nakamura
bcf9c35301 Fix stuck modifiers (#385)
fixes #357
2026-02-22 17:45:14 +01:00
Peter Hutterer
ad63b6ba20 Handle the RemoteDesktop portal restore token correctly (#383)
For a session to actually persist, we need to request a persistence mode
which we already do. The portal then returns a restore-token (in the
form of an uuid) to us as part of the response to Start.

This token must then be passed into the *next* session during
SelectDevices to restore the previous session.

The token is officially a single-use token, so we need to overwrite it
every time. In practise the current XDP implementation may re-use the
token but we cannot rely on that.

Reading and writing the token is not async since we expect them to be
uuid-length.

Closes #74.
2026-02-11 13:27:32 +01:00
NeoTheFox
3f13714d8a Add rustfmt.toml for explicit styling (#348)
* Propose an explicit .rustfnt.toml
Use 2024 style, 4 spaces for tabs and epand the default width a tad

* Auto-format the existing code with new rules
2025-11-02 11:52:01 +01:00
Ferdinand Schober
f91b6bd3c1 macos: reset double click when mouse is moved (#341) 2025-10-30 00:48:24 +01:00
Ferdinand Schober
2d1a037eba macos: fix duplicated key release event (#340) 2025-10-29 18:37:24 +01:00
Ferdinand Schober
057f6e2567 macos: emulate double / triple click (#338) 2025-10-29 17:46:15 +01:00
Ferdinand Schober
99c8bc5567 macsos: use ScrollEventUnit::LINE for mousewheel (#337) 2025-10-29 16:18:46 +01:00
Ferdinand Schober
4e5a66340a Partially Revert "slow scrolling chrome with emulation=wlroots capture=layer-shell (#318) (#325)" (#334)
The division by 120 was correct.
2025-10-27 15:56:30 +01:00
Thomas Matthijs
39b79d88a5 slow scrolling chrome with emulation=wlroots capture=layer-shell (#318) (#325)
Using niri as compositor on both sides resulting in: emulation=wlroots capture=layer-shell

Mouse scrolling works fine in terminals, but only scrolls very small amount in google-chrome (in wayland mode)

Using 'wev' to show events, using the real mouse shows

[        15:      wl_pointer] axis_source: 0 (wheel)
[        15:      wl_pointer] axis_value120: axis: 0 (vertical), value120: 120
[        15:      wl_pointer] axis_relative_direction: axis: 0 (vertical), direction: 0
[        15:      wl_pointer] axis: time: 50410752; axis: 0 (vertical), value: 15.000000

Using the lan-mouse shows:

[        15:      wl_pointer] axis_source: 2 (continuous)
[        15:      wl_pointer] axis_value120: axis: 0 (vertical), value120: 1
[        15:      wl_pointer] axis_relative_direction: axis: 0 (vertical), direction: 0
[        15:      wl_pointer] axis: time: -1913142096; axis: 0 (vertical), value: 20.000000

Without axis_source, scrolling over (pinned) tabs also skips one tab.
2025-10-09 00:28:26 +02:00
Ferdinand Schober
eb1dcbddb0 update dependencies (#302)
* update dependencies

* update windows

* clippy: inline format args

* update flake

* update core-graphics

* fix poll after completion error

* fix ashpd?!
2025-10-08 16:10:32 +02:00
Ferdinand Schober
37a4e236b8 fix clippy warnings from rust 1.87 (#301) 2025-06-12 17:52:23 +02:00
VassiliDev
beb656e29f Clippy changes 2025-01-24 16:26:09 +01:00
VassiliDev
3b811ea593 Remove newline 2025-01-24 16:26:09 +01:00
VassiliDev
b517679849 Remove redundant dep 2025-01-24 16:26:09 +01:00
VassiliDev
68d6d89510 Handle locks (Caps/Num/Scroll)
Assume server is authoritative re ModifiersEvent
2025-01-24 16:26:09 +01:00
VassiliDev
345804355a Keep modifier state in WLRoots input emulator 2025-01-24 16:26:09 +01:00
Ferdinand Schober
a962e43724 address clippy lints 2025-01-24 14:52:04 +01:00
Vassili-Dev
a8504df879 Add time to scroll event (#240)
closes #239
2025-01-20 17:32:51 +01:00
Ferdinand Schober
4703a4c947 chore: Release 2024-11-07 12:49:59 +01:00
Ferdinand Schober
a870a9e3a9 split features for emulation and capture backends 2024-11-07 12:43:42 +01:00
Ferdinand Schober
1433a3021b fix conditional compilation for xdp only build 2024-11-07 12:21:38 +01:00
Ferdinand Schober
66456f18f1 update core-graphics / foundation (#227) 2024-11-07 01:15:35 +01:00
Ferdinand Schober
1d25dfbe50 upgrade ashpd + reis (#226) 2024-11-07 00:38:26 +01:00
Ferdinand Schober
9d28fe6c7b bump dependencies 2024-11-06 23:53:42 +01:00
Ferdinand Schober
7496015d8d macos: implement client side modifier events (#219)
closes #198
closes #199
2024-10-27 08:41:26 +01:00
Ferdinand Schober
ab1b45ff45 macos: fix key-release with repeat logic (#206) 2024-10-04 18:21:40 +02:00
Jacob Barber
b071201dcb Fix multimonitors (#202)
Co-authored-by: Jacob Barber <jacob.barber@disney.com>

closes #83
2024-09-20 20:50:37 +02:00
Ferdinand Schober
19c2c4327f move lan-mouse protocol to separate crate (#178) 2024-08-11 16:51:47 +02:00
Ferdinand Schober
096567640c fix pressed key tracking
accidentally broke this in 8f7890c

closes #174
2024-08-08 13:33:04 +02:00
Ferdinand Schober
8f7890c9be move refcounting of key presses to input-emulation (#169) 2024-08-06 16:46:32 +02:00
Ferdinand Schober
ec412a5e74 chore: Release 2024-07-30 11:12:20 +02:00
Ferdinand Schober
e1096ae86c fix macos build error 2024-07-30 11:11:45 +02:00
Ferdinand Schober
0509b51a61 chore: Release 2024-07-30 11:06:27 +02:00
Ferdinand Schober
06ac390dbf chore: Release 2024-07-30 11:05:03 +02:00
Ferdinand Schober
dcc9250b6d fix repository url 2024-07-30 11:04:21 +02:00
Ferdinand Schober
376ae50b45 chore: Release 2024-07-30 11:03:08 +02:00
Ferdinand Schober
0e2c749b29 fix conditional compilation 2024-07-30 10:52:56 +02:00
Ferdinand Schober
65fb228db5 upgrade dependencies 2024-07-19 12:58:52 +02:00
Ferdinand Schober
975d4b58a5 fix scrolling factor in xdp emulation 2024-07-17 11:26:43 +02:00
Ferdinand Schober
bea7d6f8a5 Allow input capture & emulation being disabled (#158)
* Input capture and emulation can now be disabled and will prompt the user to enable again.

* Improved error handling to deliver more useful error messages
2024-07-16 20:34:46 +02:00
Ferdinand Schober
6a4dd740c3 code cleanup + purge anyhow in library code (#157) 2024-07-10 00:33:49 +02:00
Ferdinand Schober
703465a370 fix drop impl for desktop-portal 2024-07-05 01:41:11 +02:00
Ferdinand Schober
ef3ebc59bd adjust error handling 2024-07-05 01:41:11 +02:00
Ferdinand Schober
37a8f729ea remove dispatch workaround 2024-07-05 01:41:11 +02:00
Ferdinand Schober
9abec63313 update dependencies 2024-07-03 11:11:50 +02:00
Ferdinand Schober
35e626976e add explicit version 2024-07-02 22:39:20 +02:00
Ferdinand Schober
82ab5ecbbd fix xdg-desktop-portal backend not available 2024-07-02 22:07:37 +02:00
Ferdinand Schober
4db2d37f32 split into input-{event,capture,emulation} 2024-07-02 22:07:37 +02:00