implement canvas touch lock

This commit is contained in:
2017-08-19 13:18:35 +01:00
parent ac3857b697
commit da4bfff69b
12 changed files with 56 additions and 27 deletions

View File

@@ -214,49 +214,49 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)rightMouseDown:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_down(1, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
App::I.mouse_down(1, mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)mouseUp:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_up(1, mouseLoc.x, App::I.height - mouseLoc.y - 1);
App::I.mouse_up(1, mouseLoc.x, App::I.height - mouseLoc.y - 1, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)mouseMoved:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
-(void)mouseDragged:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)rightMouseDragged:(NSEvent *)theEvent
{
CGLLockContext([[self openGLContext] CGLContextObj]);
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure);
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, theEvent.pressure, kEventSource::Mouse);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
- (void)scrollWheel:(NSEvent *)theEvent