Skip to content

Commit

Permalink
Change from Objective-C to C
Browse files Browse the repository at this point in the history
  • Loading branch information
emreyolcu committed Oct 7, 2023
1 parent 209a48e commit 7b88f04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions PixelScroll.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
C3FC4D7920B9CA1900E1BE93 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3FC4D7820B9CA1900E1BE93 /* main.m */; };
C3FC4D7920B9CA1900E1BE93 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = C3FC4D7820B9CA1900E1BE93 /* main.c */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
C3FC4D7020B9CA1900E1BE93 /* PixelScroll.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PixelScroll.app; sourceTree = BUILT_PRODUCTS_DIR; };
C3FC4D7420B9CA1900E1BE93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C3FC4D7820B9CA1900E1BE93 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C3FC4D7820B9CA1900E1BE93 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -47,7 +47,7 @@
isa = PBXGroup;
children = (
C3FC4D7420B9CA1900E1BE93 /* Info.plist */,
C3FC4D7820B9CA1900E1BE93 /* main.m */,
C3FC4D7820B9CA1900E1BE93 /* main.c */,
);
path = PixelScroll;
sourceTree = "<group>";
Expand Down Expand Up @@ -119,7 +119,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3FC4D7920B9CA1900E1BE93 /* main.m in Sources */,
C3FC4D7920B9CA1900E1BE93 /* main.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 2 additions & 3 deletions PixelScroll/main.m → PixelScroll/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <ApplicationServices/ApplicationServices.h>
#include <ApplicationServices/ApplicationServices.h>

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

Expand Down Expand Up @@ -37,8 +37,7 @@ CGEventRef cgEventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef e
int32_t deltaY = (int32_t)CGEventGetIntegerValueField(event, kCGMouseEventDeltaY);

CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventRef scrollEvent = CGEventCreateScrollWheelEvent(source, kCGScrollEventUnitPixel, 2,
-SCALE * deltaY, -SCALE * deltaX);
CGEventRef scrollEvent = CGEventCreateScrollWheelEvent(source, kCGScrollEventUnitPixel, 2, -SCALE * deltaY, -SCALE * deltaX);

CGEventPost(kCGSessionEventTap, scrollEvent);

Expand Down

0 comments on commit 7b88f04

Please sign in to comment.