mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Merge pull request #95 from shurcooL/master
Added support for Cocoa precise scrolling deltas.
This commit is contained in:
commit
53cf4a3b4d
@ -112,6 +112,7 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
|
|||||||
returned by `glfwGetProcAddress`
|
returned by `glfwGetProcAddress`
|
||||||
- [Win32] Bugfix: The user32 and dwmapi module handles were not freed on
|
- [Win32] Bugfix: The user32 and dwmapi module handles were not freed on
|
||||||
library termination
|
library termination
|
||||||
|
- [Cocoa] Changed scroll callback to use precise scrolling deltas when available
|
||||||
- [Cocoa] Enabled explicit creation of OpenGL 3.x and 4.x contexts as supported
|
- [Cocoa] Enabled explicit creation of OpenGL 3.x and 4.x contexts as supported
|
||||||
by OS X 10.9
|
by OS X 10.9
|
||||||
- [Cocoa] Bugfix: The clipboard string was not freed on terminate
|
- [Cocoa] Bugfix: The clipboard string was not freed on terminate
|
||||||
|
@ -560,7 +560,7 @@ static int translateKey(unsigned int key)
|
|||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
|
|
||||||
[self addTrackingArea:trackingArea];
|
[self addTrackingArea:trackingArea];
|
||||||
[super updateTrackingAreas];
|
[super updateTrackingAreas];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent *)event
|
- (void)keyDown:(NSEvent *)event
|
||||||
@ -606,8 +606,27 @@ static int translateKey(unsigned int key)
|
|||||||
|
|
||||||
- (void)scrollWheel:(NSEvent *)event
|
- (void)scrollWheel:(NSEvent *)event
|
||||||
{
|
{
|
||||||
double deltaX = [event deltaX];
|
double deltaX, deltaY;
|
||||||
double deltaY = [event deltaY];
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
if ([event respondsToSelector:@selector(hasPreciseScrollingDeltas:)])
|
||||||
|
{
|
||||||
|
deltaX = [event scrollingDeltaX];
|
||||||
|
deltaY = [event scrollingDeltaY];
|
||||||
|
|
||||||
|
if ([event hasPreciseScrollingDeltas])
|
||||||
|
{
|
||||||
|
deltaX *= 0.1;
|
||||||
|
deltaY *= 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
deltaX = [event deltaX];
|
||||||
|
deltaY = [event deltaY];
|
||||||
|
}
|
||||||
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
|
||||||
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
|
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
|
||||||
_glfwInputScroll(window, deltaX, deltaY);
|
_glfwInputScroll(window, deltaX, deltaY);
|
||||||
|
Loading…
Reference in New Issue
Block a user