├── .gitignore ├── External ├── IOHIDEventData.h ├── IOHIDEventTypes.h ├── LICENSE ├── TouchEvents.c └── TouchEvents.h ├── LICENSE ├── README.md ├── SideButtonFixer ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── 1024 2-1.png │ │ ├── 1024 2.png │ │ ├── 1024 3-1.png │ │ ├── 1024 3.png │ │ ├── 1024 4.png │ │ ├── 1024 5.png │ │ ├── 1024 6-1.png │ │ ├── 1024 6.png │ │ ├── 1024 7.png │ │ ├── 1024.png │ │ └── Contents.json │ ├── Contents.json │ ├── MenuIcon.imageset │ │ ├── Contents.json │ │ ├── MenuIcon@2x-1.png │ │ └── MenuIcon@2x.png │ └── MenuIconDisabled.imageset │ │ ├── .DS_Store │ │ ├── Contents.json │ │ ├── MenuIconDisabled@2x-1.png │ │ └── MenuIconDisabled@2x.png ├── Base.lproj │ └── Main.storyboard ├── Info.plist ├── Main.storyboard ├── SideButtonFixer.entitlements ├── en.lproj │ └── Main.strings └── main.m ├── SwipeSimulator.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── SwipeSimulator └── main.m ├── icon.png └── techsteps.txt /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /External/IOHIDEventData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @APPLE_LICENSE_HEADER_START@ 4 | * 5 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | * 22 | * @APPLE_LICENSE_HEADER_END@ 23 | */ 24 | 25 | 26 | #include "IOHIDEventTypes.h" 27 | 28 | #define IOHIDEVENT_BASE \ 29 | uint32_t size; \ 30 | IOHIDEventType type; \ 31 | uint64_t timestamp; \ 32 | uint32_t options; 33 | 34 | #define IOHIDAXISEVENT_BASE \ 35 | struct { \ 36 | IOFixed x; \ 37 | IOFixed y; \ 38 | IOFixed z; \ 39 | } position; 40 | 41 | 42 | // NOTE: original Apple source had "struct IOHIDEventData" instead of typedef 43 | typedef struct _IOHIDEventData { 44 | IOHIDEVENT_BASE; 45 | } IOHIDEventData; 46 | 47 | typedef struct _IOHIDVendorDefinedEventData { 48 | IOHIDEVENT_BASE; 49 | uint16_t usagePage; 50 | uint16_t usage; 51 | uint32_t version; 52 | uint32_t length; 53 | uint8_t data[0]; 54 | } IOHIDVendorDefinedEventData; 55 | 56 | // NOTE: these are additional option flags used with digitizer event 57 | enum { 58 | kIOHIDTransducerRange = 0x00010000, 59 | kIOHIDTransducerTouch = 0x00020000, 60 | kIOHIDTransducerInvert = 0x00040000, 61 | }; 62 | 63 | enum { 64 | kIOHIDDigitizerOrientationTypeTilt = 0, 65 | kIOHIDDigitizerOrientationTypePolar, 66 | kIOHIDDigitizerOrientationTypeQuality 67 | }; 68 | typedef uint8_t IOHIDDigitizerOrientationType; 69 | 70 | 71 | #define IOHIDBUTTONEVENT_BASE \ 72 | struct { \ 73 | uint32_t buttonMask; \ 74 | IOFixed pressure; \ 75 | uint8_t buttonNumber; \ 76 | uint8_t clickState; \ 77 | } button; 78 | 79 | typedef struct _IOHIDButtonEventData { 80 | IOHIDEVENT_BASE; 81 | IOHIDBUTTONEVENT_BASE; 82 | } IOHIDButtonEventData; 83 | 84 | typedef struct _IOHIDMouseEventData { 85 | IOHIDEVENT_BASE; 86 | IOHIDAXISEVENT_BASE; 87 | IOHIDBUTTONEVENT_BASE; 88 | } IOHIDMouseEventData; 89 | 90 | typedef struct _IOHIDDigitizerEventData { 91 | IOHIDEVENT_BASE; // options = kIOHIDTransducerRange, kHIDTransducerTouch, kHIDTransducerInvert 92 | IOHIDAXISEVENT_BASE; 93 | 94 | uint32_t transducerIndex; 95 | uint32_t transducerType; // could overload this to include that both the hand and finger id. 96 | uint32_t identity; // Specifies a unique ID of the current transducer action. 97 | uint32_t eventMask; // the type of event that has occurred: range, touch, position (IOHIDDigitizerEventMask?) 98 | uint32_t childEventMask; // CHILD: the type of event that has occurred: range, touch, position 99 | 100 | uint32_t buttonMask; // Bit field representing the current button state 101 | // Pressure field are assumed to be scaled from 0.0 to 1.0 102 | IOFixed tipPressure; // Force exerted against the digitizer surface by the transducer. 103 | IOFixed barrelPressure; // Force exerted directly by the user on a transducer sensor. 104 | 105 | IOFixed twist; // Specifies the clockwise rotation of the cursor around its own major axis. Unsure it the device should declare units via properties or event. My first inclination is force degrees as the is the unit already expected by AppKit, Carbon and OpenGL. 106 | uint32_t orientationType; // Specifies the orientation type used by the transducer. 107 | union { 108 | struct { // X Tilt and Y Tilt are used together to specify the tilt away from normal of a digitizer transducer. In its normal position, the values of X Tilt and Y Tilt for a transducer are both zero. 109 | IOFixed x; // This quantity is used in conjunction with Y Tilt to represent the tilt away from normal of a transducer, such as a stylus. The X Tilt value represents the plane angle between the Y-Z plane and the plane containing the transducer axis and the Y axis. A positive X Tilt is to the right. 110 | IOFixed y; // This value represents the angle between the X-Z and transducer-X planes. A positive Y Tilt is toward the user. 111 | } tilt; 112 | struct { // X Tilt and Y Tilt are used together to specify the tilt away from normal of a digitizer transducer. In its normal position, the values of X Tilt and Y Tilt for a transducer are both zero. 113 | IOFixed altitude; //The angle with the X-Y plane though a signed, semicicular range. Positive values specify an angle downward and toward the positive Z axis. 114 | IOFixed azimuth; // Specifies the counter clockwise rotation of the cursor around the Z axis though a full circular range. 115 | } polar; 116 | struct { 117 | IOFixed quality; // If set, indicates that the transducer is sensed to be in a relatively noise-free region of digitizing. 118 | IOFixed density; 119 | IOFixed irregularity; 120 | IOFixed majorRadius; // units in mm 121 | IOFixed minorRadius; // units in mm 122 | } quality; 123 | } orientation; 124 | } IOHIDDigitizerEventData; 125 | 126 | typedef struct _IOHIDAxisEventData { 127 | IOHIDEVENT_BASE; // options = kHIDAxisRelative 128 | IOHIDAXISEVENT_BASE; 129 | } IOHIDAxisEventData, IOHIDTranslationData, IOHIDRotationEventData, IOHIDScrollEventData, IOHIDScaleEventData, IOHIDVelocityData, IOHIDOrientationEventData; 130 | 131 | typedef struct _IOHIDSwipeEventData { 132 | IOHIDEVENT_BASE; 133 | IOHIDSwipeMask swipeMask; 134 | } IOHIDSwipeEventData; 135 | 136 | /*! 137 | @typedef IOHIDSystemQueueElement 138 | @abstract Memory structure defining the layout of each event queue element 139 | @discussion The IOHIDEventQueueElement represents a portion of mememory in the 140 | new IOHIDEventQueue. It is possible that a event queue element 141 | can contain multiple interpretations of a given event. The first 142 | event is always considered the primary event. 143 | @field version Version of the event queue element 144 | @field size Size, in bytes, of this particular event queue element 145 | @field timeStamp Time at which event was dispatched 146 | @field deviceID ID of the sending device 147 | @field options Options for further developement 148 | @field eventCount The number of events contained in this transaction 149 | @field events Begining offset of contiguous mememory that contains the 150 | pertinent event data 151 | */ 152 | typedef struct _IOHIDSystemQueueElement { 153 | uint64_t timeStamp; 154 | uint64_t deviceID; 155 | uint32_t options; 156 | uint32_t eventCount; 157 | IOHIDEventData events[]; 158 | } IOHIDSystemQueueElement; 159 | -------------------------------------------------------------------------------- /External/IOHIDEventTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @APPLE_LICENSE_HEADER_START@ 4 | * 5 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | * 22 | * @APPLE_LICENSE_HEADER_END@ 23 | */ 24 | 25 | #ifndef _IOKIT_HID_IOHIDEVENTTYPES_H 26 | #define _IOKIT_HID_IOHIDEVENTTYPES_H 27 | 28 | #include 29 | 30 | #define IOHIDEventTypeMask(type) (1< 168 | Please Note: 169 | If you append a child digitizer event to a parent digitizer event, appropriate state will be transfered on to the parent. 170 | @constant kIOHIDDigitizerEventRange Issued when the range state has changed. 171 | @constant kIOHIDDigitizerEventTouch Issued when the touch state has changed. 172 | @constant kIOHIDDigitizerEventPosition Issued when the position has changed. 173 | @constant kIOHIDDigitizerEventStop Issued when motion has achieved a state of calculated non-movement. 174 | @constant kIOHIDDigitizerEventPeak Issues when new maximum values have been detected. 175 | @constant kIOHIDDigitizerEventIdentity Issued when the identity has changed. 176 | @constant kIOHIDDigitizerEventAttribute Issued when an attribute has changed. 177 | @constant kIOHIDDigitizerEventUpSwipe Issued when an up swipe has been detected. 178 | @constant kIOHIDDigitizerEventDownSwipe Issued when an down swipe has been detected. 179 | @constant kIOHIDDigitizerEventLeftSwipe Issued when an left swipe has been detected. 180 | @constant kIOHIDDigitizerEventRightSwipe Issued when an right swipe has been detected. 181 | @constant kIOHIDDigitizerEventSwipeMask Mask used to gather swipe events. 182 | */ 183 | enum { 184 | kIOHIDDigitizerEventRange = 0x00000001, 185 | kIOHIDDigitizerEventTouch = 0x00000002, 186 | kIOHIDDigitizerEventPosition = 0x00000004, 187 | kIOHIDDigitizerEventStop = 0x00000008, 188 | kIOHIDDigitizerEventPeak = 0x00000010, 189 | kIOHIDDigitizerEventIdentity = 0x00000020, 190 | kIOHIDDigitizerEventAttribute = 0x00000040, 191 | kIOHIDDigitizerEventCancel = 0x00000080, 192 | kIOHIDDigitizerEventStart = 0x00000100, 193 | kIOHIDDigitizerEventResting = 0x00000200, 194 | kIOHIDDigitizerEventSwipeUp = 0x01000000, 195 | kIOHIDDigitizerEventSwipeDown = 0x02000000, 196 | kIOHIDDigitizerEventSwipeLeft = 0x04000000, 197 | kIOHIDDigitizerEventSwipeRight = 0x08000000, 198 | kIOHIDDigitizerEventSwipeMask = 0xFF000000, 199 | }; 200 | typedef uint32_t IOHIDDigitizerEventMask; 201 | 202 | enum { 203 | kIOHIDEventOptionIsAbsolute = 0x00000001, 204 | kIOHIDEventOptionIsCollection = 0x00000002, 205 | kIOHIDEventOptionPixelUnits = 0x00000004 206 | }; 207 | typedef uint32_t IOHIDEventOptionBits; 208 | 209 | #endif /* _IOKIT_HID_IOHIDEVENTTYPES_H */ 210 | -------------------------------------------------------------------------------- /External/LICENSE: -------------------------------------------------------------------------------- 1 | Touch 2 | Copyright (C) 2010 Calf Trail Software, LLC 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -------------------------------------------------------------------------------- /External/TouchEvents.c: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchEvents.c 3 | * TouchSynthesis 4 | * 5 | * Created by Nathan Vander Wilt on 1/13/10. 6 | * Copyright 2010 Calf Trail Software, LLC. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "TouchEvents.h" 11 | 12 | #include "IOHIDEventData.h" 13 | 14 | const CFStringRef kTLInfoKeyDeviceID = CFSTR("deviceID"); 15 | const CFStringRef kTLInfoKeyTimestamp = CFSTR("timestamp"); 16 | const CFStringRef kTLInfoKeyGestureSubtype = CFSTR("gestureSubtype"); 17 | const CFStringRef kTLInfoKeyGesturePhase = CFSTR("gesturePhase"); 18 | const CFStringRef kTLInfoKeyMagnification = CFSTR("magnification"); 19 | const CFStringRef kTLInfoKeyRotation = CFSTR("rotation"); 20 | const CFStringRef kTLInfoKeySwipeDirection = CFSTR("swipeDirection"); 21 | const CFStringRef kTLInfoKeyNextSubtype = CFSTR("nextSubtype"); 22 | 23 | 24 | const CFStringRef kTLEventKeyType = CFSTR("type"); 25 | const CFStringRef kTLEventKeyTimestamp = CFSTR("timestamp"); 26 | const CFStringRef kTLEventKeyOptions = CFSTR("options"); 27 | 28 | const CFStringRef kTLEventKeyPositionX = CFSTR("position.x"); 29 | const CFStringRef kTLEventKeyPositionY = CFSTR("position.y"); 30 | const CFStringRef kTLEventKeyPositionZ = CFSTR("position.z"); 31 | 32 | const CFStringRef kTLEventKeyTransducerIndex = CFSTR("transducerIndex"); 33 | const CFStringRef kTLEventKeyTransducerType = CFSTR("transducerType"); 34 | const CFStringRef kTLEventKeyIdentity = CFSTR("identity"); 35 | const CFStringRef kTLEventKeyEventMask = CFSTR("eventMask"); 36 | 37 | const CFStringRef kTLEventKeyButtonMask = CFSTR("buttonMask"); 38 | const CFStringRef kTLEventKeyTipPressure = CFSTR("tipPressure"); 39 | const CFStringRef kTLEventKeyBarrelPressure = CFSTR("barrelPressure"); 40 | const CFStringRef kTLEventKeyTwist = CFSTR("twist"); 41 | 42 | const CFStringRef kTLEventKeyQuality = CFSTR("quality"); 43 | const CFStringRef kTLEventKeyDensity = CFSTR("density"); 44 | const CFStringRef kTLEventKeyIrregularity = CFSTR("irregularity"); 45 | const CFStringRef kTLEventKeyMajorRadius = CFSTR("majorRadius"); 46 | const CFStringRef kTLEventKeyMinorRadius = CFSTR("minorRadius"); 47 | 48 | 49 | static inline IOFixed tl_float2fixed(double f) { return (IOFixed)(f * 65536.0); } 50 | 51 | static inline uint64_t tl_uptime() { 52 | AbsoluteTime uptimeAbs = AbsoluteToNanoseconds(UpTime()); 53 | return ((uint64_t)uptimeAbs.hi << 32) + uptimeAbs.lo; 54 | } 55 | 56 | static inline void setVendorData(IOHIDVendorDefinedEventData* vd, const void* data) { 57 | memmove(vd->data, data, vd->length); 58 | } 59 | 60 | 61 | static void appendHeader(CFMutableDataRef data, uint8_t field, uint8_t type, uint16_t count) { 62 | // serialize header 63 | uint16_t swappedCount = CFSwapInt16HostToBig(count); 64 | CFDataAppendBytes(data, (UInt8*)&swappedCount, sizeof(uint16_t)); 65 | CFDataAppendBytes(data, &type, 1); 66 | CFDataAppendBytes(data, &field, 1); 67 | } 68 | 69 | static void appendField(CFMutableDataRef data, uint8_t field, uint8_t type, uint16_t count, void* fieldData) { 70 | appendHeader(data, field, type, count); 71 | switch (type) { 72 | case 0x00: // uint64_t as UnsignedWide 73 | for (uint16_t i = 0; i < count; ++i) { 74 | uint64_t val = ((uint64_t*)fieldData)[i]; 75 | uint32_t loVal = (uint32_t)val; 76 | uint32_t swappedLoVal = CFSwapInt32HostToBig(loVal); 77 | CFDataAppendBytes(data, (UInt8*)&swappedLoVal, sizeof(uint32_t)); 78 | uint32_t hiVal = (uint32_t)(val >> 32); 79 | uint32_t swappedHiVal = CFSwapInt32HostToBig(hiVal); 80 | CFDataAppendBytes(data, (UInt8*)&swappedHiVal, sizeof(uint32_t)); 81 | } 82 | break; 83 | case 0x10: // uint8_t 84 | for (uint16_t i = 0; i < count; ++i) { 85 | uint8_t val = ((uint8_t*)fieldData)[i]; 86 | CFDataAppendBytes(data, &val, 1); 87 | } 88 | break; 89 | case 0x40: 90 | for (uint16_t i = 0; i < count; ++i) { 91 | uint32_t val = ((uint32_t*)fieldData)[i]; 92 | uint32_t swappedVal = CFSwapInt32HostToBig(val); 93 | CFDataAppendBytes(data, (UInt8*)&swappedVal, sizeof(uint32_t)); 94 | } 95 | break; 96 | case 0xC0: 97 | for (uint16_t i = 0; i < count; ++i) { 98 | Float32 val = ((Float32*)fieldData)[i]; 99 | CFSwappedFloat32 swappedVal = CFConvertFloat32HostToSwapped(val); 100 | CFDataAppendBytes(data, (UInt8*)&swappedVal, sizeof(CFSwappedFloat32)); 101 | } 102 | break; 103 | } 104 | } 105 | 106 | static void appendIntegerField(CFMutableDataRef data, uint8_t field, uint32_t value) { 107 | (void)appendField; 108 | appendHeader(data, field, 0x40, 1); 109 | uint32_t swappedValue = CFSwapInt32HostToBig(value); 110 | CFDataAppendBytes(data, (UInt8*)&swappedValue, sizeof(uint32_t)); 111 | } 112 | 113 | static void appendFloatField(CFMutableDataRef data, uint8_t field, Float32 value) { 114 | appendHeader(data, field, 0xC0, 1); 115 | CFSwappedFloat32 swappedValue = CFConvertFloat32HostToSwapped(value); 116 | CFDataAppendBytes(data, (UInt8*)&swappedValue, sizeof(CFSwappedFloat32)); 117 | } 118 | 119 | static void fillOutBase(CFDictionaryRef info, IOHIDEventData* event) { 120 | CFNumberRef val; 121 | if ((val = CFDictionaryGetValue(info, kTLEventKeyTimestamp))) { 122 | CFNumberGetValue(val, kCFNumberSInt64Type, &event->timestamp); 123 | } 124 | if ((val = CFDictionaryGetValue(info, kTLEventKeyOptions))) { 125 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->options); 126 | } 127 | } 128 | 129 | static void fillOutDigitizer(CFDictionaryRef info, IOHIDDigitizerEventData* event) { 130 | event->size = (uint32_t)sizeof(IOHIDDigitizerEventData); 131 | event->type = kIOHIDEventTypeDigitizer; 132 | CFNumberRef val; 133 | double d; 134 | if ((val = CFDictionaryGetValue(info, kTLEventKeyPositionX))) { 135 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 136 | event->position.x = tl_float2fixed(d); 137 | } 138 | if ((val = CFDictionaryGetValue(info, kTLEventKeyPositionY))) { 139 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 140 | event->position.y = tl_float2fixed(d); 141 | } 142 | if ((val = CFDictionaryGetValue(info, kTLEventKeyPositionZ))) { 143 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 144 | event->position.z = tl_float2fixed(d); 145 | } 146 | 147 | if ((val = CFDictionaryGetValue(info, kTLEventKeyTransducerIndex))) { 148 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->transducerIndex); 149 | } 150 | if ((val = CFDictionaryGetValue(info, kTLEventKeyTransducerType))) { 151 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->transducerType); 152 | } 153 | if ((val = CFDictionaryGetValue(info, kTLEventKeyIdentity))) { 154 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->identity); 155 | } 156 | if ((val = CFDictionaryGetValue(info, kTLEventKeyEventMask))) { 157 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->eventMask); 158 | } 159 | 160 | if ((val = CFDictionaryGetValue(info, kTLEventKeyButtonMask))) { 161 | CFNumberGetValue(val, kCFNumberSInt32Type, &event->buttonMask); 162 | } 163 | if ((val = CFDictionaryGetValue(info, kTLEventKeyTipPressure))) { 164 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 165 | event->tipPressure = tl_float2fixed(d); 166 | } 167 | if ((val = CFDictionaryGetValue(info, kTLEventKeyBarrelPressure))) { 168 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 169 | event->barrelPressure = tl_float2fixed(d); 170 | } 171 | if ((val = CFDictionaryGetValue(info, kTLEventKeyTwist))) { 172 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 173 | event->twist = tl_float2fixed(d); 174 | } 175 | 176 | event->orientationType = kIOHIDDigitizerOrientationTypeQuality; 177 | if ((val = CFDictionaryGetValue(info, kTLEventKeyQuality))) { 178 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 179 | event->orientation.quality.quality = tl_float2fixed(d); 180 | } 181 | if ((val = CFDictionaryGetValue(info, kTLEventKeyDensity))) { 182 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 183 | event->orientation.quality.density = tl_float2fixed(d); 184 | } 185 | if ((val = CFDictionaryGetValue(info, kTLEventKeyIrregularity))) { 186 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 187 | event->orientation.quality.irregularity = tl_float2fixed(d); 188 | } 189 | if ((val = CFDictionaryGetValue(info, kTLEventKeyMajorRadius))) { 190 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 191 | event->orientation.quality.majorRadius = tl_float2fixed(d); 192 | } 193 | if ((val = CFDictionaryGetValue(info, kTLEventKeyMinorRadius))) { 194 | CFNumberGetValue(val, kCFNumberDoubleType, &d); 195 | event->orientation.quality.minorRadius = tl_float2fixed(d); 196 | } 197 | } 198 | 199 | CGEventRef tl_CGEventCreateFromGesture(CFDictionaryRef info, CFArrayRef touches) { 200 | assert(info != NULL); 201 | assert(touches != NULL); 202 | typedef struct { 203 | uint32_t count; 204 | SInt64 sumX; 205 | SInt64 sumY; 206 | SInt64 sumZ; 207 | } AvgPosition; 208 | AvgPosition avgTouch = {}; 209 | AvgPosition avgRange = {}; 210 | AvgPosition avgOther = {}; 211 | CFNumberRef val; 212 | 213 | uint64_t timestamp; 214 | val = CFDictionaryGetValue(info, kTLInfoKeyTimestamp); 215 | if (val) { 216 | CFNumberGetValue(val, kCFNumberSInt64Type, ×tamp); 217 | } 218 | else { 219 | timestamp = tl_uptime(); 220 | } 221 | 222 | IOHIDDigitizerEventData parent = {}; 223 | parent.size = (uint32_t)sizeof(IOHIDDigitizerEventData); 224 | parent.type = kIOHIDEventTypeDigitizer; 225 | parent.timestamp = timestamp; 226 | parent.options = kIOHIDEventOptionIsCollection; 227 | parent.transducerType = kIOHIDDigitizerTransducerTypeHand; 228 | 229 | CFMutableDataRef serializedTouches = CFDataCreateMutable(kCFAllocatorDefault, 0); 230 | CFIndex numTouches = CFArrayGetCount(touches); 231 | for (CFIndex touchIdx = 0; touchIdx < numTouches; ++touchIdx) { 232 | CFDictionaryRef touchInfo = CFArrayGetValueAtIndex(touches, touchIdx); 233 | CFNumberRef typeVal = CFDictionaryGetValue(touchInfo, kTLEventKeyType); 234 | if (!typeVal) continue; 235 | 236 | int32_t type; 237 | CFNumberGetValue(typeVal, kCFNumberSInt32Type, &type); 238 | assert(type == kIOHIDEventTypeDigitizer); // only digitizer events currently supported 239 | 240 | IOHIDDigitizerEventData touch = {}; 241 | fillOutBase(touchInfo, (IOHIDEventData*)&touch); 242 | fillOutDigitizer(touchInfo, &touch); 243 | CFDataAppendBytes(serializedTouches, (UInt8*)&touch, touch.size); 244 | 245 | if (touch.identity) parent.options |= touch.options; 246 | parent.childEventMask |= touch.eventMask; 247 | if (touch.options & kIOHIDTransducerTouch) { 248 | ++avgTouch.count; 249 | avgTouch.sumX += touch.position.x; 250 | avgTouch.sumY += touch.position.y; 251 | avgTouch.sumZ += touch.position.z; 252 | } 253 | else if (touch.options & kIOHIDTransducerRange) { 254 | ++avgRange.count; 255 | avgRange.sumX += touch.position.x; 256 | avgRange.sumY += touch.position.y; 257 | avgRange.sumZ += touch.position.z; 258 | } 259 | else { 260 | ++avgOther.count; 261 | avgOther.sumX += touch.position.x; 262 | avgOther.sumY += touch.position.y; 263 | avgOther.sumZ += touch.position.z; 264 | } 265 | } 266 | 267 | // calculate parent position 268 | if (avgTouch.count) { 269 | parent.position.x = (IOFixed)(avgTouch.sumX / avgTouch.count); 270 | parent.position.y = (IOFixed)(avgTouch.sumY / avgTouch.count); 271 | parent.position.z = (IOFixed)(avgTouch.sumZ / avgTouch.count); 272 | } 273 | else if (avgRange.count) { 274 | parent.position.x = (IOFixed)(avgRange.sumX / avgRange.count); 275 | parent.position.y = (IOFixed)(avgRange.sumY / avgRange.count); 276 | parent.position.z = (IOFixed)(avgRange.sumZ / avgRange.count); 277 | } 278 | else if (avgOther.count) { 279 | parent.position.x = (IOFixed)(avgOther.sumX / avgOther.count); 280 | parent.position.y = (IOFixed)(avgOther.sumY / avgOther.count); 281 | parent.position.z = (IOFixed)(avgOther.sumZ / avgOther.count); 282 | } 283 | 284 | // create vendor token 285 | uint64_t deviceID = 0; 286 | val = CFDictionaryGetValue(info, kTLInfoKeyDeviceID); 287 | if (val) { 288 | CFNumberGetValue(val, kCFNumberSInt64Type, &deviceID); 289 | } 290 | UInt8 vendorPayload[40] = {}; 291 | *(uint64_t*)vendorPayload = CFSwapInt64HostToLittle(deviceID); 292 | const size_t vendorPayloadLen = sizeof(vendorPayload); 293 | const size_t vendorDataSize = sizeof(IOHIDVendorDefinedEventData) + vendorPayloadLen; 294 | IOHIDVendorDefinedEventData* vendorData = malloc(vendorDataSize); 295 | vendorData->size = (uint32_t)vendorDataSize; 296 | vendorData->type = kIOHIDEventTypeVendorDefined; 297 | vendorData->usagePage = 0xFF00; 298 | vendorData->usage = 0x1777; 299 | vendorData->version = 1; 300 | vendorData->length = (uint32_t)vendorPayloadLen; 301 | setVendorData(vendorData, vendorPayload); 302 | 303 | // create base event 304 | CGEventRef protoEvent = CGEventCreate(NULL); 305 | CGEventSetType(protoEvent, 29); // NSEventTypeGesture 306 | CGEventSetFlags(protoEvent, 256); // magic 307 | CGEventSetTimestamp(protoEvent, timestamp); 308 | 309 | // serialize base event 310 | CFDataRef baseData = CGEventCreateData(kCFAllocatorDefault, protoEvent); 311 | CFRelease(protoEvent); 312 | CFMutableDataRef gestureData = CFDataCreateMutableCopy(kCFAllocatorDefault, 0, baseData); 313 | CFRelease(baseData); 314 | 315 | // remove gesture fields CGEvent has added before the missing event data (it expects to find them after) 316 | if (CFDataGetLength(gestureData) >= 24) { 317 | CFDataDeleteBytes(gestureData, CFRangeMake(CFDataGetLength(gestureData) - 24, 24)); 318 | } 319 | 320 | // serialize CGEvent field header for IOHID event queue 321 | uint16_t totalSize = (sizeof(IOHIDSystemQueueElement) + vendorDataSize + 322 | (numTouches + 1) * sizeof(IOHIDDigitizerEventData)); 323 | uint16_t swappedTotalSize = CFSwapInt16HostToBig((uint16_t)totalSize); 324 | CFDataAppendBytes(gestureData, (UInt8*)&swappedTotalSize, 2); 325 | CFDataAppendBytes(gestureData, (UInt8[]){0x10, 0x6D}, 2); 326 | 327 | // serialize event queue collection header 328 | IOHIDSystemQueueElement queueElement = {}; 329 | queueElement.timeStamp = timestamp; 330 | queueElement.options = parent.options; 331 | queueElement.eventCount = (uint32_t)numTouches + 2; 332 | CFDataAppendBytes(gestureData, (UInt8*)&queueElement, sizeof(queueElement)); 333 | 334 | // serialize touch event data 335 | CFDataAppendBytes(gestureData, (UInt8*)&parent, parent.size); 336 | CFDataAppendBytes(gestureData, CFDataGetBytePtr(serializedTouches), CFDataGetLength(serializedTouches)); 337 | CFRelease(serializedTouches); 338 | 339 | // serialize vendor data 340 | CFDataAppendBytes(gestureData, (UInt8*)vendorData, vendorDataSize); 341 | free(vendorData); 342 | 343 | // serialize gesture event fields 344 | int32_t gestureSubtype = kTLInfoSubtypeGesture; 345 | val = CFDictionaryGetValue(info, kTLInfoKeyGestureSubtype); 346 | if (val) { 347 | CFNumberGetValue(val, kCFNumberSInt32Type, &gestureSubtype); 348 | } 349 | appendIntegerField(gestureData, 0x6E, gestureSubtype); 350 | appendIntegerField(gestureData, 0x6F, 0); // magic 351 | appendIntegerField(gestureData, 0x70, 0); // magic 352 | 353 | int32_t gesturePhase = 0; // c.f. IOHIDEventPhaseBits 354 | val = CFDictionaryGetValue(info, kTLInfoKeyGesturePhase); 355 | if (val) { 356 | CFNumberGetValue(val, kCFNumberSInt32Type, &gesturePhase); 357 | } 358 | appendIntegerField(gestureData, 0x84, gesturePhase); 359 | appendIntegerField(gestureData, 0x85, 0); // magic? 360 | 361 | 362 | if (gestureSubtype == kTLInfoSubtypeMagnify) { 363 | Float32 magnification = 0.0f; 364 | val = CFDictionaryGetValue(info, kTLInfoKeyMagnification); 365 | if (val) { 366 | CFNumberGetValue(val, kCFNumberFloat32Type, &magnification); 367 | } 368 | appendFloatField(gestureData, 0x71, magnification); 369 | } 370 | else if (gestureSubtype == kTLInfoSubtypeRotate) { 371 | Float32 rotation = 0.0f; 372 | val = CFDictionaryGetValue(info, kTLInfoKeyRotation); 373 | if (val) { 374 | CFNumberGetValue(val, kCFNumberFloat32Type, &rotation); 375 | } 376 | appendFloatField(gestureData, 0x72, rotation); 377 | } 378 | else if (gestureSubtype == kTLInfoSubtypeSwipe) { 379 | int32_t swipeDirection = 0; 380 | val = CFDictionaryGetValue(info, kTLInfoKeySwipeDirection); 381 | if (val) { 382 | CFNumberGetValue(val, kCFNumberSInt32Type, &swipeDirection); 383 | } 384 | appendIntegerField(gestureData, 0x73, swipeDirection); 385 | } 386 | else if (gestureSubtype == kTLInfoSubtypeBeginGesture || 387 | gestureSubtype == kTLInfoSubtypeEndGesture) 388 | { 389 | int32_t nextSubtype = 0; 390 | val = CFDictionaryGetValue(info, kTLInfoKeyNextSubtype); 391 | if (val) { 392 | CFNumberGetValue(val, kCFNumberSInt32Type, &nextSubtype); 393 | } 394 | appendIntegerField(gestureData, 0x75, nextSubtype); 395 | } 396 | 397 | appendFloatField(gestureData, 0x8B, 0.0f); // magic? 398 | appendFloatField(gestureData, 0x8C, 0.0f); // magic? 399 | 400 | CGEventRef synthEvent = CGEventCreateFromData(kCFAllocatorDefault, gestureData); 401 | CFRelease(gestureData); 402 | return synthEvent; 403 | } 404 | -------------------------------------------------------------------------------- /External/TouchEvents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TouchEvents.h 3 | * TouchSynthesis 4 | * 5 | * Created by Nathan Vander Wilt on 1/13/10. 6 | * Copyright 2010 Calf Trail Software, LLC. All rights reserved. 7 | * 8 | */ 9 | 10 | #include 11 | 12 | 13 | /* these for info */ 14 | 15 | extern const CFStringRef kTLInfoKeyDeviceID; // required for touches 16 | extern const CFStringRef kTLInfoKeyTimestamp; 17 | extern const CFStringRef kTLInfoKeyGestureSubtype; 18 | extern const CFStringRef kTLInfoKeyGesturePhase; 19 | extern const CFStringRef kTLInfoKeyMagnification; 20 | extern const CFStringRef kTLInfoKeyRotation; // degrees 21 | extern const CFStringRef kTLInfoKeySwipeDirection; 22 | extern const CFStringRef kTLInfoKeyNextSubtype; 23 | 24 | enum { 25 | kTLInfoSubtypeRotate = 0x05, 26 | kTLInfoSubtypeSub6, // may be panning/scrolling 27 | kTLInfoSubtypeMagnify = 0x08, 28 | kTLInfoSubtypeGesture = 0x0B, 29 | kTLInfoSubtypeSwipe = 0x10, 30 | kTLInfoSubtypeBeginGesture = 0x3D, 31 | kTLInfoSubtypeEndGesture 32 | }; 33 | typedef uint32_t TLInfoSubtype; 34 | 35 | enum { 36 | kTLInfoSwipeUp = 1, 37 | kTLInfoSwipeDown = 2, 38 | kTLInfoSwipeLeft = 4, 39 | kTLInfoSwipeRight = 8 40 | }; 41 | typedef uint32_t TLInfoSwipeDirection; 42 | 43 | 44 | /* these for touches */ 45 | 46 | extern const CFStringRef kTLEventKeyType; 47 | extern const CFStringRef kTLEventKeyTimestamp; 48 | extern const CFStringRef kTLEventKeyOptions; 49 | 50 | extern const CFStringRef kTLEventKeyPositionX; 51 | extern const CFStringRef kTLEventKeyPositionY; 52 | extern const CFStringRef kTLEventKeyPositionZ; 53 | 54 | extern const CFStringRef kTLEventKeyTransducerIndex; 55 | extern const CFStringRef kTLEventKeyTransducerType; 56 | extern const CFStringRef kTLEventKeyIdentity; 57 | extern const CFStringRef kTLEventKeyEventMask; 58 | 59 | extern const CFStringRef kTLEventKeyButtonMask; 60 | extern const CFStringRef kTLEventKeyTipPressure; 61 | extern const CFStringRef kTLEventKeyBarrelPressure; 62 | extern const CFStringRef kTLEventKeyTwist; 63 | 64 | extern const CFStringRef kTLEventKeyQuality; 65 | extern const CFStringRef kTLEventKeyDensity; 66 | extern const CFStringRef kTLEventKeyIrregularity; 67 | extern const CFStringRef kTLEventKeyMajorRadius; 68 | extern const CFStringRef kTLEventKeyMinorRadius; 69 | 70 | 71 | CGEventRef tl_CGEventCreateFromGesture(CFDictionaryRef info, CFArrayRef touches); 72 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | 3 | Version 2, June 1991 4 | 5 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 6 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | Preamble 11 | 12 | The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. 13 | 14 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. 15 | 16 | To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. 17 | 18 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. 19 | 20 | We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. 21 | 22 | Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. 23 | 24 | Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 25 | 26 | The precise terms and conditions for copying, distribution and modification follow. 27 | 28 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 29 | 30 | 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". 31 | 32 | Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 33 | 34 | 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 35 | 36 | You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 37 | 38 | 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 39 | 40 | a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. 41 | b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. 42 | c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) 43 | These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. 44 | 45 | Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. 46 | 47 | In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 48 | 49 | 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: 50 | 51 | a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 52 | b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 53 | c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) 54 | The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. 55 | 56 | If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 57 | 58 | 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 59 | 60 | 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 61 | 62 | 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 63 | 64 | 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. 65 | 66 | If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. 67 | 68 | It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. 69 | 70 | This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 71 | 72 | 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 73 | 74 | 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 75 | 76 | Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 77 | 78 | 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. 79 | 80 | NO WARRANTY 81 | 82 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 83 | 84 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | macOS mostly ignores the M4/M5 mouse buttons, commonly used for navigation. Third-party apps can bind them to ⌘+[ and ⌘+], but this only works in a small number of apps and feels janky. With this tool, your side buttons will simulate 3-finger swipes, allowing you to navigate almost any window with a history. As seen in the Logitech MX Master! 4 | 5 | Extensive information on this tweak can be found here: http://sensible-side-buttons.archagon.net 6 | 7 | To ensure SensibleSideButtons opens whenever you start your computer: 8 | 9 | 1. Go to System Preferences 10 | 1. Click Users & Groups 11 | 1. Click your username in the left panel 12 | 1. Click Login Items at the top 13 | 1. Click the plus button at the bottom 14 | 1. Go to wherever you put the app (probably your Applications folder) and double-click it 15 | -------------------------------------------------------------------------------- /SideButtonFixer/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 4 | // SensibleSideButtons, a utility that fixes the navigation buttons on third-party mice in macOS 5 | // Copyright (C) 2018 Alexei Baboulevitch (ssb@archagon.net) 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | // 21 | 22 | #import 23 | 24 | @interface AppDelegate : NSObject 25 | @end 26 | -------------------------------------------------------------------------------- /SideButtonFixer/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 4 | // SensibleSideButtons, a utility that fixes the navigation buttons on third-party mice in macOS 5 | // Copyright (C) 2018 Alexei Baboulevitch (ssb@archagon.net) 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | // 21 | 22 | #import "AppDelegate.h" 23 | #import "TouchEvents.h" 24 | 25 | static NSMutableDictionary*>* swipeInfo = nil; 26 | static NSArray* nullArray = nil; 27 | 28 | static void SBFFakeSwipe(TLInfoSwipeDirection dir) { 29 | CGEventRef event1 = tl_CGEventCreateFromGesture((__bridge CFDictionaryRef)(swipeInfo[@(dir)][0]), (__bridge CFArrayRef)nullArray); 30 | CGEventRef event2 = tl_CGEventCreateFromGesture((__bridge CFDictionaryRef)(swipeInfo[@(dir)][1]), (__bridge CFArrayRef)nullArray); 31 | 32 | CGEventPost(kCGHIDEventTap, event1); 33 | CGEventPost(kCGHIDEventTap, event2); 34 | 35 | CFRelease(event1); 36 | CFRelease(event2); 37 | } 38 | 39 | static CGEventRef SBFMouseCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) { 40 | int64_t number = CGEventGetIntegerValueField(event, kCGMouseEventButtonNumber); 41 | BOOL down = (CGEventGetType(event) == kCGEventOtherMouseDown); 42 | 43 | BOOL mouseDown = [[NSUserDefaults standardUserDefaults] boolForKey:@"SBFMouseDown"]; 44 | BOOL swapButtons = [[NSUserDefaults standardUserDefaults] boolForKey:@"SBFSwapButtons"]; 45 | 46 | if (number == (swapButtons ? 4 : 3)) { 47 | if ((mouseDown && down) || (!mouseDown && !down)) { 48 | SBFFakeSwipe(kTLInfoSwipeLeft); 49 | } 50 | 51 | return NULL; 52 | } 53 | else if (number == (swapButtons ? 3 : 4)) { 54 | if ((mouseDown && down) || (!mouseDown && !down)) { 55 | SBFFakeSwipe(kTLInfoSwipeRight); 56 | } 57 | 58 | return NULL; 59 | } 60 | else { 61 | return event; 62 | } 63 | } 64 | 65 | typedef NS_ENUM(NSInteger, MenuMode) { 66 | MenuModeAccessibility, 67 | MenuModeDonation, 68 | MenuModeNormal 69 | }; 70 | 71 | typedef NS_ENUM(NSInteger, MenuItem) { 72 | MenuItemEnabled = 0, 73 | MenuItemEnabledSeparator, 74 | MenuItemTriggerOnMouseDown, 75 | MenuItemSwapButtons, 76 | MenuItemOptionsSeparator, 77 | MenuItemStartupHide, 78 | MenuItemStartupHideInfo, 79 | MenuItemStartupSeparator, 80 | MenuItemAboutText, 81 | MenuItemAboutSeparator, 82 | MenuItemDonate, 83 | MenuItemWebsite, 84 | MenuItemAccessibility, 85 | MenuItemLinkSeparator, 86 | MenuItemQuit 87 | }; 88 | 89 | @interface AppDelegate () 90 | @property (nonatomic, retain) NSStatusItem* statusItem; 91 | @property (nonatomic, assign) CFMachPortRef tap; 92 | @property (nonatomic, assign) MenuMode menuMode; 93 | @end 94 | 95 | @interface AboutView: NSView 96 | @property (nonatomic, retain) NSTextView* text; 97 | @property (nonatomic, assign) MenuMode menuMode; 98 | -(CGFloat) margin; 99 | @end 100 | 101 | @implementation AppDelegate 102 | 103 | -(void) dealloc { 104 | [self startTap:NO]; 105 | 106 | swipeInfo = nil; 107 | nullArray = nil; 108 | } 109 | 110 | -(void) setMenuMode:(MenuMode)menuMode { 111 | _menuMode = menuMode; 112 | AboutView* view = (AboutView*)self.statusItem.menu.itemArray[MenuItemAboutText].view; 113 | view.menuMode = menuMode; 114 | [self refreshSettings]; 115 | } 116 | 117 | // if the application is launched when it's already running, show the icon in the menu bar again 118 | -(BOOL) applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { 119 | if (@available(macOS 10.12, *)) { 120 | [self.statusItem setVisible:YES]; 121 | } 122 | return NO; 123 | } 124 | 125 | -(void) applicationDidFinishLaunching:(NSNotification *)aNotification { 126 | [[NSUserDefaults standardUserDefaults] registerDefaults:@{ 127 | @"SBFWasEnabled": @YES, 128 | @"SBFMouseDown": @YES, 129 | @"SBFDonated": @NO, 130 | @"SBFSwapButtons": @NO 131 | }]; 132 | 133 | // setup globals 134 | { 135 | swipeInfo = [NSMutableDictionary dictionary]; 136 | 137 | for (NSNumber* direction in @[ @(kTLInfoSwipeUp), @(kTLInfoSwipeDown), @(kTLInfoSwipeLeft), @(kTLInfoSwipeRight) ]) { 138 | NSDictionary* swipeInfo1 = [NSDictionary dictionaryWithObjectsAndKeys: 139 | @(kTLInfoSubtypeSwipe), kTLInfoKeyGestureSubtype, 140 | @(1), kTLInfoKeyGesturePhase, 141 | nil]; 142 | 143 | NSDictionary* swipeInfo2 = [NSDictionary dictionaryWithObjectsAndKeys: 144 | @(kTLInfoSubtypeSwipe), kTLInfoKeyGestureSubtype, 145 | direction, kTLInfoKeySwipeDirection, 146 | @(4), kTLInfoKeyGesturePhase, 147 | nil]; 148 | 149 | swipeInfo[direction] = @[ swipeInfo1, swipeInfo2 ]; 150 | } 151 | 152 | nullArray = @[]; 153 | } 154 | 155 | // create status bar item 156 | { 157 | self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; 158 | } 159 | 160 | // create menu 161 | { 162 | NSMenu* menu = [NSMenu new]; 163 | 164 | menu.autoenablesItems = NO; 165 | menu.delegate = self; 166 | 167 | NSMenuItem* enabledItem = [[NSMenuItem alloc] initWithTitle:@"Enabled" action:@selector(enabledToggle:) keyEquivalent:@"e"]; 168 | [menu addItem:enabledItem]; 169 | assert(menu.itemArray.count - 1 == MenuItemEnabled); 170 | 171 | [menu addItem:[NSMenuItem separatorItem]]; 172 | assert(menu.itemArray.count - 1 == MenuItemEnabledSeparator); 173 | 174 | NSMenuItem* modeItem = [[NSMenuItem alloc] initWithTitle:@"Trigger on Mouse Down" action:@selector(mouseDownToggle:) keyEquivalent:@""]; 175 | modeItem.state = NSControlStateValueOn; 176 | [menu addItem:modeItem]; 177 | assert(menu.itemArray.count - 1 == MenuItemTriggerOnMouseDown); 178 | 179 | NSMenuItem* swapItem = [[NSMenuItem alloc] initWithTitle:@"Swap Buttons" action:@selector(swapToggle:) keyEquivalent:@""]; 180 | swapItem.state = NSControlStateValueOff; 181 | [menu addItem:swapItem]; 182 | assert(menu.itemArray.count - 1 == MenuItemSwapButtons); 183 | 184 | [menu addItem:[NSMenuItem separatorItem]]; 185 | assert(menu.itemArray.count - 1 == MenuItemOptionsSeparator); 186 | 187 | 188 | NSMenuItem* hideItem = [[NSMenuItem alloc] initWithTitle:@"Hide Menu Bar Icon" action:@selector(hideMenubarItem:) keyEquivalent:@""]; 189 | [menu addItem:hideItem]; 190 | assert(menu.itemArray.count - 1 == MenuItemStartupHide); 191 | 192 | NSMenuItem* hideInfoItem = [[NSMenuItem alloc] initWithTitle:@"Relaunch application to show again" action:NULL keyEquivalent:@""]; 193 | [hideInfoItem setEnabled:NO]; 194 | [menu addItem:hideInfoItem]; 195 | assert(menu.itemArray.count - 1 == MenuItemStartupHideInfo); 196 | 197 | [menu addItem:[NSMenuItem separatorItem]]; 198 | assert(menu.itemArray.count - 1 == MenuItemStartupSeparator); 199 | 200 | AboutView* text = [[AboutView alloc] initWithFrame:NSMakeRect(0, 0, 320, 100)]; //arbitrary height 201 | NSMenuItem* aboutText = [[NSMenuItem alloc] initWithTitle:@"Text" action:NULL keyEquivalent:@""]; 202 | aboutText.view = text; 203 | [menu addItem:aboutText]; 204 | assert(menu.itemArray.count - 1 == MenuItemAboutText); 205 | 206 | [menu addItem:[NSMenuItem separatorItem]]; 207 | assert(menu.itemArray.count - 1 == MenuItemAboutSeparator); 208 | 209 | NSString* appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; 210 | [menu addItem:[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ Website", appName] action:@selector(donate:) keyEquivalent:@""]]; 211 | assert(menu.itemArray.count - 1 == MenuItemDonate); 212 | 213 | [menu addItem:[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ Website", appName] action:@selector(website:) keyEquivalent:@""]]; 214 | assert(menu.itemArray.count - 1 == MenuItemWebsite); 215 | 216 | [menu addItem:[[NSMenuItem alloc] initWithTitle:@"Open Accessibility Whitelist" action:@selector(accessibility:) keyEquivalent:@""]]; 217 | assert(menu.itemArray.count - 1 == MenuItemAccessibility); 218 | 219 | [menu addItem:[NSMenuItem separatorItem]]; 220 | assert(menu.itemArray.count - 1 == MenuItemLinkSeparator); 221 | 222 | NSMenuItem* quit = [[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(quit:) keyEquivalent:@"q"]; 223 | quit.keyEquivalentModifierMask = NSEventModifierFlagCommand; 224 | [menu addItem:quit]; 225 | assert(menu.itemArray.count - 1 == MenuItemQuit); 226 | 227 | self.statusItem.menu = menu; 228 | } 229 | 230 | [self startTap:[[NSUserDefaults standardUserDefaults] boolForKey:@"SBFWasEnabled"]]; 231 | 232 | [self updateMenuMode]; 233 | [self refreshSettings]; 234 | } 235 | 236 | -(void) updateMenuMode { 237 | [self updateMenuMode:YES]; 238 | } 239 | 240 | -(void) updateMenuMode:(BOOL)active { 241 | // TODO: this actually returns YES if SSB is deleted (not disabled) from Accessibility 242 | NSDictionary* options = @{ (__bridge id)kAXTrustedCheckOptionPrompt: @(active ? YES : NO) }; 243 | BOOL accessibilityEnabled = AXIsProcessTrustedWithOptions((CFDictionaryRef)options); 244 | //BOOL accessibilityEnabled = YES; //is accessibility even required? seems to work fine without it 245 | 246 | if (accessibilityEnabled) { 247 | if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SBFDonated"]) { 248 | self.menuMode = MenuModeNormal; 249 | } 250 | else { 251 | self.menuMode = MenuModeDonation; 252 | } 253 | } 254 | else { 255 | self.menuMode = MenuModeAccessibility; 256 | } 257 | 258 | // QQQ: for testing 259 | //self.menuMode = arc4random_uniform(3); 260 | } 261 | 262 | -(void) refreshSettings { 263 | self.statusItem.menu.itemArray[MenuItemEnabled].state = self.tap != NULL && CGEventTapIsEnabled(self.tap); 264 | self.statusItem.menu.itemArray[MenuItemTriggerOnMouseDown].state = [[NSUserDefaults standardUserDefaults] boolForKey:@"SBFMouseDown"]; 265 | self.statusItem.menu.itemArray[MenuItemSwapButtons].state = [[NSUserDefaults standardUserDefaults] boolForKey:@"SBFSwapButtons"]; 266 | 267 | switch (self.menuMode) { 268 | case MenuModeAccessibility: 269 | self.statusItem.menu.itemArray[MenuItemEnabled].enabled = NO; 270 | self.statusItem.menu.itemArray[MenuItemTriggerOnMouseDown].enabled = NO; 271 | self.statusItem.menu.itemArray[MenuItemSwapButtons].enabled = NO; 272 | self.statusItem.menu.itemArray[MenuItemDonate].hidden = YES; 273 | self.statusItem.menu.itemArray[MenuItemWebsite].hidden = NO; 274 | self.statusItem.menu.itemArray[MenuItemAccessibility].hidden = NO; 275 | break; 276 | case MenuModeDonation: 277 | self.statusItem.menu.itemArray[MenuItemEnabled].enabled = YES; 278 | self.statusItem.menu.itemArray[MenuItemTriggerOnMouseDown].enabled = YES; 279 | self.statusItem.menu.itemArray[MenuItemSwapButtons].enabled = YES; 280 | self.statusItem.menu.itemArray[MenuItemDonate].hidden = NO; 281 | self.statusItem.menu.itemArray[MenuItemWebsite].hidden = YES; 282 | self.statusItem.menu.itemArray[MenuItemAccessibility].hidden = YES; 283 | break; 284 | case MenuModeNormal: 285 | self.statusItem.menu.itemArray[MenuItemEnabled].enabled = YES; 286 | self.statusItem.menu.itemArray[MenuItemTriggerOnMouseDown].enabled = YES; 287 | self.statusItem.menu.itemArray[MenuItemSwapButtons].enabled = YES; 288 | self.statusItem.menu.itemArray[MenuItemDonate].hidden = YES; 289 | self.statusItem.menu.itemArray[MenuItemWebsite].hidden = NO; 290 | self.statusItem.menu.itemArray[MenuItemAccessibility].hidden = YES; 291 | break; 292 | } 293 | 294 | AboutView* view = (AboutView*)self.statusItem.menu.itemArray[MenuItemAboutText].view; 295 | [view layoutSubtreeIfNeeded]; //used to auto-calculate the text view size 296 | view.frame = NSMakeRect(0, 0, view.bounds.size.width, view.text.frame.size.height); 297 | 298 | // only show the menu item to hide the icon if the API is available 299 | if (@available(macOS 10.12, *)) { 300 | self.statusItem.menu.itemArray[MenuItemStartupHide].hidden = NO; 301 | self.statusItem.menu.itemArray[MenuItemStartupHideInfo].hidden = NO; 302 | } 303 | else { 304 | self.statusItem.menu.itemArray[MenuItemStartupHide].hidden = YES; 305 | self.statusItem.menu.itemArray[MenuItemStartupHideInfo].hidden = YES; 306 | } 307 | 308 | if (self.statusItem.button != nil) { 309 | if (self.tap != NULL && CGEventTapIsEnabled(self.tap)) { 310 | self.statusItem.button.image = [NSImage imageNamed:@"MenuIcon"]; 311 | } 312 | else { 313 | self.statusItem.button.image = [NSImage imageNamed:@"MenuIconDisabled"]; 314 | } 315 | } 316 | } 317 | 318 | -(void) startTap:(BOOL)start { 319 | if (start) { 320 | if (self.tap == NULL) { 321 | self.tap = CGEventTapCreate(kCGHIDEventTap, 322 | kCGHeadInsertEventTap, 323 | kCGEventTapOptionDefault, 324 | CGEventMaskBit(kCGEventOtherMouseUp)|CGEventMaskBit(kCGEventOtherMouseDown), 325 | &SBFMouseCallback, 326 | NULL); 327 | 328 | if (self.tap != NULL) { 329 | CFRunLoopSourceRef runLoopSource = CFMachPortCreateRunLoopSource(NULL, self.tap, 0); 330 | CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes); 331 | CFRelease(runLoopSource); 332 | 333 | CGEventTapEnable(self.tap, true); 334 | } 335 | } 336 | } 337 | else { 338 | if (self.tap != NULL) { 339 | CGEventTapEnable(self.tap, NO); 340 | CFRelease(self.tap); 341 | 342 | self.tap = NULL; 343 | } 344 | } 345 | 346 | [[NSUserDefaults standardUserDefaults] setBool:self.tap != NULL && CGEventTapIsEnabled(self.tap) forKey:@"SBFWasEnabled"]; 347 | } 348 | 349 | -(void) enabledToggle:(id)sender { 350 | [self startTap:self.tap == NULL]; 351 | [self refreshSettings]; 352 | } 353 | 354 | -(void) mouseDownToggle:(id)sender { 355 | [[NSUserDefaults standardUserDefaults] setBool:![[NSUserDefaults standardUserDefaults] boolForKey:@"SBFMouseDown"] forKey:@"SBFMouseDown"]; 356 | [self refreshSettings]; 357 | } 358 | 359 | -(void) swapToggle:(id)sender { 360 | [[NSUserDefaults standardUserDefaults] setBool:![[NSUserDefaults standardUserDefaults] boolForKey:@"SBFSwapButtons"] forKey:@"SBFSwapButtons"]; 361 | [self refreshSettings]; 362 | } 363 | 364 | -(void) donate:(id)sender { 365 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"http://sensible-side-buttons.archagon.net#donations"]]; 366 | [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SBFDonated"]; 367 | 368 | [self updateMenuMode]; 369 | [self refreshSettings]; 370 | } 371 | 372 | -(void) website:(id)sender { 373 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"http://sensible-side-buttons.archagon.net"]]; 374 | } 375 | 376 | -(void) accessibility:(id)sender { 377 | [self updateMenuMode]; 378 | [self refreshSettings]; 379 | } 380 | 381 | -(void) hideMenubarItem:(id)sender { 382 | if (@available(macOS 10.12, *)) { 383 | [self.statusItem setVisible:NO]; 384 | } 385 | } 386 | 387 | -(void) quit:(id)sender { 388 | [NSApp terminate:self]; 389 | } 390 | 391 | - (void) menuWillOpen:(NSMenu*)menu { 392 | // TODO: theoretically, accessibility can be disabled while the menu is opened, but this is unlikely 393 | [self updateMenuMode:NO]; 394 | [self refreshSettings]; 395 | } 396 | 397 | @end 398 | 399 | @implementation AboutView 400 | 401 | -(CGFloat) margin { 402 | return 17; 403 | } 404 | 405 | -(void) setMenuMode:(MenuMode)menuMode { 406 | _menuMode = menuMode; 407 | 408 | NSFont* font = [NSFont menuFontOfSize:13]; 409 | 410 | NSFontDescriptor* boldFontDesc = [NSFontDescriptor fontDescriptorWithFontAttributes:@{ 411 | NSFontFamilyAttribute: font.familyName, 412 | NSFontFaceAttribute: @"Bold" 413 | }]; 414 | NSFont* boldFont = [NSFont fontWithDescriptor:boldFontDesc size:font.pointSize]; 415 | if (!boldFont) { boldFont = font; } 416 | 417 | // AB: dynamic color component extraction experiments 418 | //CGFloat h1, s1, b1, a1, h2, s2, b2, a2; 419 | //NSColorSpace* space; 420 | //if (@available(macOS 10.13, *)) { 421 | // space = [[NSColor redColor] colorUsingType:NSColorTypeComponentBased].colorSpace; 422 | //} else { 423 | // space = [NSColorSpace deviceRGBColorSpace]; 424 | //} 425 | //NSColor* color = [[NSColor systemBlueColor] colorUsingColorSpace:space]; 426 | //[color getHue:&h1 saturation:&s1 brightness:&b1 alpha:&a1]; 427 | //color = [[NSColor systemRedColor] colorUsingColorSpace:space]; 428 | //[color getHue:&h2 saturation:&s2 brightness:&b2 alpha:&a2]; 429 | 430 | //NSColor* regularColor = [NSColor colorWithRed:120/255.0 green:120/255.0 blue:160/255.0 alpha:1]; 431 | //NSColor* regularColor = [NSColor colorWithHue:h1 saturation:s1 brightness:b1 alpha:a1]; 432 | NSColor* regularColor = [NSColor secondaryLabelColor]; 433 | NSColor* alertColor = [NSColor systemRedColor]; 434 | 435 | NSDictionary* regularAttributes = @{ 436 | NSFontAttributeName: font, 437 | NSForegroundColorAttributeName: regularColor 438 | }; 439 | NSDictionary* alertAttributes = @{ 440 | NSFontAttributeName: font, 441 | NSForegroundColorAttributeName: alertColor 442 | }; 443 | NSDictionary* smallReturnAttributes = @{ 444 | NSFontAttributeName: [NSFont menuFontOfSize:3], 445 | }; 446 | 447 | NSString* appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; 448 | NSString* appDescription = [NSString stringWithFormat:@"%@ %@", appName, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]; 449 | NSString* copyright = @"Copyright © 2018 Alexei Baboulevitch."; 450 | 451 | switch (menuMode) { 452 | case MenuModeAccessibility: { 453 | NSString* text = [NSString stringWithFormat:@"Uh-oh! It looks like %@ is not whitelisted in the Accessibility panel of your Security & Privacy System Preferences. This app needs to be on the Accessibility whitelist in order to process global mouse events. Please open the Accessibility panel below and add the app to the whitelist.", appDescription]; 454 | 455 | NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:text attributes:alertAttributes]; 456 | [string addAttribute:NSFontAttributeName value:boldFont range:[text rangeOfString:appDescription]]; 457 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:regularAttributes]]; 458 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:smallReturnAttributes]]; 459 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:copyright attributes:regularAttributes]]; 460 | 461 | [self.text.textStorage setAttributedString:string]; 462 | } break; 463 | case MenuModeDonation: { 464 | NSString* text = [NSString stringWithFormat:@"Thanks for using %@!\nIf you find this utility useful, please consider making a purchase through the Amazon affiliate link on the website below. It won't cost you an extra cent! 😊", appDescription]; 465 | 466 | NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:text attributes:regularAttributes]; 467 | [string addAttribute:NSFontAttributeName value:boldFont range:[text rangeOfString:appDescription]]; 468 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:regularAttributes]]; 469 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:smallReturnAttributes]]; 470 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:copyright attributes:regularAttributes]]; 471 | 472 | [self.text.textStorage setAttributedString:string]; 473 | } break; 474 | case MenuModeNormal: { 475 | NSString* text = [NSString stringWithFormat:@"Thanks for using %@!", appDescription]; 476 | 477 | NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:text attributes:regularAttributes]; 478 | [string addAttribute:NSFontAttributeName value:boldFont range:[text rangeOfString:appDescription]]; 479 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:regularAttributes]]; 480 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n" attributes:smallReturnAttributes]]; 481 | [string appendAttributedString:[[NSAttributedString alloc] initWithString:copyright attributes:regularAttributes]]; 482 | 483 | [self.text.textStorage setAttributedString:string]; 484 | } break; 485 | } 486 | 487 | [self setNeedsLayout:YES]; 488 | } 489 | 490 | -(instancetype) initWithFrame:(NSRect)frameRect { 491 | self = [super initWithFrame:frameRect]; 492 | 493 | if (self) { 494 | //NSTextView* testColor = [NSTextView new]; 495 | //testColor.backgroundColor = NSColor.greenColor; 496 | //[self addSubview:testColor]; 497 | 498 | self.text = [NSTextView new]; 499 | self.text.backgroundColor = NSColor.clearColor; 500 | [self.text setEditable:NO]; 501 | [self.text setSelectable:NO]; 502 | [self addSubview:self.text]; 503 | 504 | self.menuMode = MenuModeNormal; 505 | } 506 | 507 | return self; 508 | } 509 | 510 | -(void) layout { 511 | [super layout]; 512 | 513 | CGFloat margin = [self margin]; 514 | 515 | // text view sizing 516 | { 517 | // first, set the correct width 518 | CGFloat arbitraryHeight = 100; 519 | self.text.frame = NSMakeRect(margin, 0, self.bounds.size.width - margin, arbitraryHeight); 520 | 521 | // next, autosize to get the height 522 | [self.text sizeToFit]; 523 | 524 | // finally, position the view correctly 525 | self.text.frame = NSMakeRect(self.text.frame.origin.x, self.bounds.size.height - self.text.frame.size.height, self.text.frame.size.width, self.text.frame.size.height); 526 | } 527 | 528 | //NSView* testView = [self subviews][0]; 529 | //testView.frame = self.bounds; 530 | 531 | //NSLog(@"Text size: %@, self size: %@", NSStringFromSize(self.text.frame.size), NSStringFromSize(self.bounds.size)); 532 | } 533 | 534 | @end 535 | -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 2-1.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 2.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 3-1.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 3.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 4.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 5.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 6-1.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 6.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024 7.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "1024 7.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "1024 6.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "1024 6-1.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "1024 5.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "1024 4.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "1024 3-1.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "1024 3.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "1024 2-1.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "1024 2.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "filename" : "MenuIcon@2x-1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "filename" : "MenuIcon@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIcon.imageset/MenuIcon@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/MenuIcon.imageset/MenuIcon@2x-1.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIcon.imageset/MenuIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/MenuIcon.imageset/MenuIcon@2x.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/.DS_Store -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "filename" : "MenuIconDisabled@2x-1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "filename" : "MenuIconDisabled@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/MenuIconDisabled@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/MenuIconDisabled@2x-1.png -------------------------------------------------------------------------------- /SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/MenuIconDisabled@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/SideButtonFixer/Assets.xcassets/MenuIconDisabled.imageset/MenuIconDisabled@2x.png -------------------------------------------------------------------------------- /SideButtonFixer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0.6 21 | CFBundleVersion 22 | 5 23 | LSApplicationCategoryType 24 | public.app-category.utilities 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | LSUIElement 28 | 29 | NSHumanReadableCopyright 30 | Copyright © 2018 Alexei Baboulevitch. All rights reserved. 31 | NSMainStoryboardFile 32 | Main 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /SideButtonFixer/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | Default 529 | 530 | 531 | 532 | 533 | 534 | 535 | Left to Right 536 | 537 | 538 | 539 | 540 | 541 | 542 | Right to Left 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | Default 554 | 555 | 556 | 557 | 558 | 559 | 560 | Left to Right 561 | 562 | 563 | 564 | 565 | 566 | 567 | Right to Left 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | -------------------------------------------------------------------------------- /SideButtonFixer/SideButtonFixer.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SideButtonFixer/en.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSMenuItem"; title = "Customize Toolbar…"; ObjectID = "1UK-8n-QPP"; */ 3 | "1UK-8n-QPP.title" = "Customize Toolbar…"; 4 | 5 | /* Class = "NSMenuItem"; title = "test"; ObjectID = "1Xt-HY-uBw"; */ 6 | "1Xt-HY-uBw.title" = "test"; 7 | 8 | /* Class = "NSMenu"; title = "Find"; ObjectID = "1b7-l0-nxx"; */ 9 | "1b7-l0-nxx.title" = "Find"; 10 | 11 | /* Class = "NSMenuItem"; title = "Lower"; ObjectID = "1tx-W0-xDw"; */ 12 | "1tx-W0-xDw.title" = "Lower"; 13 | 14 | /* Class = "NSMenuItem"; title = "Raise"; ObjectID = "2h7-ER-AoG"; */ 15 | "2h7-ER-AoG.title" = "Raise"; 16 | 17 | /* Class = "NSMenuItem"; title = "Transformations"; ObjectID = "2oI-Rn-ZJC"; */ 18 | "2oI-Rn-ZJC.title" = "Transformations"; 19 | 20 | /* Class = "NSMenu"; title = "Spelling"; ObjectID = "3IN-sU-3Bg"; */ 21 | "3IN-sU-3Bg.title" = "Spelling"; 22 | 23 | /* Class = "NSMenuItem"; title = "Use Default"; ObjectID = "3Om-Ey-2VK"; */ 24 | "3Om-Ey-2VK.title" = "Use Default"; 25 | 26 | /* Class = "NSMenu"; title = "Speech"; ObjectID = "3rS-ZA-NoH"; */ 27 | "3rS-ZA-NoH.title" = "Speech"; 28 | 29 | /* Class = "NSMenuItem"; title = "Tighten"; ObjectID = "46P-cB-AYj"; */ 30 | "46P-cB-AYj.title" = "Tighten"; 31 | 32 | /* Class = "NSMenuItem"; title = "Find"; ObjectID = "4EN-yA-p0u"; */ 33 | "4EN-yA-p0u.title" = "Find"; 34 | 35 | /* Class = "NSMenuItem"; title = "Enter Full Screen"; ObjectID = "4J7-dP-txa"; */ 36 | "4J7-dP-txa.title" = "Enter Full Screen"; 37 | 38 | /* Class = "NSMenuItem"; title = "Quit test"; ObjectID = "4sb-4s-VLi"; */ 39 | "4sb-4s-VLi.title" = "Quit test"; 40 | 41 | /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "5QF-Oa-p0T"; */ 42 | "5QF-Oa-p0T.title" = "Edit"; 43 | 44 | /* Class = "NSMenuItem"; title = "Copy Style"; ObjectID = "5Vv-lz-BsD"; */ 45 | "5Vv-lz-BsD.title" = "Copy Style"; 46 | 47 | /* Class = "NSMenuItem"; title = "About test"; ObjectID = "5kV-Vb-QxS"; */ 48 | "5kV-Vb-QxS.title" = "About test"; 49 | 50 | /* Class = "NSMenuItem"; title = "Redo"; ObjectID = "6dh-zS-Vam"; */ 51 | "6dh-zS-Vam.title" = "Redo"; 52 | 53 | /* Class = "NSMenuItem"; title = "Correct Spelling Automatically"; ObjectID = "78Y-hA-62v"; */ 54 | "78Y-hA-62v.title" = "Correct Spelling Automatically"; 55 | 56 | /* Class = "NSMenu"; title = "Writing Direction"; ObjectID = "8mr-sm-Yjd"; */ 57 | "8mr-sm-Yjd.title" = "Writing Direction"; 58 | 59 | /* Class = "NSMenuItem"; title = "Substitutions"; ObjectID = "9ic-FL-obx"; */ 60 | "9ic-FL-obx.title" = "Substitutions"; 61 | 62 | /* Class = "NSMenuItem"; title = "Smart Copy/Paste"; ObjectID = "9yt-4B-nSM"; */ 63 | "9yt-4B-nSM.title" = "Smart Copy/Paste"; 64 | 65 | /* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */ 66 | "AYu-sK-qS6.title" = "Main Menu"; 67 | 68 | /* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "BOF-NM-1cW"; */ 69 | "BOF-NM-1cW.title" = "Preferences…"; 70 | 71 | /* Class = "NSMenuItem"; title = "\tLeft to Right"; ObjectID = "BgM-ve-c93"; */ 72 | "BgM-ve-c93.title" = "\tLeft to Right"; 73 | 74 | /* Class = "NSMenuItem"; title = "Save As…"; ObjectID = "Bw7-FT-i3A"; */ 75 | "Bw7-FT-i3A.title" = "Save As…"; 76 | 77 | /* Class = "NSMenuItem"; title = "Close"; ObjectID = "DVo-aG-piG"; */ 78 | "DVo-aG-piG.title" = "Close"; 79 | 80 | /* Class = "NSMenuItem"; title = "Spelling and Grammar"; ObjectID = "Dv1-io-Yv7"; */ 81 | "Dv1-io-Yv7.title" = "Spelling and Grammar"; 82 | 83 | /* Class = "NSMenu"; title = "Help"; ObjectID = "F2S-fz-NVQ"; */ 84 | "F2S-fz-NVQ.title" = "Help"; 85 | 86 | /* Class = "NSMenuItem"; title = "test Help"; ObjectID = "FKE-Sm-Kum"; */ 87 | "FKE-Sm-Kum.title" = "test Help"; 88 | 89 | /* Class = "NSMenuItem"; title = "Text"; ObjectID = "Fal-I4-PZk"; */ 90 | "Fal-I4-PZk.title" = "Text"; 91 | 92 | /* Class = "NSMenu"; title = "Substitutions"; ObjectID = "FeM-D8-WVr"; */ 93 | "FeM-D8-WVr.title" = "Substitutions"; 94 | 95 | /* Class = "NSMenuItem"; title = "Bold"; ObjectID = "GB9-OM-e27"; */ 96 | "GB9-OM-e27.title" = "Bold"; 97 | 98 | /* Class = "NSMenu"; title = "Format"; ObjectID = "GEO-Iw-cKr"; */ 99 | "GEO-Iw-cKr.title" = "Format"; 100 | 101 | /* Class = "NSMenuItem"; title = "Use Default"; ObjectID = "GUa-eO-cwY"; */ 102 | "GUa-eO-cwY.title" = "Use Default"; 103 | 104 | /* Class = "NSMenuItem"; title = "Font"; ObjectID = "Gi5-1S-RQB"; */ 105 | "Gi5-1S-RQB.title" = "Font"; 106 | 107 | /* Class = "NSMenuItem"; title = "Writing Direction"; ObjectID = "H1b-Si-o9J"; */ 108 | "H1b-Si-o9J.title" = "Writing Direction"; 109 | 110 | /* Class = "NSMenuItem"; title = "View"; ObjectID = "H8h-7b-M4v"; */ 111 | "H8h-7b-M4v.title" = "View"; 112 | 113 | /* Class = "NSMenuItem"; title = "Text Replacement"; ObjectID = "HFQ-gK-NFA"; */ 114 | "HFQ-gK-NFA.title" = "Text Replacement"; 115 | 116 | /* Class = "NSMenuItem"; title = "Show Spelling and Grammar"; ObjectID = "HFo-cy-zxI"; */ 117 | "HFo-cy-zxI.title" = "Show Spelling and Grammar"; 118 | 119 | /* Class = "NSMenu"; title = "View"; ObjectID = "HyV-fh-RgO"; */ 120 | "HyV-fh-RgO.title" = "View"; 121 | 122 | /* Class = "NSMenuItem"; title = "Subscript"; ObjectID = "I0S-gh-46l"; */ 123 | "I0S-gh-46l.title" = "Subscript"; 124 | 125 | /* Class = "NSMenuItem"; title = "Open…"; ObjectID = "IAo-SY-fd9"; */ 126 | "IAo-SY-fd9.title" = "Open…"; 127 | 128 | /* Class = "NSWindow"; title = "Window"; ObjectID = "IQv-IB-iLA"; */ 129 | "IQv-IB-iLA.title" = "Window"; 130 | 131 | /* Class = "NSMenuItem"; title = "Justify"; ObjectID = "J5U-5w-g23"; */ 132 | "J5U-5w-g23.title" = "Justify"; 133 | 134 | /* Class = "NSMenuItem"; title = "Use None"; ObjectID = "J7y-lM-qPV"; */ 135 | "J7y-lM-qPV.title" = "Use None"; 136 | 137 | /* Class = "NSMenuItem"; title = "Revert to Saved"; ObjectID = "KaW-ft-85H"; */ 138 | "KaW-ft-85H.title" = "Revert to Saved"; 139 | 140 | /* Class = "NSMenuItem"; title = "Show All"; ObjectID = "Kd2-mp-pUS"; */ 141 | "Kd2-mp-pUS.title" = "Show All"; 142 | 143 | /* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "LE2-aR-0XJ"; */ 144 | "LE2-aR-0XJ.title" = "Bring All to Front"; 145 | 146 | /* Class = "NSMenuItem"; title = "Paste Ruler"; ObjectID = "LVM-kO-fVI"; */ 147 | "LVM-kO-fVI.title" = "Paste Ruler"; 148 | 149 | /* Class = "NSMenuItem"; title = "\tLeft to Right"; ObjectID = "Lbh-J2-qVU"; */ 150 | "Lbh-J2-qVU.title" = "\tLeft to Right"; 151 | 152 | /* Class = "NSMenuItem"; title = "Copy Ruler"; ObjectID = "MkV-Pr-PK5"; */ 153 | "MkV-Pr-PK5.title" = "Copy Ruler"; 154 | 155 | /* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */ 156 | "NMo-om-nkz.title" = "Services"; 157 | 158 | /* Class = "NSMenuItem"; title = "\tDefault"; ObjectID = "Nop-cj-93Q"; */ 159 | "Nop-cj-93Q.title" = "\tDefault"; 160 | 161 | /* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "OY7-WF-poV"; */ 162 | "OY7-WF-poV.title" = "Minimize"; 163 | 164 | /* Class = "NSMenuItem"; title = "Baseline"; ObjectID = "OaQ-X3-Vso"; */ 165 | "OaQ-X3-Vso.title" = "Baseline"; 166 | 167 | /* Class = "NSMenuItem"; title = "Hide test"; ObjectID = "Olw-nP-bQN"; */ 168 | "Olw-nP-bQN.title" = "Hide test"; 169 | 170 | /* Class = "NSMenuItem"; title = "Find Previous"; ObjectID = "OwM-mh-QMV"; */ 171 | "OwM-mh-QMV.title" = "Find Previous"; 172 | 173 | /* Class = "NSMenuItem"; title = "Stop Speaking"; ObjectID = "Oyz-dy-DGm"; */ 174 | "Oyz-dy-DGm.title" = "Stop Speaking"; 175 | 176 | /* Class = "NSMenuItem"; title = "Bigger"; ObjectID = "Ptp-SP-VEL"; */ 177 | "Ptp-SP-VEL.title" = "Bigger"; 178 | 179 | /* Class = "NSMenuItem"; title = "Show Fonts"; ObjectID = "Q5e-8K-NDq"; */ 180 | "Q5e-8K-NDq.title" = "Show Fonts"; 181 | 182 | /* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "R4o-n2-Eq4"; */ 183 | "R4o-n2-Eq4.title" = "Zoom"; 184 | 185 | /* Class = "NSMenuItem"; title = "\tRight to Left"; ObjectID = "RB4-Sm-HuC"; */ 186 | "RB4-Sm-HuC.title" = "\tRight to Left"; 187 | 188 | /* Class = "NSMenuItem"; title = "Superscript"; ObjectID = "Rqc-34-cIF"; */ 189 | "Rqc-34-cIF.title" = "Superscript"; 190 | 191 | /* Class = "NSMenuItem"; title = "Select All"; ObjectID = "Ruw-6m-B2m"; */ 192 | "Ruw-6m-B2m.title" = "Select All"; 193 | 194 | /* Class = "NSMenuItem"; title = "Jump to Selection"; ObjectID = "S0p-oC-mLd"; */ 195 | "S0p-oC-mLd.title" = "Jump to Selection"; 196 | 197 | /* Class = "NSMenu"; title = "Window"; ObjectID = "Td7-aD-5lo"; */ 198 | "Td7-aD-5lo.title" = "Window"; 199 | 200 | /* Class = "NSMenuItem"; title = "Capitalize"; ObjectID = "UEZ-Bs-lqG"; */ 201 | "UEZ-Bs-lqG.title" = "Capitalize"; 202 | 203 | /* Class = "NSMenuItem"; title = "Center"; ObjectID = "VIY-Ag-zcb"; */ 204 | "VIY-Ag-zcb.title" = "Center"; 205 | 206 | /* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "Vdr-fp-XzO"; */ 207 | "Vdr-fp-XzO.title" = "Hide Others"; 208 | 209 | /* Class = "NSMenuItem"; title = "Italic"; ObjectID = "Vjx-xi-njq"; */ 210 | "Vjx-xi-njq.title" = "Italic"; 211 | 212 | /* Class = "NSMenu"; title = "Edit"; ObjectID = "W48-6f-4Dl"; */ 213 | "W48-6f-4Dl.title" = "Edit"; 214 | 215 | /* Class = "NSMenuItem"; title = "Underline"; ObjectID = "WRG-CD-K1S"; */ 216 | "WRG-CD-K1S.title" = "Underline"; 217 | 218 | /* Class = "NSMenuItem"; title = "New"; ObjectID = "Was-JA-tGl"; */ 219 | "Was-JA-tGl.title" = "New"; 220 | 221 | /* Class = "NSMenuItem"; title = "Paste and Match Style"; ObjectID = "WeT-3V-zwk"; */ 222 | "WeT-3V-zwk.title" = "Paste and Match Style"; 223 | 224 | /* Class = "NSMenuItem"; title = "Find…"; ObjectID = "Xz5-n4-O0W"; */ 225 | "Xz5-n4-O0W.title" = "Find…"; 226 | 227 | /* Class = "NSMenuItem"; title = "Find and Replace…"; ObjectID = "YEy-JH-Tfz"; */ 228 | "YEy-JH-Tfz.title" = "Find and Replace…"; 229 | 230 | /* Class = "NSMenuItem"; title = "\tDefault"; ObjectID = "YGs-j5-SAR"; */ 231 | "YGs-j5-SAR.title" = "\tDefault"; 232 | 233 | /* Class = "NSMenuItem"; title = "Start Speaking"; ObjectID = "Ynk-f8-cLZ"; */ 234 | "Ynk-f8-cLZ.title" = "Start Speaking"; 235 | 236 | /* Class = "NSMenuItem"; title = "Align Left"; ObjectID = "ZM1-6Q-yy1"; */ 237 | "ZM1-6Q-yy1.title" = "Align Left"; 238 | 239 | /* Class = "NSMenuItem"; title = "Paragraph"; ObjectID = "ZvO-Gk-QUH"; */ 240 | "ZvO-Gk-QUH.title" = "Paragraph"; 241 | 242 | /* Class = "NSMenuItem"; title = "Print…"; ObjectID = "aTl-1u-JFS"; */ 243 | "aTl-1u-JFS.title" = "Print…"; 244 | 245 | /* Class = "NSMenuItem"; title = "Window"; ObjectID = "aUF-d1-5bR"; */ 246 | "aUF-d1-5bR.title" = "Window"; 247 | 248 | /* Class = "NSMenu"; title = "Font"; ObjectID = "aXa-aM-Jaq"; */ 249 | "aXa-aM-Jaq.title" = "Font"; 250 | 251 | /* Class = "NSMenuItem"; title = "Use Default"; ObjectID = "agt-UL-0e3"; */ 252 | "agt-UL-0e3.title" = "Use Default"; 253 | 254 | /* Class = "NSMenuItem"; title = "Show Colors"; ObjectID = "bgn-CT-cEk"; */ 255 | "bgn-CT-cEk.title" = "Show Colors"; 256 | 257 | /* Class = "NSMenu"; title = "File"; ObjectID = "bib-Uj-vzu"; */ 258 | "bib-Uj-vzu.title" = "File"; 259 | 260 | /* Class = "NSMenuItem"; title = "Use Selection for Find"; ObjectID = "buJ-ug-pKt"; */ 261 | "buJ-ug-pKt.title" = "Use Selection for Find"; 262 | 263 | /* Class = "NSMenu"; title = "Transformations"; ObjectID = "c8a-y6-VQd"; */ 264 | "c8a-y6-VQd.title" = "Transformations"; 265 | 266 | /* Class = "NSMenuItem"; title = "Use None"; ObjectID = "cDB-IK-hbR"; */ 267 | "cDB-IK-hbR.title" = "Use None"; 268 | 269 | /* Class = "NSMenuItem"; title = "Selection"; ObjectID = "cqv-fj-IhA"; */ 270 | "cqv-fj-IhA.title" = "Selection"; 271 | 272 | /* Class = "NSMenuItem"; title = "Smart Links"; ObjectID = "cwL-P1-jid"; */ 273 | "cwL-P1-jid.title" = "Smart Links"; 274 | 275 | /* Class = "NSMenuItem"; title = "Make Lower Case"; ObjectID = "d9M-CD-aMd"; */ 276 | "d9M-CD-aMd.title" = "Make Lower Case"; 277 | 278 | /* Class = "NSMenu"; title = "Text"; ObjectID = "d9c-me-L2H"; */ 279 | "d9c-me-L2H.title" = "Text"; 280 | 281 | /* Class = "NSMenuItem"; title = "File"; ObjectID = "dMs-cI-mzQ"; */ 282 | "dMs-cI-mzQ.title" = "File"; 283 | 284 | /* Class = "NSMenuItem"; title = "Undo"; ObjectID = "dRJ-4n-Yzg"; */ 285 | "dRJ-4n-Yzg.title" = "Undo"; 286 | 287 | /* Class = "NSMenuItem"; title = "Paste"; ObjectID = "gVA-U4-sdL"; */ 288 | "gVA-U4-sdL.title" = "Paste"; 289 | 290 | /* Class = "NSMenuItem"; title = "Smart Quotes"; ObjectID = "hQb-2v-fYv"; */ 291 | "hQb-2v-fYv.title" = "Smart Quotes"; 292 | 293 | /* Class = "NSMenuItem"; title = "Check Document Now"; ObjectID = "hz2-CU-CR7"; */ 294 | "hz2-CU-CR7.title" = "Check Document Now"; 295 | 296 | /* Class = "NSMenu"; title = "Services"; ObjectID = "hz9-B4-Xy5"; */ 297 | "hz9-B4-Xy5.title" = "Services"; 298 | 299 | /* Class = "NSMenuItem"; title = "Smaller"; ObjectID = "i1d-Er-qST"; */ 300 | "i1d-Er-qST.title" = "Smaller"; 301 | 302 | /* Class = "NSMenu"; title = "Baseline"; ObjectID = "ijk-EB-dga"; */ 303 | "ijk-EB-dga.title" = "Baseline"; 304 | 305 | /* Class = "NSMenuItem"; title = "Kern"; ObjectID = "jBQ-r6-VK2"; */ 306 | "jBQ-r6-VK2.title" = "Kern"; 307 | 308 | /* Class = "NSMenuItem"; title = "\tRight to Left"; ObjectID = "jFq-tB-4Kx"; */ 309 | "jFq-tB-4Kx.title" = "\tRight to Left"; 310 | 311 | /* Class = "NSMenuItem"; title = "Format"; ObjectID = "jxT-CU-nIS"; */ 312 | "jxT-CU-nIS.title" = "Format"; 313 | 314 | /* Class = "NSMenuItem"; title = "Show Sidebar"; ObjectID = "kIP-vf-haE"; */ 315 | "kIP-vf-haE.title" = "Show Sidebar"; 316 | 317 | /* Class = "NSMenuItem"; title = "Check Grammar With Spelling"; ObjectID = "mK6-2p-4JG"; */ 318 | "mK6-2p-4JG.title" = "Check Grammar With Spelling"; 319 | 320 | /* Class = "NSMenuItem"; title = "Ligatures"; ObjectID = "o6e-r0-MWq"; */ 321 | "o6e-r0-MWq.title" = "Ligatures"; 322 | 323 | /* Class = "NSMenu"; title = "Open Recent"; ObjectID = "oas-Oc-fiZ"; */ 324 | "oas-Oc-fiZ.title" = "Open Recent"; 325 | 326 | /* Class = "NSMenuItem"; title = "Loosen"; ObjectID = "ogc-rX-tC1"; */ 327 | "ogc-rX-tC1.title" = "Loosen"; 328 | 329 | /* Class = "NSMenuItem"; title = "Delete"; ObjectID = "pa3-QI-u2k"; */ 330 | "pa3-QI-u2k.title" = "Delete"; 331 | 332 | /* Class = "NSMenuItem"; title = "Save…"; ObjectID = "pxx-59-PXV"; */ 333 | "pxx-59-PXV.title" = "Save…"; 334 | 335 | /* Class = "NSMenuItem"; title = "Find Next"; ObjectID = "q09-fT-Sye"; */ 336 | "q09-fT-Sye.title" = "Find Next"; 337 | 338 | /* Class = "NSMenuItem"; title = "Page Setup…"; ObjectID = "qIS-W8-SiK"; */ 339 | "qIS-W8-SiK.title" = "Page Setup…"; 340 | 341 | /* Class = "NSMenuItem"; title = "Check Spelling While Typing"; ObjectID = "rbD-Rh-wIN"; */ 342 | "rbD-Rh-wIN.title" = "Check Spelling While Typing"; 343 | 344 | /* Class = "NSMenuItem"; title = "Smart Dashes"; ObjectID = "rgM-f4-ycn"; */ 345 | "rgM-f4-ycn.title" = "Smart Dashes"; 346 | 347 | /* Class = "NSMenuItem"; title = "Show Toolbar"; ObjectID = "snW-S8-Cw5"; */ 348 | "snW-S8-Cw5.title" = "Show Toolbar"; 349 | 350 | /* Class = "NSMenuItem"; title = "Data Detectors"; ObjectID = "tRr-pd-1PS"; */ 351 | "tRr-pd-1PS.title" = "Data Detectors"; 352 | 353 | /* Class = "NSMenuItem"; title = "Open Recent"; ObjectID = "tXI-mr-wws"; */ 354 | "tXI-mr-wws.title" = "Open Recent"; 355 | 356 | /* Class = "NSMenu"; title = "Kern"; ObjectID = "tlD-Oa-oAM"; */ 357 | "tlD-Oa-oAM.title" = "Kern"; 358 | 359 | /* Class = "NSMenu"; title = "test"; ObjectID = "uQy-DD-JDr"; */ 360 | "uQy-DD-JDr.title" = "test"; 361 | 362 | /* Class = "NSMenuItem"; title = "Cut"; ObjectID = "uRl-iY-unG"; */ 363 | "uRl-iY-unG.title" = "Cut"; 364 | 365 | /* Class = "NSMenuItem"; title = "Paste Style"; ObjectID = "vKC-jM-MkH"; */ 366 | "vKC-jM-MkH.title" = "Paste Style"; 367 | 368 | /* Class = "NSMenuItem"; title = "Show Ruler"; ObjectID = "vLm-3I-IUL"; */ 369 | "vLm-3I-IUL.title" = "Show Ruler"; 370 | 371 | /* Class = "NSMenuItem"; title = "Clear Menu"; ObjectID = "vNY-rz-j42"; */ 372 | "vNY-rz-j42.title" = "Clear Menu"; 373 | 374 | /* Class = "NSMenuItem"; title = "Make Upper Case"; ObjectID = "vmV-6d-7jI"; */ 375 | "vmV-6d-7jI.title" = "Make Upper Case"; 376 | 377 | /* Class = "NSMenu"; title = "Ligatures"; ObjectID = "w0m-vy-SC9"; */ 378 | "w0m-vy-SC9.title" = "Ligatures"; 379 | 380 | /* Class = "NSMenuItem"; title = "Align Right"; ObjectID = "wb2-vD-lq4"; */ 381 | "wb2-vD-lq4.title" = "Align Right"; 382 | 383 | /* Class = "NSMenuItem"; title = "Help"; ObjectID = "wpr-3q-Mcd"; */ 384 | "wpr-3q-Mcd.title" = "Help"; 385 | 386 | /* Class = "NSMenuItem"; title = "Copy"; ObjectID = "x3v-GG-iWU"; */ 387 | "x3v-GG-iWU.title" = "Copy"; 388 | 389 | /* Class = "NSMenuItem"; title = "Use All"; ObjectID = "xQD-1f-W4t"; */ 390 | "xQD-1f-W4t.title" = "Use All"; 391 | 392 | /* Class = "NSMenuItem"; title = "Speech"; ObjectID = "xrE-MZ-jX0"; */ 393 | "xrE-MZ-jX0.title" = "Speech"; 394 | 395 | /* Class = "NSMenuItem"; title = "Show Substitutions"; ObjectID = "z6F-FW-3nz"; */ 396 | "z6F-FW-3nz.title" = "Show Substitutions"; 397 | -------------------------------------------------------------------------------- /SideButtonFixer/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 4 | // SensibleSideButtons, a utility that fixes the navigation buttons on third-party mice in macOS 5 | // Copyright (C) 2018 Alexei Baboulevitch (ssb@archagon.net) 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | // 21 | 22 | #import 23 | 24 | int main(int argc, const char * argv[]) { 25 | return NSApplicationMain(argc, argv); 26 | } 27 | -------------------------------------------------------------------------------- /SwipeSimulator.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4E9995151EE7172700A1CFA6 /* TouchEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECC16A21EE54D870062AC72 /* TouchEvents.c */; }; 11 | 4EC7C3B91EE711B400C9F725 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EC7C3B81EE711B400C9F725 /* AppDelegate.m */; }; 12 | 4EC7C3BE1EE711B400C9F725 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4EC7C3BD1EE711B400C9F725 /* Assets.xcassets */; }; 13 | 4EC7C3C41EE711B400C9F725 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EC7C3C31EE711B400C9F725 /* main.m */; }; 14 | 4ECC169A1EE54D3D0062AC72 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECC16991EE54D3D0062AC72 /* main.m */; }; 15 | 4ECC16AB1EE54D870062AC72 /* TouchEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECC16A21EE54D870062AC72 /* TouchEvents.c */; }; 16 | 4EF1B3A31EE71DC40075438A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4EF1B39F1EE71D690075438A /* Main.storyboard */; }; 17 | 4EF68AE21EE55A9500F6B0E8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECC16991EE54D3D0062AC72 /* main.m */; }; 18 | 4EF68AE31EE55A9500F6B0E8 /* TouchEvents.c in Sources */ = {isa = PBXBuildFile; fileRef = 4ECC16A21EE54D870062AC72 /* TouchEvents.c */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | 4ECC16941EE54D3D0062AC72 /* CopyFiles */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = /usr/share/man/man1/; 26 | dstSubfolderSpec = 0; 27 | files = ( 28 | ); 29 | runOnlyForDeploymentPostprocessing = 1; 30 | }; 31 | 4EF68AE51EE55A9500F6B0E8 /* CopyFiles */ = { 32 | isa = PBXCopyFilesBuildPhase; 33 | buildActionMask = 2147483647; 34 | dstPath = /usr/share/man/man1/; 35 | dstSubfolderSpec = 0; 36 | files = ( 37 | ); 38 | runOnlyForDeploymentPostprocessing = 1; 39 | }; 40 | /* End PBXCopyFilesBuildPhase section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 4EC7C3B51EE711B400C9F725 /* SideButtonFixer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = SideButtonFixer.app; path = SensibleSideButtons.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 4EC7C3B71EE711B400C9F725 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 45 | 4EC7C3B81EE711B400C9F725 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 46 | 4EC7C3BD1EE711B400C9F725 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 4EC7C3C21EE711B400C9F725 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 4EC7C3C31EE711B400C9F725 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 4EC7C3C51EE711B400C9F725 /* SideButtonFixer.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SideButtonFixer.entitlements; sourceTree = ""; }; 50 | 4ECC16961EE54D3D0062AC72 /* swipesiml */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = swipesiml; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 4ECC16991EE54D3D0062AC72 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 4ECC16A21EE54D870062AC72 /* TouchEvents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TouchEvents.c; sourceTree = ""; }; 53 | 4ECC16A31EE54D870062AC72 /* IOHIDEventTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHIDEventTypes.h; sourceTree = ""; }; 54 | 4ECC16A41EE54D870062AC72 /* IOHIDEventData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHIDEventData.h; sourceTree = ""; }; 55 | 4ECC16A71EE54D870062AC72 /* TouchEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchEvents.h; sourceTree = ""; }; 56 | 4EF1B3A01EE71D690075438A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 4EF68AE91EE55A9500F6B0E8 /* swipesimr */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = swipesimr; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 4EC7C3B21EE711B400C9F725 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 4ECC16931EE54D3D0062AC72 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 4EF68AE41EE55A9500F6B0E8 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | 4EC7C3B61EE711B400C9F725 /* SideButtonFixer */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 4EC7C3B71EE711B400C9F725 /* AppDelegate.h */, 89 | 4EC7C3B81EE711B400C9F725 /* AppDelegate.m */, 90 | 4EC7C3BD1EE711B400C9F725 /* Assets.xcassets */, 91 | 4EC7C3C21EE711B400C9F725 /* Info.plist */, 92 | 4EC7C3C31EE711B400C9F725 /* main.m */, 93 | 4EF1B39F1EE71D690075438A /* Main.storyboard */, 94 | 4EC7C3C51EE711B400C9F725 /* SideButtonFixer.entitlements */, 95 | ); 96 | path = SideButtonFixer; 97 | sourceTree = ""; 98 | }; 99 | 4ECC168D1EE54D3D0062AC72 = { 100 | isa = PBXGroup; 101 | children = ( 102 | 4ECC16981EE54D3D0062AC72 /* SwipeSimulator */, 103 | 4EC7C3B61EE711B400C9F725 /* SideButtonFixer */, 104 | 4ECC16A01EE54D790062AC72 /* External */, 105 | 4ECC16971EE54D3D0062AC72 /* Products */, 106 | ); 107 | sourceTree = ""; 108 | }; 109 | 4ECC16971EE54D3D0062AC72 /* Products */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 4ECC16961EE54D3D0062AC72 /* swipesiml */, 113 | 4EF68AE91EE55A9500F6B0E8 /* swipesimr */, 114 | 4EC7C3B51EE711B400C9F725 /* SideButtonFixer.app */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 4ECC16981EE54D3D0062AC72 /* SwipeSimulator */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 4ECC16991EE54D3D0062AC72 /* main.m */, 123 | ); 124 | path = SwipeSimulator; 125 | sourceTree = ""; 126 | }; 127 | 4ECC16A01EE54D790062AC72 /* External */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 4ECC16A71EE54D870062AC72 /* TouchEvents.h */, 131 | 4ECC16A21EE54D870062AC72 /* TouchEvents.c */, 132 | 4ECC16A31EE54D870062AC72 /* IOHIDEventTypes.h */, 133 | 4ECC16A41EE54D870062AC72 /* IOHIDEventData.h */, 134 | ); 135 | path = External; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 4EC7C3B41EE711B400C9F725 /* SensibleSideButtons */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 4EC7C3C81EE711B400C9F725 /* Build configuration list for PBXNativeTarget "SensibleSideButtons" */; 144 | buildPhases = ( 145 | 4EC7C3B11EE711B400C9F725 /* Sources */, 146 | 4EC7C3B21EE711B400C9F725 /* Frameworks */, 147 | 4EC7C3B31EE711B400C9F725 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = SensibleSideButtons; 154 | productName = SideButtonFixer; 155 | productReference = 4EC7C3B51EE711B400C9F725 /* SideButtonFixer.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | 4ECC16951EE54D3D0062AC72 /* swipesiml */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 4ECC169D1EE54D3D0062AC72 /* Build configuration list for PBXNativeTarget "swipesiml" */; 161 | buildPhases = ( 162 | 4ECC16921EE54D3D0062AC72 /* Sources */, 163 | 4ECC16931EE54D3D0062AC72 /* Frameworks */, 164 | 4ECC16941EE54D3D0062AC72 /* CopyFiles */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = swipesiml; 171 | productName = SwipeSimulator; 172 | productReference = 4ECC16961EE54D3D0062AC72 /* swipesiml */; 173 | productType = "com.apple.product-type.tool"; 174 | }; 175 | 4EF68AE01EE55A9500F6B0E8 /* swipesimr */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 4EF68AE61EE55A9500F6B0E8 /* Build configuration list for PBXNativeTarget "swipesimr" */; 178 | buildPhases = ( 179 | 4EF68AE11EE55A9500F6B0E8 /* Sources */, 180 | 4EF68AE41EE55A9500F6B0E8 /* Frameworks */, 181 | 4EF68AE51EE55A9500F6B0E8 /* CopyFiles */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | ); 187 | name = swipesimr; 188 | productName = SwipeSimulator; 189 | productReference = 4EF68AE91EE55A9500F6B0E8 /* swipesimr */; 190 | productType = "com.apple.product-type.tool"; 191 | }; 192 | /* End PBXNativeTarget section */ 193 | 194 | /* Begin PBXProject section */ 195 | 4ECC168E1EE54D3D0062AC72 /* Project object */ = { 196 | isa = PBXProject; 197 | attributes = { 198 | LastUpgradeCheck = 0830; 199 | ORGANIZATIONNAME = "Alexei Baboulevitch"; 200 | TargetAttributes = { 201 | 4EC7C3B41EE711B400C9F725 = { 202 | CreatedOnToolsVersion = 9.0; 203 | DevelopmentTeam = R4MX2B96J2; 204 | ProvisioningStyle = Automatic; 205 | SystemCapabilities = { 206 | com.apple.Sandbox = { 207 | enabled = 0; 208 | }; 209 | }; 210 | }; 211 | 4ECC16951EE54D3D0062AC72 = { 212 | CreatedOnToolsVersion = 8.3.1; 213 | DevelopmentTeam = R4MX2B96J2; 214 | ProvisioningStyle = Automatic; 215 | }; 216 | 4EF68AE01EE55A9500F6B0E8 = { 217 | DevelopmentTeam = R4MX2B96J2; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = 4ECC16911EE54D3D0062AC72 /* Build configuration list for PBXProject "SwipeSimulator" */; 222 | compatibilityVersion = "Xcode 3.2"; 223 | developmentRegion = English; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = 4ECC168D1EE54D3D0062AC72; 230 | productRefGroup = 4ECC16971EE54D3D0062AC72 /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 4ECC16951EE54D3D0062AC72 /* swipesiml */, 235 | 4EF68AE01EE55A9500F6B0E8 /* swipesimr */, 236 | 4EC7C3B41EE711B400C9F725 /* SensibleSideButtons */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 4EC7C3B31EE711B400C9F725 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 4EC7C3BE1EE711B400C9F725 /* Assets.xcassets in Resources */, 247 | 4EF1B3A31EE71DC40075438A /* Main.storyboard in Resources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXResourcesBuildPhase section */ 252 | 253 | /* Begin PBXSourcesBuildPhase section */ 254 | 4EC7C3B11EE711B400C9F725 /* Sources */ = { 255 | isa = PBXSourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | 4EC7C3C41EE711B400C9F725 /* main.m in Sources */, 259 | 4E9995151EE7172700A1CFA6 /* TouchEvents.c in Sources */, 260 | 4EC7C3B91EE711B400C9F725 /* AppDelegate.m in Sources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 4ECC16921EE54D3D0062AC72 /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | 4ECC169A1EE54D3D0062AC72 /* main.m in Sources */, 269 | 4ECC16AB1EE54D870062AC72 /* TouchEvents.c in Sources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | 4EF68AE11EE55A9500F6B0E8 /* Sources */ = { 274 | isa = PBXSourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 4EF68AE21EE55A9500F6B0E8 /* main.m in Sources */, 278 | 4EF68AE31EE55A9500F6B0E8 /* TouchEvents.c in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | /* End PBXSourcesBuildPhase section */ 283 | 284 | /* Begin PBXVariantGroup section */ 285 | 4EF1B39F1EE71D690075438A /* Main.storyboard */ = { 286 | isa = PBXVariantGroup; 287 | children = ( 288 | 4EF1B3A01EE71D690075438A /* Base */, 289 | ); 290 | name = Main.storyboard; 291 | sourceTree = ""; 292 | }; 293 | /* End PBXVariantGroup section */ 294 | 295 | /* Begin XCBuildConfiguration section */ 296 | 4EC7C3C61EE711B400C9F725 /* Debug */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 301 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 302 | CLANG_WARN_COMMA = YES; 303 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 304 | CLANG_WARN_STRICT_PROTOTYPES = YES; 305 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 306 | CODE_SIGN_IDENTITY = "Mac Developer"; 307 | CODE_SIGN_STYLE = Automatic; 308 | COMBINE_HIDPI_IMAGES = YES; 309 | DEVELOPMENT_TEAM = R4MX2B96J2; 310 | GCC_C_LANGUAGE_STANDARD = gnu11; 311 | GCC_PREPROCESSOR_DEFINITIONS = ( 312 | "DEBUG=1", 313 | "$(inherited)", 314 | ); 315 | INFOPLIST_FILE = SideButtonFixer/Info.plist; 316 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 317 | MACOSX_DEPLOYMENT_TARGET = 10.10; 318 | PRODUCT_BUNDLE_IDENTIFIER = "net.archagon.sensible-side-buttons"; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | PROVISIONING_PROFILE_SPECIFIER = ""; 321 | }; 322 | name = Debug; 323 | }; 324 | 4EC7C3C71EE711B400C9F725 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 332 | CLANG_WARN_STRICT_PROTOTYPES = YES; 333 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 334 | CODE_SIGN_IDENTITY = "Mac Developer"; 335 | CODE_SIGN_STYLE = Automatic; 336 | COMBINE_HIDPI_IMAGES = YES; 337 | DEVELOPMENT_TEAM = R4MX2B96J2; 338 | GCC_C_LANGUAGE_STANDARD = gnu11; 339 | INFOPLIST_FILE = SideButtonFixer/Info.plist; 340 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 341 | MACOSX_DEPLOYMENT_TARGET = 10.10; 342 | PRODUCT_BUNDLE_IDENTIFIER = "net.archagon.sensible-side-buttons"; 343 | PRODUCT_NAME = "$(TARGET_NAME)"; 344 | PROVISIONING_PROFILE_SPECIFIER = ""; 345 | }; 346 | name = Release; 347 | }; 348 | 4ECC169B1EE54D3D0062AC72 /* Debug */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | ALWAYS_SEARCH_USER_PATHS = NO; 352 | CLANG_ANALYZER_NONNULL = YES; 353 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 355 | CLANG_CXX_LIBRARY = "libc++"; 356 | CLANG_ENABLE_MODULES = YES; 357 | CLANG_ENABLE_OBJC_ARC = YES; 358 | CLANG_WARN_BOOL_CONVERSION = YES; 359 | CLANG_WARN_CONSTANT_CONVERSION = YES; 360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 361 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 362 | CLANG_WARN_EMPTY_BODY = YES; 363 | CLANG_WARN_ENUM_CONVERSION = YES; 364 | CLANG_WARN_INFINITE_RECURSION = YES; 365 | CLANG_WARN_INT_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | CODE_SIGN_IDENTITY = "-"; 371 | COPY_PHASE_STRIP = NO; 372 | DEBUG_INFORMATION_FORMAT = dwarf; 373 | ENABLE_STRICT_OBJC_MSGSEND = YES; 374 | ENABLE_TESTABILITY = YES; 375 | GCC_C_LANGUAGE_STANDARD = gnu99; 376 | GCC_DYNAMIC_NO_PIC = NO; 377 | GCC_NO_COMMON_BLOCKS = YES; 378 | GCC_OPTIMIZATION_LEVEL = 0; 379 | GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | MACOSX_DEPLOYMENT_TARGET = 10.12; 387 | MTL_ENABLE_DEBUG_INFO = YES; 388 | ONLY_ACTIVE_ARCH = YES; 389 | SDKROOT = macosx; 390 | }; 391 | name = Debug; 392 | }; 393 | 4ECC169C1EE54D3D0062AC72 /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ALWAYS_SEARCH_USER_PATHS = NO; 397 | CLANG_ANALYZER_NONNULL = YES; 398 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 399 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 400 | CLANG_CXX_LIBRARY = "libc++"; 401 | CLANG_ENABLE_MODULES = YES; 402 | CLANG_ENABLE_OBJC_ARC = YES; 403 | CLANG_WARN_BOOL_CONVERSION = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 407 | CLANG_WARN_EMPTY_BODY = YES; 408 | CLANG_WARN_ENUM_CONVERSION = YES; 409 | CLANG_WARN_INFINITE_RECURSION = YES; 410 | CLANG_WARN_INT_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 413 | CLANG_WARN_UNREACHABLE_CODE = YES; 414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 415 | CODE_SIGN_IDENTITY = "-"; 416 | COPY_PHASE_STRIP = NO; 417 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 418 | ENABLE_NS_ASSERTIONS = NO; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | GCC_C_LANGUAGE_STANDARD = gnu99; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_PREPROCESSOR_DEFINITIONS = ""; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | MACOSX_DEPLOYMENT_TARGET = 10.12; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | SDKROOT = macosx; 432 | }; 433 | name = Release; 434 | }; 435 | 4ECC169E1EE54D3D0062AC72 /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | DEVELOPMENT_TEAM = R4MX2B96J2; 439 | FRAMEWORK_SEARCH_PATHS = ( 440 | "$(inherited)", 441 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 442 | ); 443 | GCC_PREPROCESSOR_DEFINITIONS = ( 444 | "LEFT=1", 445 | "DEBUG=1", 446 | ); 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | }; 449 | name = Debug; 450 | }; 451 | 4ECC169F1EE54D3D0062AC72 /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | DEVELOPMENT_TEAM = R4MX2B96J2; 455 | FRAMEWORK_SEARCH_PATHS = ( 456 | "$(inherited)", 457 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 458 | ); 459 | GCC_PREPROCESSOR_DEFINITIONS = "LEFT=1"; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | }; 462 | name = Release; 463 | }; 464 | 4EF68AE71EE55A9500F6B0E8 /* Debug */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | DEVELOPMENT_TEAM = R4MX2B96J2; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 471 | ); 472 | GCC_PREPROCESSOR_DEFINITIONS = ( 473 | "RIGHT=1", 474 | "DEBUG=1", 475 | ); 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | }; 478 | name = Debug; 479 | }; 480 | 4EF68AE81EE55A9500F6B0E8 /* Release */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | DEVELOPMENT_TEAM = R4MX2B96J2; 484 | FRAMEWORK_SEARCH_PATHS = ( 485 | "$(inherited)", 486 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 487 | ); 488 | GCC_PREPROCESSOR_DEFINITIONS = "RIGHT=1"; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | }; 491 | name = Release; 492 | }; 493 | /* End XCBuildConfiguration section */ 494 | 495 | /* Begin XCConfigurationList section */ 496 | 4EC7C3C81EE711B400C9F725 /* Build configuration list for PBXNativeTarget "SensibleSideButtons" */ = { 497 | isa = XCConfigurationList; 498 | buildConfigurations = ( 499 | 4EC7C3C61EE711B400C9F725 /* Debug */, 500 | 4EC7C3C71EE711B400C9F725 /* Release */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 4ECC16911EE54D3D0062AC72 /* Build configuration list for PBXProject "SwipeSimulator" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 4ECC169B1EE54D3D0062AC72 /* Debug */, 509 | 4ECC169C1EE54D3D0062AC72 /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | 4ECC169D1EE54D3D0062AC72 /* Build configuration list for PBXNativeTarget "swipesiml" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 4ECC169E1EE54D3D0062AC72 /* Debug */, 518 | 4ECC169F1EE54D3D0062AC72 /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | defaultConfigurationName = Release; 522 | }; 523 | 4EF68AE61EE55A9500F6B0E8 /* Build configuration list for PBXNativeTarget "swipesimr" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 4EF68AE71EE55A9500F6B0E8 /* Debug */, 527 | 4EF68AE81EE55A9500F6B0E8 /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | /* End XCConfigurationList section */ 533 | }; 534 | rootObject = 4ECC168E1EE54D3D0062AC72 /* Project object */; 535 | } 536 | -------------------------------------------------------------------------------- /SwipeSimulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwipeSimulator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwipeSimulator/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 4 | // SensibleSideButtons, a utility that fixes the navigation buttons on third-party mice in macOS 5 | // Copyright (C) 2018 Alexei Baboulevitch (ssb@archagon.net) 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | // 21 | 22 | #import 23 | #import "TouchEvents.h" 24 | 25 | int main(int argc, const char * argv[]) { 26 | @autoreleasepool { 27 | #ifdef LEFT 28 | TLInfoSwipeDirection dir = kTLInfoSwipeLeft; 29 | #else 30 | TLInfoSwipeDirection dir = kTLInfoSwipeRight; 31 | #endif 32 | 33 | NSDictionary* swipeInfo1 = [NSDictionary dictionaryWithObjectsAndKeys: 34 | @(kTLInfoSubtypeSwipe), kTLInfoKeyGestureSubtype, 35 | @(1), kTLInfoKeyGesturePhase, 36 | nil]; 37 | 38 | NSDictionary* swipeInfo2 = [NSDictionary dictionaryWithObjectsAndKeys: 39 | @(kTLInfoSubtypeSwipe), kTLInfoKeyGestureSubtype, 40 | @(dir), kTLInfoKeySwipeDirection, 41 | @(4), kTLInfoKeyGesturePhase, 42 | nil]; 43 | 44 | CGEventRef event1 = tl_CGEventCreateFromGesture((__bridge CFDictionaryRef)(swipeInfo1), (__bridge CFArrayRef)@[]); 45 | CGEventRef event2 = tl_CGEventCreateFromGesture((__bridge CFDictionaryRef)(swipeInfo2), (__bridge CFArrayRef)@[]); 46 | 47 | CFRetain(event1); 48 | CFRetain(event2); 49 | 50 | CGEventPost(kCGHIDEventTap, event1); 51 | CGEventPost(kCGHIDEventTap, event2); 52 | 53 | CFRelease(event1); 54 | CFRelease(event2); 55 | 56 | NSLog(@"sent event"); 57 | 58 | // in order to complete, we have to wait 59 | //usleep(1000000); 60 | usleep(1000000/128); 61 | 62 | //NSLog(@"done"); 63 | } 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archagon/sensible-side-buttons/4c1e946615356dc9cf50b414bfdec852762e7f2d/icon.png -------------------------------------------------------------------------------- /techsteps.txt: -------------------------------------------------------------------------------- 1 | Just some release and debugging stuff to jog my memory. -AB 2 | 3 | Exporting app: 4 | 5 | 1. archive 6 | 2. "Export" -> "Developer ID" 7 | 8 | Creating DMG: 9 | 10 | 1. convert previous .dmg with Disk Utility to read/write 11 | 2. replace SensibleSideButtons.app with the new one 12 | 3. re-convert the .dmg 13 | 14 | Verifying certificate: 15 | 16 | 1. codesign -dvvv SensibleSideButtons.app 17 | 2. codesign --verify --deep --strict --verbose=2 SensibleSideButtons.app 18 | 3. https://developer.apple.com/library/content/technotes/tn2206/_index.html 19 | 20 | Managing defaults: 21 | 22 | 1. defaults read net.archagon.sensible-side-buttons 23 | 2. defaults delete net.archagon.sensible-side-buttons 24 | --------------------------------------------------------------------------------