From 00ec6889f2f8e0fa0eab8aa461266488a21965b5 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 17 Feb 2015 21:21:43 +1100 Subject: [PATCH] Intuitive mouse dragging on views supporting selection, improved click-through behaviour --- src/osd/modules/debugger/osx/debugview.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/osd/modules/debugger/osx/debugview.m b/src/osd/modules/debugger/osx/debugview.m index 8ce77b59cc3..7182ac3ee5c 100644 --- a/src/osd/modules/debugger/osx/debugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -432,7 +432,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)mouseDown:(NSEvent *)event { NSPoint const location = [self convertPoint:[event locationInWindow] fromView:nil]; NSUInteger const modifiers = [event modifierFlags]; - view->process_click((modifiers & NSCommandKeyMask) ? DCK_RIGHT_CLICK + view->process_click(((modifiers & NSCommandKeyMask) && [[self window] isMainWindow]) ? DCK_RIGHT_CLICK : (modifiers & NSAlternateKeyMask) ? DCK_MIDDLE_CLICK : DCK_LEFT_CLICK, [self convertLocation:location]); @@ -440,6 +440,20 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) } +- (void)mouseDragged:(NSEvent *)event { + NSPoint const location = [self convertPoint:[event locationInWindow] fromView:nil]; + NSUInteger const modifiers = [event modifierFlags]; + if (view->cursor_supported() + && !(modifiers & NSAlternateKeyMask) + && (!(modifiers & NSCommandKeyMask) || ![[self window] isMainWindow])) + { + view->set_cursor_position([self convertLocation:location]); + view->set_cursor_visible(true); + [self setNeedsDisplay:YES]; + } +} + + - (void)rightMouseDown:(NSEvent *)event { NSPoint const location = [self convertPoint:[event locationInWindow] fromView:nil]; if (view->cursor_supported())