Skip to content

Commit 3054a5c

Browse files
committed
fix(mac): Revert MacOS mouse position change
1 parent 6deee9d commit 3054a5c

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [v4.2.0-beta.13] - 2025-01-01
9+
10+
### Changed
11+
12+
- Target Geode version (v4.0.1 -> v4.1.2)
13+
14+
### Fixed
15+
16+
- Unable to click on input on MacOS
17+
818
## [v4.2.0-beta.12] - 2024-12-04
919

1020
### Added

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"geode": "4.0.1",
2+
"geode": "4.1.2",
33
"gd": {
44
"win": "2.2074",
55
"mac": "2.2074"
66
},
7-
"version": "v4.2.0-beta.12",
7+
"version": "v4.2.0-beta.13",
88
"id": "spaghettdev.betterinputs",
99
"name": "BetterInputs",
1010
"developer": "SpaghettDev",

src/macos.mm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,17 @@ inline bool keyDown(PlatformKey key, NSEvent* event)
3737

3838
namespace cocos
3939
{
40-
inline cocos2d::CCPoint getMousePosition(NSEvent* event)
41-
{
42-
auto windowFrame = [[event window] frame];
43-
auto viewFrame = [[[event window] contentView] frame];
44-
auto winSize = cocos2d::CCDirector::get()->getWinSize();
45-
auto scaleFactor = cocos2d::CCPoint(winSize) / ccp(viewFrame.size.width, viewFrame.size.height);
46-
auto mouse = [event locationInWindow];
47-
48-
return ccp(mouse.x - windowFrame.origin.x, winSize.height - (mouse.y - windowFrame.origin.y)) * scaleFactor;
49-
}
40+
// TODO: fix
41+
// inline cocos2d::CCPoint getMousePosition(NSEvent* event)
42+
// {
43+
// auto windowFrame = [[event window] frame];
44+
// auto viewFrame = [[[event window] contentView] frame];
45+
// auto winSize = cocos2d::CCDirector::get()->getWinSize();
46+
// auto scaleFactor = cocos2d::CCPoint(winSize) / ccp(viewFrame.size.width, viewFrame.size.height);
47+
// auto mouse = [event locationInWindow];
48+
49+
// return ccp(mouse.x - windowFrame.origin.x, winSize.height - (mouse.y - windowFrame.origin.y)) * scaleFactor;
50+
// }
5051
}
5152
}
5253

src/utils.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,20 @@ namespace BI
9999

100100
namespace cocos
101101
{
102-
#ifdef GEODE_IS_WINDOWS
103102
inline cocos2d::CCPoint getMousePosition()
104103
{
104+
#ifdef GEODE_IS_WINDOWS
105105
auto* director = cocos2d::CCDirector::sharedDirector();
106106
auto* gl = director->getOpenGLView();
107107
auto winSize = director->getWinSize();
108108
auto frameSize = gl->getFrameSize();
109109
auto mouse = gl->getMousePosition() / frameSize;
110110

111111
return cocos2d::CCPoint{ mouse.x, 1.f - mouse.y } * winSize;
112-
}
112+
#elif defined(GEODE_IS_MACOS)
113+
return geode::cocos::getMousePos();
113114
#endif
115+
}
114116

115117
inline bool isPositionInNode(cocos2d::CCNode* node, const cocos2d::CCPoint& pos)
116118
{

0 commit comments

Comments
 (0)