fix mouse events in osx
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user