Intuitive mouse dragging on views supporting selection, improved click-through behaviour

This commit is contained in:
Vas Crabb 2015-02-17 21:21:43 +11:00
parent 22d84e0b21
commit 00ec6889f2

View File

@ -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())