mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Updated Cocoa port to new internal API.
This commit is contained in:
parent
c4bd93ecdf
commit
35b8ee6a71
@ -109,15 +109,12 @@
|
|||||||
|
|
||||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfwLibrary.activeWindow = window;
|
_glfwInputWindowFocus(window, GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignKey:(NSNotification *)notification
|
- (void)windowDidResignKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if (window == _glfwLibrary.activeWindow)
|
_glfwInputWindowFocus(window, GL_FALSE);
|
||||||
_glfwLibrary.activeWindow = NULL;
|
|
||||||
|
|
||||||
_glfwInputDeactivation(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -449,11 +446,14 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
|||||||
|
|
||||||
- (void)scrollWheel:(NSEvent *)event
|
- (void)scrollWheel:(NSEvent *)event
|
||||||
{
|
{
|
||||||
window->NS.wheelPosFloating += [event deltaY];
|
double deltaX = window->NS.fracScrollX + [event deltaX];
|
||||||
window->wheelPos = lrint(window->NS.wheelPosFloating);
|
double deltaY = window->NS.fracScrollY + [event deltaY];
|
||||||
|
|
||||||
if (window->mouseWheelCallback)
|
if ((int) deltaX || (int) deltaY)
|
||||||
window->mouseWheelCallback(window, window->wheelPos);
|
_glfwInputScroll(window, (int) deltaX, (int) deltaY);
|
||||||
|
|
||||||
|
window->NS.fracScrollX = (int) (deltaX - floor(deltaX));
|
||||||
|
window->NS.fracScrollY = (int) (deltaY - floor(deltaY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -85,7 +85,8 @@ typedef struct _GLFWwindowNS
|
|||||||
id window;
|
id window;
|
||||||
id delegate;
|
id delegate;
|
||||||
unsigned int modifierFlags;
|
unsigned int modifierFlags;
|
||||||
double wheelPosFloating;
|
double fracScrollX;
|
||||||
|
double fracScrollY;
|
||||||
} _GLFWwindowNS;
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user