From 2f79b079fda0110bdafb84ef8b91e08de10a3c65 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Thu, 20 Aug 2015 16:14:14 -0700 Subject: [PATCH] New: default menu system is now disable for every right click except for the CPTextField Previously, when making a right click and when a cappuccino menu was not displayed, the system menu was displayed. Now we don't display this menu anymore as in cocoa. We only display when making a right click on a CPTextField. --- AppKit/CPTextField.j | 8 ++++++++ AppKit/CPView.j | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 92142fc26..00894190e 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -1050,6 +1050,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); } } +- (void)rightMouseDown:(CPEvent)anEvent +{ + if ([self menuForEvent:anEvent] || [[self nextResponder] isKindOfClass:CPView]) + [super rightMouseDown:anEvent]; + else + [[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:YES]; +} + - (void)mouseDragged:(CPEvent)anEvent { if (![self isEnabled] || !([self isSelectable] || [self isEditable])) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index cd589a28b..d40d1ad6f 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -1831,7 +1831,7 @@ var CPViewHighDPIDrawingEnabled = YES; else if ([[self nextResponder] isKindOfClass:CPView]) [super rightMouseDown:anEvent]; else - [[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:YES]; + [[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:NO]; } - (CPMenu)menuForEvent:(CPEvent)anEvent