Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Hammerspoon 2/Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,25 @@
#import <JavaScriptCore/JavaScriptCore.h>
JS_EXPORT void JSSynchronousGarbageCollectForDebugging(JSContextRef ctx);

// IOHIDGetAccelerationWithKey / IOHIDSetAccelerationWithKey were deprecated in macOS 10.12
// but remain the only public API for reading and writing live mouse-acceleration values
// for the current session. These wrappers silence the deprecation warnings so they can be
// called from Swift without polluting the build log.
#import <IOKit/hidsystem/IOHIDLib.h>

static inline kern_return_t
hs_IOHIDGetAccelerationWithKey(io_connect_t handle, CFStringRef key, double *acceleration) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return IOHIDGetAccelerationWithKey(handle, key, acceleration);
#pragma clang diagnostic pop
}

static inline kern_return_t
hs_IOHIDSetAccelerationWithKey(io_connect_t handle, CFStringRef key, double acceleration) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return IOHIDSetAccelerationWithKey(handle, key, acceleration);
#pragma clang diagnostic pop
}

2 changes: 2 additions & 0 deletions Hammerspoon 2/Engine/ModuleRoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import JavaScriptCoreExtras
@objc var sound: HSSoundModule { get }
@objc var network: HSNetworkModule { get }
@objc var window: HSWindowModule { get }
@objc var mouse: HSMouseModule { get }
}

@_documentation(visibility: private)
Expand Down Expand Up @@ -196,6 +197,7 @@ import JavaScriptCoreExtras
@objc var sound: HSSoundModule { get { getOrCreate(name: "sound", type: HSSoundModule.self)}}
@objc var network: HSNetworkModule { get { getOrCreate(name: "network", type: HSNetworkModule.self)}}
@objc var window: HSWindowModule { get { getOrCreate(name: "window", type: HSWindowModule.self)}}
@objc var mouse: HSMouseModule { get { getOrCreate(name: "mouse", type: HSMouseModule.self)}}
}

// MARK: - JSContextInstallable
Expand Down
Loading
Loading