fix mouse events in osx

This commit is contained in:
2017-02-16 01:47:00 +00:00
parent d74af8ed17
commit 1c14a6d409

View File

@@ -195,17 +195,17 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
- (void)mouseDown:(NSEvent *)theEvent
{
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_down(0, mouseLoc.x, mouseLoc.y);
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
}
- (void)mouseUp:(NSEvent *)theEvent
{
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_up(0, mouseLoc.x, mouseLoc.y);
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
}
- (void)mouseMoved:(NSEvent *)theEvent
{
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, mouseLoc.y);
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1);
}
@end
@@ -261,6 +261,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
[window center];
[window makeKeyAndOrderFront:controller];
[window setContentView:view];
[window setAcceptsMouseMovedEvents:true];
[window makeFirstResponder:view];
controller = [[Controller alloc] initWithWindow:window];