diff --git a/PanoPainter-OSX/main.cpp b/PanoPainter-OSX/main.cpp index 04387bd..40daf05 100644 --- a/PanoPainter-OSX/main.cpp +++ b/PanoPainter-OSX/main.cpp @@ -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 diff --git a/PanoPainter/GameViewController.m b/PanoPainter/GameViewController.m index fff09b9..42fe1cf 100644 --- a/PanoPainter/GameViewController.m +++ b/PanoPainter/GameViewController.m @@ -115,7 +115,8 @@ glm::vec2 t_pos; CGPoint touchLocation = [touch locationInView:self.view]; float scale = self.view.contentScaleFactor; - App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, touch.force); + kEventSource source = touch.type == UITouchType::UITouchTypeStylus ? kEventSource::Stylus : kEventSource::Touch; + App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, touch.force, source); t_count = 1; t_pos = {touchLocation.x * scale, touchLocation.y * scale}; } @@ -162,7 +163,8 @@ glm::vec2 t_pos; } else { - App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale, force); + kEventSource source = touch.type == UITouchType::UITouchTypeStylus ? kEventSource::Stylus : kEventSource::Touch; + App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale, force, source); } } t_pos = {tl0.x * scale, tl0.y * scale}; @@ -172,11 +174,13 @@ glm::vec2 t_pos; UITouch *touch = [[event allTouches] anyObject]; CGPoint touchLocation = [touch locationInView:self.view]; float scale = self.view.contentScaleFactor; - + + kEventSource source = touch.type == UITouchType::UITouchTypeStylus ? kEventSource::Stylus : kEventSource::Touch; + if (t_count == 2) App::I.gesture_end(); else - App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale); + App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale, source); t_count = 0; t_pos = {touchLocation.x * scale, touchLocation.y * scale}; } diff --git a/data/layout.xml b/data/layout.xml index 90a2a88..301337f 100644 --- a/data/layout.xml +++ b/data/layout.xml @@ -454,7 +454,8 @@