Skip to content

Commit 4bfdc6b

Browse files
committed
Initial commit
0 parents  commit 4bfdc6b

7 files changed

Lines changed: 370 additions & 0 deletions

File tree

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
build/
2+
DerivedData/
3+
4+
*.pbxuser
5+
!default.pbxuser
6+
*.mode1v3
7+
!default.mode1v3
8+
*.mode2v3
9+
!default.mode2v3
10+
*.perspectivev3
11+
!default.perspectivev3
12+
xcuserdata/
13+
14+
*.moved-aside
15+
*.xcuserstate
16+
17+
*.hmap
18+
*.ipa
19+
*.dSYM.zip
20+
*.dSYM
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
C32391431DE7B5670068C5B9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C32391421DE7B5670068C5B9 /* main.m */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXFileReference section */
14+
C323913A1DE7B5670068C5B9 /* DiscreteScroll.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DiscreteScroll.app; sourceTree = BUILT_PRODUCTS_DIR; };
15+
C323913E1DE7B5670068C5B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
16+
C32391421DE7B5670068C5B9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
17+
/* End PBXFileReference section */
18+
19+
/* Begin PBXFrameworksBuildPhase section */
20+
C32391371DE7B5670068C5B9 /* Frameworks */ = {
21+
isa = PBXFrameworksBuildPhase;
22+
buildActionMask = 2147483647;
23+
files = (
24+
);
25+
runOnlyForDeploymentPostprocessing = 0;
26+
};
27+
/* End PBXFrameworksBuildPhase section */
28+
29+
/* Begin PBXGroup section */
30+
C32391311DE7B5670068C5B9 = {
31+
isa = PBXGroup;
32+
children = (
33+
C323913C1DE7B5670068C5B9 /* DiscreteScroll */,
34+
C323913B1DE7B5670068C5B9 /* Products */,
35+
);
36+
sourceTree = "<group>";
37+
};
38+
C323913B1DE7B5670068C5B9 /* Products */ = {
39+
isa = PBXGroup;
40+
children = (
41+
C323913A1DE7B5670068C5B9 /* DiscreteScroll.app */,
42+
);
43+
name = Products;
44+
sourceTree = "<group>";
45+
};
46+
C323913C1DE7B5670068C5B9 /* DiscreteScroll */ = {
47+
isa = PBXGroup;
48+
children = (
49+
C32391421DE7B5670068C5B9 /* main.m */,
50+
C323913E1DE7B5670068C5B9 /* Info.plist */,
51+
);
52+
path = DiscreteScroll;
53+
sourceTree = "<group>";
54+
};
55+
/* End PBXGroup section */
56+
57+
/* Begin PBXNativeTarget section */
58+
C32391391DE7B5670068C5B9 /* DiscreteScroll */ = {
59+
isa = PBXNativeTarget;
60+
buildConfigurationList = C32391571DE7B5670068C5B9 /* Build configuration list for PBXNativeTarget "DiscreteScroll" */;
61+
buildPhases = (
62+
C32391361DE7B5670068C5B9 /* Sources */,
63+
C32391371DE7B5670068C5B9 /* Frameworks */,
64+
C32391381DE7B5670068C5B9 /* Resources */,
65+
);
66+
buildRules = (
67+
);
68+
dependencies = (
69+
);
70+
name = DiscreteScroll;
71+
productName = DiscreteScroll;
72+
productReference = C323913A1DE7B5670068C5B9 /* DiscreteScroll.app */;
73+
productType = "com.apple.product-type.application";
74+
};
75+
/* End PBXNativeTarget section */
76+
77+
/* Begin PBXProject section */
78+
C32391321DE7B5670068C5B9 /* Project object */ = {
79+
isa = PBXProject;
80+
attributes = {
81+
LastUpgradeCheck = 0620;
82+
ORGANIZATIONNAME = "Emre Yolcu";
83+
TargetAttributes = {
84+
C32391391DE7B5670068C5B9 = {
85+
CreatedOnToolsVersion = 6.2;
86+
};
87+
};
88+
};
89+
buildConfigurationList = C32391351DE7B5670068C5B9 /* Build configuration list for PBXProject "DiscreteScroll" */;
90+
compatibilityVersion = "Xcode 3.2";
91+
developmentRegion = English;
92+
hasScannedForEncodings = 0;
93+
knownRegions = (
94+
en,
95+
Base,
96+
);
97+
mainGroup = C32391311DE7B5670068C5B9;
98+
productRefGroup = C323913B1DE7B5670068C5B9 /* Products */;
99+
projectDirPath = "";
100+
projectRoot = "";
101+
targets = (
102+
C32391391DE7B5670068C5B9 /* DiscreteScroll */,
103+
);
104+
};
105+
/* End PBXProject section */
106+
107+
/* Begin PBXResourcesBuildPhase section */
108+
C32391381DE7B5670068C5B9 /* Resources */ = {
109+
isa = PBXResourcesBuildPhase;
110+
buildActionMask = 2147483647;
111+
files = (
112+
);
113+
runOnlyForDeploymentPostprocessing = 0;
114+
};
115+
/* End PBXResourcesBuildPhase section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
C32391361DE7B5670068C5B9 /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
C32391431DE7B5670068C5B9 /* main.m in Sources */,
123+
);
124+
runOnlyForDeploymentPostprocessing = 0;
125+
};
126+
/* End PBXSourcesBuildPhase section */
127+
128+
/* Begin XCBuildConfiguration section */
129+
C32391551DE7B5670068C5B9 /* Debug */ = {
130+
isa = XCBuildConfiguration;
131+
buildSettings = {
132+
ALWAYS_SEARCH_USER_PATHS = NO;
133+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
134+
CLANG_CXX_LIBRARY = "libc++";
135+
CLANG_ENABLE_MODULES = YES;
136+
CLANG_ENABLE_OBJC_ARC = YES;
137+
CLANG_WARN_BOOL_CONVERSION = YES;
138+
CLANG_WARN_CONSTANT_CONVERSION = YES;
139+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140+
CLANG_WARN_EMPTY_BODY = YES;
141+
CLANG_WARN_ENUM_CONVERSION = YES;
142+
CLANG_WARN_INT_CONVERSION = YES;
143+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
144+
CLANG_WARN_UNREACHABLE_CODE = YES;
145+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
146+
CODE_SIGN_IDENTITY = "-";
147+
COPY_PHASE_STRIP = NO;
148+
ENABLE_STRICT_OBJC_MSGSEND = YES;
149+
GCC_C_LANGUAGE_STANDARD = gnu99;
150+
GCC_DYNAMIC_NO_PIC = NO;
151+
GCC_OPTIMIZATION_LEVEL = 0;
152+
GCC_PREPROCESSOR_DEFINITIONS = (
153+
"DEBUG=1",
154+
"$(inherited)",
155+
);
156+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
157+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
158+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
159+
GCC_WARN_UNDECLARED_SELECTOR = YES;
160+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
161+
GCC_WARN_UNUSED_FUNCTION = YES;
162+
GCC_WARN_UNUSED_VARIABLE = YES;
163+
MACOSX_DEPLOYMENT_TARGET = 10.9;
164+
MTL_ENABLE_DEBUG_INFO = YES;
165+
ONLY_ACTIVE_ARCH = YES;
166+
SDKROOT = macosx;
167+
};
168+
name = Debug;
169+
};
170+
C32391561DE7B5670068C5B9 /* Release */ = {
171+
isa = XCBuildConfiguration;
172+
buildSettings = {
173+
ALWAYS_SEARCH_USER_PATHS = NO;
174+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
175+
CLANG_CXX_LIBRARY = "libc++";
176+
CLANG_ENABLE_MODULES = YES;
177+
CLANG_ENABLE_OBJC_ARC = YES;
178+
CLANG_WARN_BOOL_CONVERSION = YES;
179+
CLANG_WARN_CONSTANT_CONVERSION = YES;
180+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
181+
CLANG_WARN_EMPTY_BODY = YES;
182+
CLANG_WARN_ENUM_CONVERSION = YES;
183+
CLANG_WARN_INT_CONVERSION = YES;
184+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
185+
CLANG_WARN_UNREACHABLE_CODE = YES;
186+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
187+
CODE_SIGN_IDENTITY = "-";
188+
COPY_PHASE_STRIP = NO;
189+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
190+
ENABLE_NS_ASSERTIONS = NO;
191+
ENABLE_STRICT_OBJC_MSGSEND = YES;
192+
GCC_C_LANGUAGE_STANDARD = gnu99;
193+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
194+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
195+
GCC_WARN_UNDECLARED_SELECTOR = YES;
196+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
197+
GCC_WARN_UNUSED_FUNCTION = YES;
198+
GCC_WARN_UNUSED_VARIABLE = YES;
199+
MACOSX_DEPLOYMENT_TARGET = 10.9;
200+
MTL_ENABLE_DEBUG_INFO = NO;
201+
SDKROOT = macosx;
202+
};
203+
name = Release;
204+
};
205+
C32391581DE7B5670068C5B9 /* Debug */ = {
206+
isa = XCBuildConfiguration;
207+
buildSettings = {
208+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
209+
COMBINE_HIDPI_IMAGES = YES;
210+
INFOPLIST_FILE = DiscreteScroll/Info.plist;
211+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
212+
PRODUCT_NAME = "$(TARGET_NAME)";
213+
};
214+
name = Debug;
215+
};
216+
C32391591DE7B5670068C5B9 /* Release */ = {
217+
isa = XCBuildConfiguration;
218+
buildSettings = {
219+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
220+
COMBINE_HIDPI_IMAGES = YES;
221+
INFOPLIST_FILE = DiscreteScroll/Info.plist;
222+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
223+
PRODUCT_NAME = "$(TARGET_NAME)";
224+
};
225+
name = Release;
226+
};
227+
/* End XCBuildConfiguration section */
228+
229+
/* Begin XCConfigurationList section */
230+
C32391351DE7B5670068C5B9 /* Build configuration list for PBXProject "DiscreteScroll" */ = {
231+
isa = XCConfigurationList;
232+
buildConfigurations = (
233+
C32391551DE7B5670068C5B9 /* Debug */,
234+
C32391561DE7B5670068C5B9 /* Release */,
235+
);
236+
defaultConfigurationIsVisible = 0;
237+
defaultConfigurationName = Release;
238+
};
239+
C32391571DE7B5670068C5B9 /* Build configuration list for PBXNativeTarget "DiscreteScroll" */ = {
240+
isa = XCConfigurationList;
241+
buildConfigurations = (
242+
C32391581DE7B5670068C5B9 /* Debug */,
243+
C32391591DE7B5670068C5B9 /* Release */,
244+
);
245+
defaultConfigurationIsVisible = 0;
246+
};
247+
/* End XCConfigurationList section */
248+
};
249+
rootObject = C32391321DE7B5670068C5B9 /* Project object */;
250+
}

DiscreteScroll.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DiscreteScroll/Info.plist

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIconFile</key>
10+
<string></string>
11+
<key>CFBundleIdentifier</key>
12+
<string>Emre.$(PRODUCT_NAME:rfc1034identifier)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1</string>
25+
<key>LSMinimumSystemVersion</key>
26+
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
27+
<key>LSUIElement</key>
28+
<true/>
29+
<key>NSHumanReadableCopyright</key>
30+
<string>Copyright © 2016 Emre Yolcu. All rights reserved.</string>
31+
<key>NSMainNibFile</key>
32+
<string>MainMenu</string>
33+
<key>NSPrincipalClass</key>
34+
<string>NSApplication</string>
35+
</dict>
36+
</plist>

DiscreteScroll/main.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#import <ApplicationServices/ApplicationServices.h>
2+
3+
#define SIGN(x) (((x) > 0) - ((x) < 0))
4+
#define LINES 3
5+
6+
CGEventRef cgEventCallback(CGEventTapProxy proxy, CGEventType type,
7+
CGEventRef event, void *refcon)
8+
{
9+
if (!CGEventGetIntegerValueField(event, kCGScrollWheelEventIsContinuous)) {
10+
int64_t delta = CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis1);
11+
12+
CGEventSetIntegerValueField(event, kCGScrollWheelEventDeltaAxis1, SIGN(delta) * LINES);
13+
}
14+
15+
return event;
16+
}
17+
18+
int main(void)
19+
{
20+
CFMachPortRef eventTap;
21+
CFRunLoopSourceRef runLoopSource;
22+
23+
eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0,
24+
1 << kCGEventScrollWheel, cgEventCallback, NULL);
25+
runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0);
26+
27+
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
28+
CGEventTapEnable(eventTap, true);
29+
CFRunLoopRun();
30+
31+
CFRelease(eventTap);
32+
CFRelease(runLoopSource);
33+
34+
return 0;
35+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Emre Yolcu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# discrete-scroll

0 commit comments

Comments
 (0)