mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-09 07:38:05 +03:00
style: apply cargo fmt
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.
This commit is contained in:
committed by
Ferdinand Schober
parent
e863cdb801
commit
e5862e10e3
@@ -435,8 +435,9 @@ fn create_event_tap<'a>(
|
|||||||
CGEventType::FlagsChanged,
|
CGEventType::FlagsChanged,
|
||||||
];
|
];
|
||||||
|
|
||||||
let event_tap_callback =
|
let event_tap_callback = move |_proxy: CGEventTapProxy,
|
||||||
move |_proxy: CGEventTapProxy, event_type: CGEventType, cg_ev: &CGEvent| {
|
event_type: CGEventType,
|
||||||
|
cg_ev: &CGEvent| {
|
||||||
log::trace!("Got event from tap: {event_type:?}");
|
log::trace!("Got event from tap: {event_type:?}");
|
||||||
let mut state = client_state.blocking_lock();
|
let mut state = client_state.blocking_lock();
|
||||||
let mut capture_position = None;
|
let mut capture_position = None;
|
||||||
@@ -599,8 +600,7 @@ fn event_tap_thread(
|
|||||||
// callback runs on this thread's CFRunLoop. Box-leak the sender
|
// callback runs on this thread's CFRunLoop. Box-leak the sender
|
||||||
// so the C side has a stable user_info pointer; reclaim it after
|
// so the C side has a stable user_info pointer; reclaim it after
|
||||||
// the run loop exits.
|
// the run loop exits.
|
||||||
let display_user_info =
|
let display_user_info = Box::into_raw(Box::new(display_notify_tx)) as *mut c_void;
|
||||||
Box::into_raw(Box::new(display_notify_tx)) as *mut c_void;
|
|
||||||
unsafe {
|
unsafe {
|
||||||
CGDisplayRegisterReconfigurationCallback(
|
CGDisplayRegisterReconfigurationCallback(
|
||||||
display_reconfiguration_callback,
|
display_reconfiguration_callback,
|
||||||
@@ -613,10 +613,7 @@ fn event_tap_thread(
|
|||||||
log::debug!("event tap thread exiting!...");
|
log::debug!("event tap thread exiting!...");
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
CGDisplayRemoveReconfigurationCallback(
|
CGDisplayRemoveReconfigurationCallback(display_reconfiguration_callback, display_user_info);
|
||||||
display_reconfiguration_callback,
|
|
||||||
display_user_info,
|
|
||||||
);
|
|
||||||
// Reclaim the leaked sender Box so we don't leak a tokio
|
// Reclaim the leaked sender Box so we don't leak a tokio
|
||||||
// channel sender on every capture create/destroy cycle.
|
// channel sender on every capture create/destroy cycle.
|
||||||
drop(Box::from_raw(
|
drop(Box::from_raw(
|
||||||
@@ -633,11 +630,7 @@ fn event_tap_thread(
|
|||||||
/// then again afterwards with the actual change flags (Add, Remove,
|
/// then again afterwards with the actual change flags (Add, Remove,
|
||||||
/// Mode, DesktopShapeChanged, etc.). Skip the begin phase; on the
|
/// Mode, DesktopShapeChanged, etc.). Skip the begin phase; on the
|
||||||
/// real notification, kick the producer task to refresh bounds.
|
/// real notification, kick the producer task to refresh bounds.
|
||||||
extern "C" fn display_reconfiguration_callback(
|
extern "C" fn display_reconfiguration_callback(_display: u32, flags: u32, user_info: *mut c_void) {
|
||||||
_display: u32,
|
|
||||||
flags: u32,
|
|
||||||
user_info: *mut c_void,
|
|
||||||
) {
|
|
||||||
const K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG: u32 = 1 << 0;
|
const K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG: u32 = 1 << 0;
|
||||||
if flags & K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG != 0 {
|
if flags & K_CG_DISPLAY_BEGIN_CONFIGURATION_FLAG != 0 {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -219,9 +219,7 @@ fn build_ui(app: &Application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
macos_privacy::AccessibilityChange::Revoked => {
|
macos_privacy::AccessibilityChange::Revoked => {
|
||||||
log::warn!(
|
log::warn!("Accessibility revoked — quitting to avoid wedging system input");
|
||||||
"Accessibility revoked — quitting to avoid wedging system input"
|
|
||||||
);
|
|
||||||
if let Some(app) = app_weak.upgrade() {
|
if let Some(app) = app_weak.upgrade() {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
@@ -291,4 +289,3 @@ fn build_ui(app: &Application) {
|
|||||||
window.present();
|
window.present();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ pub fn accessibility_granted() -> bool {
|
|||||||
raw != 0
|
raw != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub enum AccessibilityChange {
|
pub enum AccessibilityChange {
|
||||||
/// AX was missing at startup and the user has now granted it.
|
/// AX was missing at startup and the user has now granted it.
|
||||||
/// Capture/emulation still need a relaunch to take effect, since
|
/// Capture/emulation still need a relaunch to take effect, since
|
||||||
|
|||||||
Reference in New Issue
Block a user