macos: drop the CapturePane / EmulationPane enums

Now that we always route Reenable clicks to the Accessibility pane on
macOS 13+ (AX transitively covers Input Monitoring listen-only and
Post Event, and the bundle isn't listed in the separate panes anyway),
the CapturePane / EmulationPane enums and their non-Accessibility
variants are dead weight. Remove them along with:

- `missing_capture_pane` / `missing_emulation_pane`
- `open_input_monitoring_settings` / `open_post_event_settings`
- `input_monitoring_granted` / `post_event_granted` preflight wrappers
- the `CGPreflightListenEventAccess` / `CGPreflightPostEventAccess`
  FFI declarations in lan-mouse-gtk (the daemon crates keep their own)

`handle_capture` / `handle_emulation` collapse to a single helper that
opens the Accessibility pane if AX is missing, otherwise just retries.
`ensure_listed_in_input_monitoring` is kept because it still has a
side effect on macOS 13/14, where Input Monitoring is a separately-
granted category.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jon Kinney
2026-04-24 08:35:10 -05:00
committed by Ferdinand Schober
parent b3cade9bac
commit 8a444f98dd
2 changed files with 18 additions and 113 deletions

View File

@@ -10,6 +10,16 @@ use lan_mouse_ipc::{DEFAULT_PORT, FrontendRequestWriter};
use crate::authorization_window::AuthorizationWindow;
#[cfg(target_os = "macos")]
fn open_accessibility_if_missing(ctx: &str) {
if crate::macos_privacy::accessibility_granted() {
log::info!("{ctx}: Accessibility already granted, retry only");
} else {
log::info!("{ctx}: opening Accessibility pane");
crate::macos_privacy::open_accessibility_settings();
}
}
#[derive(CompositeTemplate, Default)]
#[template(resource = "/de/feschber/LanMouse/window.ui")]
pub struct Window {
@@ -143,44 +153,14 @@ impl Window {
#[template_callback]
fn handle_emulation(&self) {
#[cfg(target_os = "macos")]
{
use crate::macos_privacy::{self, EmulationPane};
match macos_privacy::missing_emulation_pane() {
EmulationPane::Accessibility => {
log::info!("Reenable emulation: opening Accessibility pane");
macos_privacy::open_accessibility_settings();
}
EmulationPane::PostEvent => {
log::info!("Reenable emulation: opening Post Event pane");
macos_privacy::open_post_event_settings();
}
EmulationPane::None => {
log::info!("Reenable emulation: both grants present, retry only");
}
}
}
open_accessibility_if_missing("Reenable emulation");
self.obj().request_emulation();
}
#[template_callback]
fn handle_capture(&self) {
#[cfg(target_os = "macos")]
{
use crate::macos_privacy::{self, CapturePane};
match macos_privacy::missing_capture_pane() {
CapturePane::Accessibility => {
log::info!("Reenable capture: opening Accessibility pane");
macos_privacy::open_accessibility_settings();
}
CapturePane::InputMonitoring => {
log::info!("Reenable capture: opening Input Monitoring pane");
macos_privacy::open_input_monitoring_settings();
}
CapturePane::None => {
log::info!("Reenable capture: both grants present, retry only");
}
}
}
open_accessibility_if_missing("Reenable capture");
self.obj().request_capture();
}