Skip to content

Commit 6deee9d

Browse files
committed
faet(mac): Convert macro argument to string and fix wrong event member name
1 parent 6093ca6 commit 6deee9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/macos.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ inline bool keyDown(PlatformKey key, NSEvent* event)
4343
auto viewFrame = [[[event window] contentView] frame];
4444
auto winSize = cocos2d::CCDirector::get()->getWinSize();
4545
auto scaleFactor = cocos2d::CCPoint(winSize) / ccp(viewFrame.size.width, viewFrame.size.height);
46-
auto mouse = [event locationInView];
46+
auto mouse = [event locationInWindow];
4747

4848
return ccp(mouse.x - windowFrame.origin.x, winSize.height - (mouse.y - windowFrame.origin.y)) * scaleFactor;
4949
}
@@ -52,7 +52,7 @@ inline bool keyDown(PlatformKey key, NSEvent* event)
5252

5353
#define HOOK_OBJC_METHOD(klass, type, cleanFuncName, funcName) \
5454
do { \
55-
auto cleanFuncName ## Method = class_getInstanceMethod(objc_getClass(klass), @selector(funcName)); \
55+
auto cleanFuncName ## Method = class_getInstanceMethod(objc_getClass(#klass), @selector(funcName)); \
5656
cleanFuncName ## OIMP = reinterpret_cast<type>(method_getImplementation(cleanFuncName ## Method)); \
5757
method_setImplementation(cleanFuncName ## Method, reinterpret_cast<IMP>(&cleanFuncName)); \
5858
geode::log::debug("Hooked Objective C Method '" #klass " " #funcName "'"); \

0 commit comments

Comments
 (0)