diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.pbxproj b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.pbxproj new file mode 100755 index 0000000..58c6c07 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.pbxproj @@ -0,0 +1,357 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 0005A36121697ADD0020F4EC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0005A36021697ADD0020F4EC /* AppDelegate.m */; }; + 0005A36421697ADD0020F4EC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0005A36321697ADD0020F4EC /* ViewController.m */; }; + 0005A36621697ADE0020F4EC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0005A36521697ADE0020F4EC /* Assets.xcassets */; }; + 0005A36921697ADE0020F4EC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0005A36721697ADE0020F4EC /* Main.storyboard */; }; + 0005A36C21697ADE0020F4EC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0005A36B21697ADE0020F4EC /* main.m */; }; + 0005A3762169AF340020F4EC /* MultitouchSupport in Frameworks */ = {isa = PBXBuildFile; fileRef = 0005A3752169AF340020F4EC /* MultitouchSupport */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0005A35C21697ADD0020F4EC /* app_shrinkTrackpad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = app_shrinkTrackpad.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0005A35F21697ADD0020F4EC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 0005A36021697ADD0020F4EC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 0005A36221697ADD0020F4EC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 0005A36321697ADD0020F4EC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 0005A36521697ADE0020F4EC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 0005A36821697ADE0020F4EC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 0005A36A21697ADE0020F4EC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0005A36B21697ADE0020F4EC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 0005A36D21697ADE0020F4EC /* app_shrinkTrackpad.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = app_shrinkTrackpad.entitlements; sourceTree = ""; }; + 0005A3752169AF340020F4EC /* MultitouchSupport */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = MultitouchSupport; path = ../../../../System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport; sourceTree = ""; }; + 00A93FFB216AD68E00E7EC87 /* MultitouchSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MultitouchSupport.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0005A35921697ADD0020F4EC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0005A3762169AF340020F4EC /* MultitouchSupport in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0005A35321697ADD0020F4EC = { + isa = PBXGroup; + children = ( + 0005A35E21697ADD0020F4EC /* app_shrinkTrackpad */, + 0005A35D21697ADD0020F4EC /* Products */, + 0005A3742169AF340020F4EC /* Frameworks */, + ); + sourceTree = ""; + }; + 0005A35D21697ADD0020F4EC /* Products */ = { + isa = PBXGroup; + children = ( + 0005A35C21697ADD0020F4EC /* app_shrinkTrackpad.app */, + ); + name = Products; + sourceTree = ""; + }; + 0005A35E21697ADD0020F4EC /* app_shrinkTrackpad */ = { + isa = PBXGroup; + children = ( + 0005A35F21697ADD0020F4EC /* AppDelegate.h */, + 0005A36021697ADD0020F4EC /* AppDelegate.m */, + 0005A36221697ADD0020F4EC /* ViewController.h */, + 0005A36321697ADD0020F4EC /* ViewController.m */, + 00A93FFB216AD68E00E7EC87 /* MultitouchSupport.h */, + 0005A36521697ADE0020F4EC /* Assets.xcassets */, + 0005A36721697ADE0020F4EC /* Main.storyboard */, + 0005A36A21697ADE0020F4EC /* Info.plist */, + 0005A36B21697ADE0020F4EC /* main.m */, + 0005A36D21697ADE0020F4EC /* app_shrinkTrackpad.entitlements */, + ); + path = app_shrinkTrackpad; + sourceTree = ""; + }; + 0005A3742169AF340020F4EC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0005A3752169AF340020F4EC /* MultitouchSupport */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0005A35B21697ADD0020F4EC /* app_shrinkTrackpad */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0005A37021697ADE0020F4EC /* Build configuration list for PBXNativeTarget "app_shrinkTrackpad" */; + buildPhases = ( + 0005A35821697ADD0020F4EC /* Sources */, + 0005A35921697ADD0020F4EC /* Frameworks */, + 0005A35A21697ADD0020F4EC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = app_shrinkTrackpad; + productName = app_shrinkTrackpad; + productReference = 0005A35C21697ADD0020F4EC /* app_shrinkTrackpad.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0005A35421697ADD0020F4EC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = aa; + TargetAttributes = { + 0005A35B21697ADD0020F4EC = { + CreatedOnToolsVersion = 9.4.1; + }; + }; + }; + buildConfigurationList = 0005A35721697ADD0020F4EC /* Build configuration list for PBXProject "app_shrinkTrackpad" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 0005A35321697ADD0020F4EC; + productRefGroup = 0005A35D21697ADD0020F4EC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0005A35B21697ADD0020F4EC /* app_shrinkTrackpad */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0005A35A21697ADD0020F4EC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0005A36621697ADE0020F4EC /* Assets.xcassets in Resources */, + 0005A36921697ADE0020F4EC /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0005A35821697ADD0020F4EC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0005A36421697ADD0020F4EC /* ViewController.m in Sources */, + 0005A36C21697ADE0020F4EC /* main.m in Sources */, + 0005A36121697ADD0020F4EC /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 0005A36721697ADE0020F4EC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0005A36821697ADE0020F4EC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 0005A36E21697ADE0020F4EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 0005A36F21697ADE0020F4EC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 0005A37121697ADE0020F4EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = app_shrinkTrackpad/app_shrinkTrackpad.entitlements; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = app_shrinkTrackpad/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/MultitouchSupport.framework/Versions/A", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = com.cocoahuke.shrinkTrackpad; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Debug; + }; + 0005A37221697ADE0020F4EC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = app_shrinkTrackpad/app_shrinkTrackpad.entitlements; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = app_shrinkTrackpad/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/MultitouchSupport.framework/Versions/A", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = com.cocoahuke.shrinkTrackpad; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0005A35721697ADD0020F4EC /* Build configuration list for PBXProject "app_shrinkTrackpad" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0005A36E21697ADE0020F4EC /* Debug */, + 0005A36F21697ADE0020F4EC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0005A37021697ADE0020F4EC /* Build configuration list for PBXNativeTarget "app_shrinkTrackpad" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0005A37121697ADE0020F4EC /* Debug */, + 0005A37221697ADE0020F4EC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0005A35421697ADD0020F4EC /* Project object */; +} diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100755 index 0000000..083839b --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100755 index 0000000..18d9810 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcuserdata/aa.xcuserdatad/UserInterfaceState.xcuserstate b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcuserdata/aa.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100755 index 0000000..67218e4 Binary files /dev/null and b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/project.xcworkspace/xcuserdata/aa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100755 index 0000000..fe2b454 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/app_shrinkTrackpad.xcscheme b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/app_shrinkTrackpad.xcscheme new file mode 100755 index 0000000..a7c446b --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/app_shrinkTrackpad.xcscheme @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/xcschememanagement.plist b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100755 index 0000000..bc5c83f --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad.xcodeproj/xcuserdata/aa.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + app_shrinkTrackpad.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 0005A35B21697ADD0020F4EC + + primary + + + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.h b/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.h new file mode 100755 index 0000000..754aa30 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// app_shrinkTrackpad +// +// Created by aa on 10/6/18. +// Copyright © 2018 aa. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.m b/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.m new file mode 100755 index 0000000..5629ce4 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/AppDelegate.m @@ -0,0 +1,32 @@ +// +// AppDelegate.m +// app_shrinkTrackpad +// +// Created by aa on 10/6/18. +// Copyright © 2018 aa. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application + NSWindow *mainWindow = [[NSApplication sharedApplication] mainWindow]; + mainWindow.styleMask &= ~NSWindowStyleMaskResizable; +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + +-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender{ + return YES; +} + + +@end diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/Contents.json b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100755 index 0000000..3447128 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,59 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/icon.png b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/icon.png new file mode 100755 index 0000000..985e9f8 Binary files /dev/null and b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/AppIcon.appiconset/icon.png differ diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/Contents.json b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/Contents.json new file mode 100755 index 0000000..da4a164 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/Base.lproj/Main.storyboard b/app_shrinkTrackpad/app_shrinkTrackpad/Base.lproj/Main.storyboard new file mode 100755 index 0000000..aadc1f0 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/Base.lproj/Main.storyboard @@ -0,0 +1,890 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Step 1/2: Place your finger in the four corner of trackpad, please be as close to corner as possible and only use one finger w/o clicking :) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Did I helped you +If Yes could you help me with $3 donation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/Info.plist b/app_shrinkTrackpad/app_shrinkTrackpad/Info.plist new file mode 100755 index 0000000..9defde9 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2018 aa. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/MultitouchSupport.h b/app_shrinkTrackpad/app_shrinkTrackpad/MultitouchSupport.h new file mode 100755 index 0000000..9b92a68 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/MultitouchSupport.h @@ -0,0 +1,111 @@ +// +// MultitouchSupport.h +// multitouch_priFramework +// +// Created by aa on 10/5/18. +// Copyright © 2018 aa. All rights reserved. +// + +#ifndef MultitouchSupport_h +#define MultitouchSupport_h + +/* + * MultitouchSupport.h + * TouchSynthesis + * + * Created by Nathan Vander Wilt on 1/13/10. + * Copyright 2010 Calf Trail Software, LLC. All rights reserved. + * + */ + +typedef struct { + float x; + float y; +} MTPoint; + +typedef struct { + MTPoint position; + MTPoint velocity; +} MTVector; + +enum { + MTTouchStateNotTracking = 0, + MTTouchStateStartInRange = 1, + MTTouchStateHoverInRange = 2, + MTTouchStateMakeTouch = 3, + MTTouchStateTouching = 4, + MTTouchStateBreakTouch = 5, + MTTouchStateLingerInRange = 6, + MTTouchStateOutOfRange = 7 +}; +typedef uint32_t MTTouchState; + +typedef struct { + int32_t frame; + double timestamp; + int32_t pathIndex; // "P" (~transducerIndex) + MTTouchState state; + int32_t fingerID; // "F" (~identity) + int32_t handID; // "H" (always 1) + MTVector normalizedVector; + float zTotal; // "ZTot" (~quality, multiple of 1/8 between 0 and 1) + int32_t field9; // always 0 + float angle; + float majorAxis; + float minorAxis; + MTVector absoluteVector; // "mm" + int32_t field14; // always 0 + int32_t field15; // always 0 + float zDensity; // "ZDen" (~density) +} MTTouch; + +//typedef const void* MTDeviceRef; +typedef CFTypeRef MTDeviceRef; + +double MTAbsoluteTimeGetCurrent(); +bool MTDeviceIsAvailable(); // true if can create default device + +CFArrayRef MTDeviceCreateList(); // creates for driver types 0, 1, 4, 2, 3 +MTDeviceRef MTDeviceCreateDefault(); +MTDeviceRef MTDeviceCreateFromDeviceID(int64_t); +MTDeviceRef MTDeviceCreateFromService(io_service_t); +MTDeviceRef MTDeviceCreateFromGUID(uuid_t); // GUID's compared by pointer, not value! +void MTDeviceRelease(MTDeviceRef); + +CFRunLoopSourceRef MTDeviceCreateMultitouchRunLoopSource(MTDeviceRef); +OSStatus MTDeviceScheduleOnRunLoop(MTDeviceRef, CFRunLoopRef, CFStringRef); + +OSStatus MTDeviceStart(MTDeviceRef, int); +OSStatus MTDeviceStop(MTDeviceRef); +bool MTDeviceIsRunning(MTDeviceRef); + + +bool MTDeviceIsValid(MTDeviceRef); +bool MTDeviceIsBuiltIn(MTDeviceRef) __attribute__ ((weak_import)); // no 10.5 +bool MTDeviceIsOpaqueSurface(MTDeviceRef); +io_service_t MTDeviceGetService(MTDeviceRef); +OSStatus MTDeviceGetSensorSurfaceDimensions(MTDeviceRef, int*, int*); +OSStatus MTDeviceGetFamilyID(MTDeviceRef, int*); +OSStatus MTDeviceGetDeviceID(MTDeviceRef, uint64_t*) __attribute__ ((weak_import)); // no 10.5 +OSStatus MTDeviceGetDriverType(MTDeviceRef, int*); +OSStatus MTDeviceGetActualType(MTDeviceRef, int*); +OSStatus MTDeviceGetGUID(MTDeviceRef, uuid_t*); + +typedef void (*MTFrameCallbackFunction)(MTDeviceRef device, + MTTouch touches[], size_t numTouches, + double timestamp, size_t frame); +void MTRegisterContactFrameCallback(MTDeviceRef, MTFrameCallbackFunction); + +typedef void (*MTFrameCallbackRefconFunction)(MTDeviceRef device, + MTTouch touches[], size_t numTouches, + double timestamp, size_t frame, void* refcon); +void MTRegisterContactFrameCallbackWithRefcon(MTDeviceRef, MTFrameCallbackRefconFunction, void* refcon); +void MTUnregisterContactFrameCallback(MTDeviceRef, MTFrameCallbackRefconFunction); + + +typedef void (*MTPathCallbackFunction)(MTDeviceRef device, long pathID, long state, MTTouch* touch); +MTPathCallbackFunction MTPathPrintCallback; +void MTRegisterPathCallback(MTDeviceRef, MTPathCallbackFunction); + + +#endif /* MultitouchSupport_h */ diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.h b/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.h new file mode 100755 index 0000000..b6f614f --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.h @@ -0,0 +1,32 @@ +// +// ViewController.h +// app_shrinkTrackpad +// +// Created by aa on 10/6/18. +// Copyright © 2018 aa. All rights reserved. +// + +#import + +@interface ViewController : NSViewController +@property (weak) IBOutlet NSTextField *label_centernote; +@property (weak) IBOutlet NSTextField *label_leftUpper; +@property (weak) IBOutlet NSTextField *label_leftLower; +@property (weak) IBOutlet NSTextField *label_rightUpper; +@property (weak) IBOutlet NSTextField *label_rightLower; +@property (weak) IBOutlet NSButton *button_steps; + +@property (weak) IBOutlet NSButton *button_reset; +@property (weak) IBOutlet NSTextField *label_ISP_indic; +@property (weak) IBOutlet NSTextField *label_root_indic; +@property (weak) IBOutlet NSTextField *label_author; +@property (weak) IBOutlet NSTextField *label_donat; + + +@property (weak) IBOutlet NSButton *direct_left; +@property (weak) IBOutlet NSButton *direct_right; +@property (weak) IBOutlet NSButton *direct_up; +@property (weak) IBOutlet NSButton *direct_down; + +@end + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.m b/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.m new file mode 100755 index 0000000..17c64b7 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/ViewController.m @@ -0,0 +1,417 @@ +// +// ViewController.m +// app_shrinkTrackpad +// +// Created by aa on 10/6/18. +// Copyright © 2018 aa. All rights reserved. +// + +#import "ViewController.h" +#import "MultitouchSupport.h" +#include + +@implementation ViewController + +#define shrinkTP_CMD_KASLR _IOWR(74728, 1, mach_vm_address_t) +#define shrinkTP_CMD_INIT _IOWR(74728, 2, mach_vm_address_t) +#define shrinkTP_CMD_ADJUST _IOWR(74728, 3, uint64_t) +extern int dd; +extern int global_get_shrinkdev(void); + +extern const char *datafilePath; +extern const char *global_get_datafilePath(void); + +NSTextField *label_collecting = NULL; +NSMutableDictionary *reddot_map = NULL; +bool reddot_appear = false; CGFloat reddot_dimen = 0; +NSView *minipad = NULL; +int16_t Xaxis_origin = 0, Yaxis_origin = 0; +uint16_t Xaxis_length = 0, Yaxis_length = 0; + +void fullframe_callback(MTDeviceRef device, void *framedata, uint32_t framedata_len){ + if(framedata_len >= 0x44){ + + framedata_len -= 0x26; framedata += 0x26; + int nfinger = framedata_len/0x1E; + for(int i=0; i cmp2 ? cmp2 : cmp1; + cmp1 = [[self.label_rightUpper.stringValue componentsSeparatedByString:@", "][0] integerValue]; + cmp2 = [[self.label_rightLower.stringValue componentsSeparatedByString:@", "][0] integerValue]; + Xaxis_length = abs(Xaxis_origin) + abs((cmp1 > cmp2 ? cmp1 : cmp2)); + + cmp1 = [[self.label_leftLower.stringValue componentsSeparatedByString:@", "][1] integerValue]; + cmp2 = [[self.label_rightLower.stringValue componentsSeparatedByString:@", "][1] integerValue]; + Yaxis_origin = cmp1 > cmp2 ? cmp2 : cmp1; + cmp1 = [[self.label_leftUpper.stringValue componentsSeparatedByString:@", "][1] integerValue]; + cmp2 = [[self.label_rightUpper.stringValue componentsSeparatedByString:@", "][1] integerValue]; + Yaxis_length = abs(Yaxis_origin) + abs((cmp1 > cmp2 ? cmp1 : cmp2)); + + // Init mini Trackpad Area + minipad = [[NSView alloc] initWithFrame:CGRectMake(0, 0, Xaxis_length / (Yaxis_length / (self.view.frame.size.height/1.4)), self.view.frame.size.height/1.4)]; + [minipad setFrameOrigin:NSMakePoint((NSWidth([self.view bounds]) - NSWidth([minipad frame])) / 2, (NSHeight([self.view bounds]) - NSHeight([minipad frame])) / 2)]; + [minipad setWantsLayer:YES]; + minipad.layer.backgroundColor = [[NSColor lightGrayColor] colorWithAlphaComponent:0.3].CGColor; + minipad.alphaValue = 0.5; + minipad.layer.cornerRadius = 8; + [self.view addSubview:minipad]; + + reddot_map = [NSMutableDictionary new]; + reddot_dimen = self.view.frame.size.height/18; + reddot_appear = true; +} + +- (IBAction)action_button_step1:(id)sender { + + [self.button_steps setEnabled:NO]; + [self start_collecting_with_timer]; +} + +- (IBAction)action_button_reset:(id)sender { + uint64_t reset_v = 0; + ioctl(dd, shrinkTP_CMD_ADJUST, &reset_v); + + FILE *fp = fopen(datafilePath, "wb"); + if(fp){ + fwrite(&reset_v, 1, sizeof(reset_v), fp); + fclose(fp); + } +} + +id ArrowkeyMonitor = nil; +int ActiveArrowIndex = 0; +uint16_t ignore_amt_X = 0, ignore_amt_Y = 0; +uint16_t ignore_amt_X_minipad = 0, ignore_amt_Y_minipad = 0; +uint16_t ignore_Xaxis_left = 0, ignore_Xaxis_right = 0; +uint16_t ignore_Yaxis_up = 0, ignore_Yaxis_down = 0; +NSView *minipad_cover_left = NULL, *minipad_cover_right = NULL; +NSView *minipad_cover_up = NULL, *minipad_cover_down = NULL; +- (void)action_button_step2:(id)sender { + [self.button_steps setEnabled:NO]; + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { + [context setDuration:0.5]; + [[self.label_centernote animator] setAlphaValue:0.0]; + } completionHandler:^{ + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { + [context setDuration:0.5]; + self.label_centernote.stringValue = @"Step 2/2: select a button and press arrow keys to adjust. Complete? Click \"Save\" and close window."; + self.button_steps.title = @"Save"; + [[self.label_centernote animator] setAlphaValue:1.0]; + [self.button_steps setTarget:self]; + [self.button_steps setAction:@selector(action_button_save_and_set_launch_at_login:)]; + } completionHandler:^{ + [self.label_leftUpper setHidden:YES]; + [self.label_leftLower setHidden:YES]; + [self.label_rightUpper setHidden:YES]; + [self.label_rightLower setHidden:YES]; + + [self.button_steps setEnabled:YES]; + [self.direct_left setHidden:NO]; + [self.direct_right setHidden:NO]; + [self.direct_up setHidden:NO]; + [self.direct_down setHidden:NO]; + + // Adjust 1/25 size each time + ignore_amt_X = Xaxis_length / 25; + ignore_amt_Y = Yaxis_length / 25; + ignore_amt_X_minipad = minipad.frame.size.width / 25; + ignore_amt_Y_minipad = minipad.frame.size.height / 25; + + minipad_cover_left = [[NSView alloc] initWithFrame:CGRectMake(0, 0, 0, minipad.frame.size.height)]; + [minipad_cover_left setWantsLayer:YES]; + minipad_cover_left.layer.backgroundColor = [NSColor redColor].CGColor; + minipad_cover_left.alphaValue = 0.25; + [minipad addSubview:minipad_cover_left]; + + minipad_cover_right = [[NSView alloc] initWithFrame:CGRectMake(minipad.frame.size.width, 0, 0, minipad.frame.size.height)]; + [minipad_cover_right setWantsLayer:YES]; + minipad_cover_right.layer.backgroundColor = [NSColor redColor].CGColor; + minipad_cover_right.alphaValue = 0.25; + [minipad addSubview:minipad_cover_right]; + + minipad_cover_up = [[NSView alloc] initWithFrame:CGRectMake(0, minipad.frame.size.height, minipad.frame.size.width, 0)]; + [minipad_cover_up setWantsLayer:YES]; + minipad_cover_up.layer.backgroundColor = [NSColor redColor].CGColor; + minipad_cover_up.alphaValue = 0.25; + [minipad addSubview:minipad_cover_up]; + + minipad_cover_down = [[NSView alloc] initWithFrame:CGRectMake(0, 0, minipad.frame.size.width, 0)]; + [minipad_cover_down setWantsLayer:YES]; + minipad_cover_down.layer.backgroundColor = [NSColor redColor].CGColor; + minipad_cover_down.alphaValue = 0.25; + [minipad addSubview:minipad_cover_down]; + }]; + }]; + + + ArrowkeyMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent *event) { + + unichar character = [[event characters] characterAtIndex:0]; + switch (character) { + case NSLeftArrowFunctionKey:{ + if(ActiveArrowIndex==1 && minipad_cover_left.frame.size.width > 0){ + [minipad_cover_left setFrameSize:NSMakeSize(minipad_cover_left.frame.size.width - ignore_amt_X_minipad, minipad_cover_left.frame.size.height)]; + ignore_Xaxis_left -= ignore_amt_X; + } else if(ActiveArrowIndex==2 && minipad_cover_right.frame.size.width < minipad.frame.size.width){ + [minipad_cover_right setFrameSize:NSMakeSize(minipad_cover_right.frame.size.width + ignore_amt_X_minipad, minipad_cover_right.frame.size.height)]; + [minipad_cover_right setFrameOrigin:NSMakePoint(minipad_cover_right.frame.origin.x - ignore_amt_X_minipad, minipad_cover_right.frame.origin.y)]; + ignore_Xaxis_right += ignore_amt_X; + } + } + break; + case NSRightArrowFunctionKey:{ + if(ActiveArrowIndex==1 && minipad_cover_left.frame.size.width < minipad.frame.size.width){ + [minipad_cover_left setFrameSize:NSMakeSize(minipad_cover_left.frame.size.width + ignore_amt_X_minipad, minipad_cover_left.frame.size.height)]; + ignore_Xaxis_left += ignore_amt_X; + } else if(ActiveArrowIndex==2 && minipad_cover_right.frame.size.width > 0){ + [minipad_cover_right setFrameSize:NSMakeSize(minipad_cover_right.frame.size.width - ignore_amt_X_minipad, minipad_cover_right.frame.size.height)]; + [minipad_cover_right setFrameOrigin:NSMakePoint(minipad_cover_right.frame.origin.x + ignore_amt_X_minipad, minipad_cover_right.frame.origin.y)]; + ignore_Xaxis_right -= ignore_amt_X; + } + } + break; + case NSUpArrowFunctionKey:{ + if(ActiveArrowIndex==3 && minipad_cover_up.frame.size.height > 0){ + [minipad_cover_up setFrameSize:NSMakeSize(minipad_cover_up.frame.size.width, minipad_cover_up.frame.size.height - ignore_amt_Y_minipad)]; + [minipad_cover_up setFrameOrigin:NSMakePoint(minipad_cover_up.frame.origin.x, minipad_cover_up.frame.origin.y + ignore_amt_Y_minipad)]; + ignore_Yaxis_up -= ignore_amt_Y; + } else if(ActiveArrowIndex==4 && minipad_cover_down.frame.size.height < minipad.frame.size.height){ + [minipad_cover_down setFrameSize:NSMakeSize(minipad_cover_down.frame.size.width, minipad_cover_down.frame.size.height + ignore_amt_Y_minipad)]; + ignore_Yaxis_down += ignore_amt_Y; + } + } + break; + case NSDownArrowFunctionKey:{ + if(ActiveArrowIndex==3 && minipad_cover_up.frame.size.height < minipad.frame.size.height){ + [minipad_cover_up setFrameSize:NSMakeSize(minipad_cover_up.frame.size.width, minipad_cover_up.frame.size.height + ignore_amt_Y_minipad)]; + [minipad_cover_up setFrameOrigin:NSMakePoint(minipad_cover_up.frame.origin.x, minipad_cover_up.frame.origin.y - ignore_amt_Y_minipad)]; + ignore_Yaxis_up += ignore_amt_Y; + } else if(ActiveArrowIndex==4 && minipad_cover_down.frame.size.height > 0){ + [minipad_cover_down setFrameSize:NSMakeSize(minipad_cover_down.frame.size.width, minipad_cover_down.frame.size.height - ignore_amt_Y_minipad)]; + ignore_Yaxis_down -= ignore_amt_Y; + } + } + break; + default: + break; + } + + uint64_t adjust_v = (uint64_t)(ignore_Xaxis_left + (uint16_t)Xaxis_origin) << 48 | (uint64_t)((Xaxis_origin + Xaxis_length) - ignore_Xaxis_right) << 32 | (uint64_t)((Yaxis_origin + Yaxis_length) - ignore_Yaxis_up) << 16 | (uint64_t)(ignore_Yaxis_down + (uint16_t)Yaxis_origin); + ioctl(dd, shrinkTP_CMD_ADJUST, &adjust_v); + + //printf("%d %d %d %d\n", ignore_Xaxis_left, ignore_Xaxis_right, ignore_Yaxis_up, ignore_Yaxis_down); + return event; + }]; + + + //[self start_collecting_with_timer]; + //[self step1_reddot_appear]; +} + +- (void)off_allDirect{ + [self.direct_left setState:NSOffState]; + [self.direct_right setState:NSOffState]; + [self.direct_down setState:NSOffState]; + [self.direct_up setState:NSOffState]; +} + +- (IBAction)action_direct_left:(id)sender { + [self off_allDirect]; + [self.direct_left setState:NSOnState]; + ActiveArrowIndex = 1; +} + +- (IBAction)action_direct_right:(id)sender { + [self off_allDirect]; + [self.direct_right setState:NSOnState]; + ActiveArrowIndex = 2; +} + +- (IBAction)action_direct_up:(id)sender { + [self off_allDirect]; + [self.direct_up setState:NSOnState]; + ActiveArrowIndex = 3; +} + +- (IBAction)action_direct_down:(id)sender { + [self off_allDirect]; + [self.direct_down setState:NSOnState]; + ActiveArrowIndex = 4; +} + +- (void)action_button_save_and_set_launch_at_login:(id)sender{ + // ignore_Xaxis_left <= X <= ignore_Xaxis_right + // ignore_Yaxis_down <= Y <= ignore_Yaxis_up + + uint64_t save_adjust_v = (uint64_t)(ignore_Xaxis_left + (uint16_t)Xaxis_origin) << 48 | (uint64_t)((Xaxis_origin + Xaxis_length) - ignore_Xaxis_right) << 32 | (uint64_t)((Yaxis_origin + Yaxis_length) - ignore_Yaxis_up) << 16 | (uint64_t)(ignore_Yaxis_down + (uint16_t)Yaxis_origin); + + FILE *fp = fopen(datafilePath, "wb"); + if(fp){ + fwrite(&save_adjust_v, 1, sizeof(save_adjust_v), fp); + fclose(fp); + } +} + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + + +@end diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/app_shrinkTrackpad.entitlements b/app_shrinkTrackpad/app_shrinkTrackpad/app_shrinkTrackpad.entitlements new file mode 100755 index 0000000..311b32b --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/app_shrinkTrackpad.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/app_shrinkTrackpad/app_shrinkTrackpad/main.m b/app_shrinkTrackpad/app_shrinkTrackpad/main.m new file mode 100755 index 0000000..dcbd873 --- /dev/null +++ b/app_shrinkTrackpad/app_shrinkTrackpad/main.m @@ -0,0 +1,243 @@ +// +// main.m +// app_shrinkTrackpad +// +// Created by aa on 10/6/18. +// Copyright © 2018 aa. All rights reserved. +// + +#import +#include +#include +#include +#include + +int dd = -1; +int global_get_shrinkdev(){ + if(dd == -1) + dd = open("/dev/shrinkTP", O_RDONLY); + return dd; +} + +const char *datafilePath = NULL; +const char *global_get_datafilePath(){ + if(datafilePath == NULL){ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES); + const char *datafilePath_ = [[[paths firstObject] stringByAppendingString:@"/shrinkTrackpad/shrinkdata"] cStringUsingEncoding:NSUTF8StringEncoding]; + datafilePath = malloc(strlen(datafilePath_) + 1); + strcpy((char*)datafilePath, datafilePath_); + } + return datafilePath; +} + +void *file_read_with_offset(const char *filepath, uint32_t read_offset, uint32_t read_size){ + + FILE *fp = fopen(filepath, "ro"); + if(!fp) + return NULL; + fseek(fp, read_offset, SEEK_SET); + + void *databuf = malloc(read_size); + bzero(databuf, read_size); + + fread(databuf, 1, read_size, fp); + fclose(fp); + return databuf; +} + +mach_vm_address_t obtain_vnode_close_static_addr(){ + const char *kernel_file_path = "/System/Library/Kernels/kernel"; + if(access(kernel_file_path, F_OK)){ + printf("file not exist\n"); + exit(1); + } + + mach_vm_offset_t _vnode_close_func_addr = 0; + + struct mach_header_64 *kernel_macho_header = file_read_with_offset(kernel_file_path, 0, 0x2000); + if(!kernel_macho_header){ + printf("kernel_macho_header empty\n"); + exit(1); + } + + const uint32_t cmd_count = kernel_macho_header->ncmds; + struct load_command *cmds = (struct load_command*)((char*)kernel_macho_header+sizeof(struct mach_header_64)); + struct load_command* cmd = cmds; + for (uint32_t i = 0; i < cmd_count; ++i){ + switch (cmd->cmd) { + case LC_SYMTAB:{ + struct symtab_command *sym_cmd = (struct symtab_command*)cmd; + + void *kernel_linkedit = file_read_with_offset(kernel_file_path, sym_cmd->symoff, (sym_cmd->stroff + sym_cmd->strsize) - sym_cmd->symoff); + for(int i =0; insyms; i++){ + struct nlist_64 *nn = (typeof(nn))((char*)kernel_linkedit + i * sizeof(struct nlist_64)); + if(nn->n_type == 0xf){ + char *def_str = (char*)kernel_linkedit + (sym_cmd->stroff - sym_cmd->symoff) + (uint32_t)nn->n_un.n_strx; + if(strstr(def_str, "_vnode_close")){ + _vnode_close_func_addr = nn->n_value; + break; + } + } + } + free(kernel_linkedit); + } + break; + } + cmd = (struct load_command*)((char*)cmd + cmd->cmdsize); + } + free(kernel_macho_header); + + return _vnode_close_func_addr; +} + +mach_vm_address_t obtain_handleTouchFrame_vtable_addr(){ + const char *driver_file_path = "/System/Library/Extensions/AppleMultitouchDriver.kext/Contents/MacOS/AppleMultitouchDriver"; + if(access(driver_file_path, F_OK)){ + printf("file not exist\n"); + exit(1); + } + + mach_vm_offset_t _handleTouchFrame_vtable_addr = 0; + + struct mach_header_64 *driver_macho_header = file_read_with_offset(driver_file_path, 0, 0x1000); + if(!driver_macho_header){ + printf("driver_macho_header empty\n"); + exit(1); + } + + const uint32_t cmd_count = driver_macho_header->ncmds; + struct load_command *cmds = (struct load_command*)((char*)driver_macho_header+sizeof(struct mach_header_64)); + struct load_command* cmd = cmds; + for (uint32_t i = 0; i < cmd_count; ++i){ + switch (cmd->cmd) { + case LC_SYMTAB:{ + struct symtab_command *sym_cmd = (struct symtab_command*)cmd; + + void *driver_linkedit = file_read_with_offset(driver_file_path, sym_cmd->symoff, (sym_cmd->stroff + sym_cmd->strsize) - sym_cmd->symoff); + for(int i =0; insyms; i++){ + struct nlist_64 *nn = (typeof(nn))((char*)driver_linkedit + i * sizeof(struct nlist_64)); + if(nn->n_type == 0xf){ + char *def_str = (char*)driver_linkedit + (sym_cmd->stroff - sym_cmd->symoff) + (uint32_t)nn->n_un.n_strx; + if(strstr(def_str, "_handleTouchFrame")){ + + void *driver_linkedit_bef = file_read_with_offset(driver_file_path, 0, sym_cmd->symoff); + void *driver_linkedit_bef_mem = memmem(driver_linkedit_bef, sym_cmd->symoff, &nn->n_value, sizeof(nn->n_value)); + _handleTouchFrame_vtable_addr = driver_linkedit_bef_mem - driver_linkedit_bef; + free(driver_linkedit_bef); + + break; + } + } + } + free(driver_linkedit); + } + break; + } + cmd = (struct load_command*)((char*)cmd + cmd->cmdsize); + } + free(driver_macho_header); + + FILE *popen_fp = popen("/usr/sbin/kextstat | /usr/bin/grep com.apple.driver.AppleMultitouchDriver | /usr/bin/tr -s \" \" | /usr/bin/cut -d \" \" -f4", "r"); + char popen_buf[32]; + fread(popen_buf, 1, sizeof(popen_buf), popen_fp); + fclose(popen_fp); + _handleTouchFrame_vtable_addr += strtoull(popen_buf, 0, 16); + + return _handleTouchFrame_vtable_addr; +} + +const char *launch_config = +"\n\ +\n\ +\n\ +\n\ +Label\n\ +com.cocoahuke.shrinkTrackpad\n\ +ProgramArguments\n\ +\n\ +%s\n\ +AutoBoot\n\ +\n\ +UserName\n\ +root\n\ +RunAtLoad\n\ +\n\ +\n\ +\n"; + +#define shrinkTP_CMD_KASLR _IOWR(74728, 1, mach_vm_address_t) +#define shrinkTP_CMD_INIT _IOWR(74728, 2, mach_vm_address_t) +#define shrinkTP_CMD_ADJUST _IOWR(74728, 3, uint64_t) +int main(int argc, const char * argv[]) { + + const char *kext_path = [[[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/kext_shrink_trackpad.kext"] cStringUsingEncoding:NSUTF8StringEncoding]; + + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES); + const char *applicationSupportDirectory = [[[paths firstObject] stringByAppendingString:@"/shrinkTrackpad"] cStringUsingEncoding:NSUTF8StringEncoding]; + datafilePath = global_get_datafilePath(); + + if(getuid() == 0){ + + system([[NSString stringWithFormat:@"/usr/sbin/chown -R root:wheel \"%s\"", kext_path] cStringUsingEncoding:NSUTF8StringEncoding]); + system([[NSString stringWithFormat:@"/bin/chmod -R 755 \"%s\"", kext_path] cStringUsingEncoding:NSUTF8StringEncoding]); + system([[NSString stringWithFormat:@"/usr/bin/kextutil \"%s\"", kext_path] cStringUsingEncoding:NSUTF8StringEncoding]); + + mach_vm_address_t vnode_close_addr = obtain_vnode_close_static_addr(); + mach_vm_address_t handleTouchFrame_vtable_addr = obtain_handleTouchFrame_vtable_addr(); + + dd = global_get_shrinkdev(); + ioctl(dd, shrinkTP_CMD_KASLR, &vnode_close_addr); + ioctl(dd, shrinkTP_CMD_INIT, &handleTouchFrame_vtable_addr); + + if(access(applicationSupportDirectory, F_OK)) + mkdir(applicationSupportDirectory, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); + + if(!access(datafilePath, F_OK)){ + FILE *fp = fopen(datafilePath, "ro"); + if(fp){ + uint64_t read_adjust_v = 0; + fread(&read_adjust_v, 1, sizeof(read_adjust_v), fp); + fclose(fp); + ioctl(dd, shrinkTP_CMD_ADJUST, &read_adjust_v); + } + } + + char launch_config_formatted[strlen(launch_config) + 280]; + snprintf(launch_config_formatted, sizeof(launch_config_formatted), launch_config, argv[0]); + + const char *config_path = "/System/Library/LaunchDaemons/com.cocoahuke.shrinkTrackpad.plist"; + if(access(config_path, F_OK)){ + FILE *fp = fopen(config_path, "wb"); + if(fp){ + fwrite(launch_config_formatted, 1, strlen(launch_config_formatted), fp); + fclose(fp); + } + + system([[NSString stringWithFormat:@"/bin/launchctl load -w \"%s\"", config_path] cStringUsingEncoding:NSUTF8StringEncoding]); + } + } + + if(argc > 1 && !strcmp(argv[1], "AutoBoot")){ + system([[NSString stringWithFormat:@"/usr/bin/kextutil \"%s\"", kext_path] cStringUsingEncoding:NSUTF8StringEncoding]); + + mach_vm_address_t vnode_close_addr = obtain_vnode_close_static_addr(); + mach_vm_address_t handleTouchFrame_vtable_addr = obtain_handleTouchFrame_vtable_addr(); + + dd = global_get_shrinkdev(); + ioctl(dd, shrinkTP_CMD_KASLR, &vnode_close_addr); + ioctl(dd, shrinkTP_CMD_INIT, &handleTouchFrame_vtable_addr); + + if(!access(datafilePath, F_OK)){ + FILE *fp = fopen(datafilePath, "ro"); + if(fp){ + uint64_t read_adjust_v = 0; + fread(&read_adjust_v, 1, sizeof(read_adjust_v), fp); + fclose(fp); + ioctl(dd, shrinkTP_CMD_ADJUST, &read_adjust_v); + } + } + return 0; + } + + return NSApplicationMain(argc, argv); +}