From 73c63d87685b2d184b04c9fb84364fde586ecb0d Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 20 Sep 2019 18:22:14 +0200 Subject: [PATCH] (Cocoa) Add mouse down events --- ui/drivers/ui_cocoa.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 836f3b092d..3422cb93bf 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -207,6 +207,21 @@ static void app_terminate(void) #endif /* TODO/FIXME - properly implement. */ break; + case NSEventTypeLeftMouseDown: + case NSEventTypeRightMouseDown: + case NSEventTypeOtherMouseDown: + { +#ifdef HAVE_COCOA_METAL + NSPoint pos = [apple_platform.renderView convertPoint:[event locationInWindow] fromView:nil]; +#else + NSPoint pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil]; +#endif + apple = (cocoa_input_data_t*)input_driver_get_data(); + if (!apple || pos.y < 0) + return; + apple->mouse_buttons |= (1 << event.buttonNumber); + } + break; case NSEventTypeLeftMouseUp: case NSEventTypeRightMouseUp: case NSEventTypeOtherMouseUp: