<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lan-mouse/input-capture/src/macos.rs, branch main</title>
<subtitle>a fork</subtitle>
<id>https://git.nsrddyn.com/lan-mouse/atom/input-capture/src/macos.rs?h=main</id>
<link rel='self' href='https://git.nsrddyn.com/lan-mouse/atom/input-capture/src/macos.rs?h=main'/>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/'/>
<updated>2026-10-25T11:33:54Z</updated>
<entry>
<title>fix(macos): respect Natural Scrolling for scroll direction, both directions (#498)</title>
<updated>2026-10-25T11:33:54Z</updated>
<author>
<name>Daniel Hanson</name>
<email>hansondr@users.noreply.github.com</email>
</author>
<published>2026-10-25T11:33:54Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=cf22560fad2eda18b7a3cba4d4e4e3be8cf83fe0'/>
<id>urn:sha1:cf22560fad2eda18b7a3cba4d4e4e3be8cf83fe0</id>
<content type='text'>
* fix(macos): respect Natural Scrolling for scroll direction, both directions

Scrolling from a non-macOS sender onto a macOS receiver is inverted
(wl_pointer.axis / libei use positive = scroll down/right, the opposite of
CGEvent's convention). Symmetrically, a macOS sender scrolls backwards on
non-macOS receivers.

Capture (input-capture/src/macos.rs): negate the delta at capture time on
both the continuous (PIXEL) and discrete (v120) paths and both axes, so the
wire stays source-agnostic (matches the approach in #470). Real hardware
deltas already reflect this Mac's own Natural Scrolling preference -- the OS
applies that transform upstream, before the event reaches this tap -- so a
fixed conversion is correct here; no preference read is needed.

Emulation (input-emulation/src/macos.rs): convert the wire sign to CGEvent's
sign, but -- unlike #470's fixed conversion -- read the receiver's
com.apple.swipescrolldirection preference and negate conditionally. This
revives the approach from #460, caching the CFString preference key on
MacOSEmulation instead of allocating it per scroll tick.

A synthetic CGEvent posted at the HID event tap produces the same on-screen
direction for a given sign regardless of Natural Scrolling (confirmed on
hardware, consistent with #470 and #481). But a real trackpad's delta sign is
flipped by the OS before the CGEvent exists, specifically because of Natural
Scrolling. So with a fixed conversion, turning Natural Scrolling on desyncs a
real trackpad from Lan Mouse's forwarded mouse-wheel input on the same Mac;
turning it off only re-syncs them because the fixed sign happens to match the
non-natural convention. Reading the preference keeps both in sync in either
state.

Verified on real hardware, both directions, against the exact 0.11.0 release
protocol (not just main, to rule out wire-compatibility noise):
- Windows (sender) -&gt; macOS/Apple Silicon (receiver): correct with Natural
  Scrolling both on and off; forwarded scroll stays in sync with the
  receiving Mac's own trackpad in both states.
- macOS/Apple Silicon (sender) -&gt; Windows (receiver): correct with Natural
  Scrolling both on and off, matching what a real trackpad in each state
  produces.

Prior art: #470 (capture-side fix reproduced here), #460 (the emulation-side
preference read this revives), #481 (the symptom report), #415 / #347 (as
noted in #470).

* invert scrolling for Axis events, not Axis120

this matches the wire convention from Linux / Libei, etc.

---------

Co-authored-by: Ferdinand Schober &lt;ferdinandschober20@gmail.com&gt;</content>
</entry>
<entry>
<title>fix(macos): correct scroll direction for remote clients</title>
<updated>2026-10-25T10:05:01Z</updated>
<author>
<name>zhoujinze</name>
<email>zhoujinze@gmail.com</email>
</author>
<published>2026-06-07T11:49:13Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=fb7a77a2a78d4eb3fc21a991c66c85aea561679f'/>
<id>urn:sha1:fb7a77a2a78d4eb3fc21a991c66c85aea561679f</id>
<content type='text'>
macOS scroll deltas use the opposite sign convention from evdev
when Natural Scrolling is OFF. When Natural Scrolling is ON, the
system negates the deltas, which happens to match evdev.

Read CGEvent field 137 (isDirectionInvertedFromDevice) to detect
whether Natural Scrolling is active. When it is not, negate both
continuous (trackpad) and discrete (mouse wheel) scroll deltas so
the network protocol always carries evdev-compatible values.

Closes #451
</content>
</entry>
<entry>
<title>style: apply cargo fmt</title>
<updated>2026-04-29T20:59:43Z</updated>
<author>
<name>Jon Kinney</name>
<email>jonkinney@gmail.com</email>
</author>
<published>2026-04-28T22:34:24Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=e5862e10e3d8dc9ca1bdcd2fff6456563c4d3183'/>
<id>urn:sha1:e5862e10e3d8dc9ca1bdcd2fff6456563c4d3183</id>
<content type='text'>
No behavior changes. Brings three files back in line with the
project's `style_edition = "2024"` rustfmt config so subsequent
edits don't carry unrelated formatting in their diffs.
</content>
</entry>
<entry>
<title>macos: refresh display bounds on reconfiguration</title>
<updated>2026-04-29T20:59:43Z</updated>
<author>
<name>Jon Kinney</name>
<email>jonkinney@gmail.com</email>
</author>
<published>2026-04-27T19:12:05Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=e863cdb80146d2d7ea8444e235d93c2be9be6208'/>
<id>urn:sha1:e863cdb80146d2d7ea8444e235d93c2be9be6208</id>
<content type='text'>
InputCaptureState fetches the active-display bounds once in new()
via CGDisplay::active_displays(), and crossed() / start_capture()
both consult those frozen bounds for every barrier check and
cursor warp. Plug in a monitor, change resolution, or rearrange
displays in System Settings and the bounds go stale immediately:
the cursor either stops crossing at the new edge or warps to the
old edge coordinates.

Register a Quartz CGDisplayRegisterReconfigurationCallback on the
event-tap thread's CFRunLoop and route a new
ProducerEvent::DisplayReconfigured into the existing producer
channel. The producer task re-runs update_bounds() on the live
state, so subsequent barrier checks use the current geometry.

The callback fires twice per change — once with the
kCGDisplayBeginConfigurationFlag (BEFORE the bounds update) and
once after — we filter the begin-phase out and only refresh on
the post-change notification. The callback registration is
removed and the leaked sender Box is reclaimed when the run loop
exits, so create/destroy cycles don't leak channel senders.

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>macos: re-enable CGEventTap on tap timeout</title>
<updated>2026-04-29T20:59:43Z</updated>
<author>
<name>Jon Kinney</name>
<email>jonkinney@gmail.com</email>
</author>
<published>2026-04-27T17:59:45Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=3b4b3a51aaf219dbb0b522c835d65393c6e24513'/>
<id>urn:sha1:3b4b3a51aaf219dbb0b522c835d65393c6e24513</id>
<content type='text'>
The kernel disables a session-level CGEventTap when its callback
runs longer than ~1 s on a single event — typical causes are heavy
load, scheduler contention, or the process being briefly suspended
(App Nap on a long idle, debugger pause). It is not a fatal
condition: Apple's documented recovery is to call CGEventTapEnable
and resume processing. Before this change the tap stayed dead until
the user manually clicked Re-enable from the menubar.

Stash the tap's mach port pointer in an Arc&lt;OnceLock&lt;usize&gt;&gt; set
immediately after CGEventTap::new returns, and on
TapDisabledByTimeout call CGEventTapEnable from the callback to
revive the tap while preserving capture state — the user doesn't
see the cursor pop back to the local screen mid-session for a
transient slow callback.

TapDisabledByUserInput keeps the existing teardown path: those
causes (TCC Accessibility revoked mid-session, secure-input mode,
explicit kill) are not safely recoverable from inside the
callback, and the existing fallthrough-fix from
59d9e45 / d1e963e still applies there.

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>fix(input-capture): don't drop events after TCC Accessibility revocation</title>
<updated>2026-04-29T20:59:43Z</updated>
<author>
<name>Jon Kinney</name>
<email>jonkinney@gmail.com</email>
</author>
<published>2026-04-24T14:36:58Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=07cc40f6ba4610d1125350e46e0b481cfb1b292d'/>
<id>urn:sha1:07cc40f6ba4610d1125350e46e0b481cfb1b292d</id>
<content type='text'>
When the user revokes Accessibility in System Settings while Lan
Mouse is in a captured session (cursor on a remote client), the
session-level event tap receives `TapDisabledByUserInput`. The
previous flow was:

  1. Callback sends `ProducerEvent::EventTapDisabled` to notify_tx.
  2. Callback falls through the `current_pos.is_some()` branch and
     returns `CallbackResult::Drop` — *this very event*, plus any
     racing callback still in flight, get `set_type(Null)`'d and
     consumed.
  3. Outer task calls `handle_producer_event(..).unwrap_or_else(|e|
     log::error!(..))` — the `EventTapDisabled` error is just logged,
     the loop keeps running, `current_pos` stays `Some`, cursor
     stays hidden.

Net effect for the user: mouse motion keeps working (pass-through
when the tap is fully dead), but clicks and keypresses in the brief
disable window silently disappear, and the cursor is still hidden
where the captured session left it. Input looks broken until the
app is force-quit.

Fix:
- In the callback, when `TapDisabled*` fires, clear `current_pos`
  and `CGDisplay::show_cursor` synchronously, then return
  `CallbackResult::Keep` so this event (and any subsequent racing
  one) can't hit the drop branch.
- Mirror the cleanup in `handle_producer_event`'s
  `EventTapDisabled` arm so even if the outer task only logs the
  error, state is still released.

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>macos: per-pane TCC navigation and Sequoia-tolerant permission flow</title>
<updated>2026-04-29T20:59:43Z</updated>
<author>
<name>Jon Kinney</name>
<email>jonkinney@gmail.com</email>
</author>
<published>2026-04-24T07:09:32Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=5e79743bd05a4bcfa48f9e9262896985e767a91b'/>
<id>urn:sha1:5e79743bd05a4bcfa48f9e9262896985e767a91b</id>
<content type='text'>
On macOS the three TCC grants (Accessibility, Input Monitoring, Post
Event) live in separate Privacy panes. Before this change the
"Reenable" row sent the user to Accessibility regardless of which
grant was actually missing, and the daemon's own permission checks
re-fired the Accessibility prompt on every retry.

- lan-mouse-gtk/src/macos_privacy.rs: new module that exposes silent
  preflight checks (AXIsProcessTrusted, CGPreflightListenEventAccess,
  CGPreflightPostEventAccess), per-pane URL-scheme navigation, and
  a Once-guarded fire_initial_prompts() called from build_ui. The
  initial-prompt path only fires the Accessibility prompt if AX is
  missing and then returns; secondary registrations run only after
  AX is granted, which prevents a double Accessibility alert on
  Sequoia where Post Event is nested under Accessibility.
- Input Monitoring registration attempts CGEventTapCreate at
  kCGSessionEventTap (not kCGHIDEventTap) so a failure surfaces as
  an Input Monitoring signal rather than triggering an Accessibility
  prompt as a side effect.
- lan-mouse-gtk/src/window/imp.rs: handle_capture / handle_emulation
  switch on the missing-pane enum and navigate to the specific pane
  via x-apple.systempreferences:... URLs before re-requesting.
- lan-mouse-gtk/resources/window.ui: pill class on the Reenable
  buttons so the hover padding matches the rest of libadwaita.
- input-capture/src/macos.rs, input-emulation/src/macos.rs: make
  request_*_permission() a silent preflight (AXIsProcessTrusted /
  CGPreflightListenEventAccess / CGPreflightPostEventAccess), so the
  daemon no longer fires TCC prompts on retry — all prompting is
  owned by the GUI.
- input-capture/src/error.rs, input-emulation/src/error.rs: new
  error variants so the GUI can distinguish missing-AX from
  missing-IM / missing-PostEvent for pane routing.

Verified on macOS 15.5: first launch fires a single AX prompt;
second launch (AX granted) registers under Input Monitoring via the
session-tap attempt and requests Post Event. Sequoia auto-grants the
listen-only path via AX so the IM list may stay empty, which is the
intended OS behavior and no longer blocks capture.

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>fix(macos): forward back/forward mouse buttons in capture and emulation (#392)</title>
<updated>2026-02-22T16:45:53Z</updated>
<author>
<name>Ty Smith</name>
<email>ty@tysmith.me</email>
</author>
<published>2026-02-22T16:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=27225ed56435681b18cfbb0499320fc626359730'/>
<id>urn:sha1:27225ed56435681b18cfbb0499320fc626359730</id>
<content type='text'>
* 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-&gt;BTN_BACK,
4-&gt;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&lt;u32&gt; keyed by evdev button code so each button is tracked
independently.

---------

Co-authored-by: Ferdinand Schober &lt;ferdinandschober20@gmail.com&gt;</content>
</entry>
<entry>
<title>ad fixme for memory leak</title>
<updated>2026-02-08T12:14:11Z</updated>
<author>
<name>Ferdinand Schober</name>
<email>ferdinandschober20@gmail.com</email>
</author>
<published>2026-02-06T14:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=394c018e114b82ecb08a63ec5c5946d32e25f17b'/>
<id>urn:sha1:394c018e114b82ecb08a63ec5c5946d32e25f17b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>macos: fix memory leak</title>
<updated>2026-02-06T14:29:24Z</updated>
<author>
<name>Ferdinand Schober</name>
<email>ferdinandschober20@gmail.com</email>
</author>
<published>2026-02-06T14:29:24Z</published>
<link rel='alternate' type='text/html' href='https://git.nsrddyn.com/lan-mouse/commit/?id=708a40d0da8c127c098a55dcc9c76f57c0bea499'/>
<id>urn:sha1:708a40d0da8c127c098a55dcc9c76f57c0bea499</id>
<content type='text'>
probably should use an AutoreleasePool as well
</content>
</entry>
</feed>
