Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2882)

Unified Diff: chrome/browser/chrome_application_mac.mm

Issue 300002: Short-circuit events rwhvmac if it's focussed. (Closed)
Patch Set: refine Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/chrome_event_processing_window.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_application_mac.mm
diff --git a/chrome/browser/chrome_application_mac.mm b/chrome/browser/chrome_application_mac.mm
index aece9a0bdba395179933ea77530e233a5c1acc64..d9b5eb4ec48ea9dfbe710061e9364c53b8a08216 100644
--- a/chrome/browser/chrome_application_mac.mm
+++ b/chrome/browser/chrome_application_mac.mm
@@ -8,6 +8,7 @@
#import "base/logging.h"
#import "base/scoped_nsobject.h"
#import "chrome/app/breakpad_mac.h"
+#import "chrome/browser/renderer_host/render_widget_host_view_mac.h"
namespace CrApplicationNSException {
@@ -184,6 +185,29 @@ class ScopedCrashKey {
return [super sendAction:anAction to:aTarget from:sender];
}
+- (void)sendEvent:(NSEvent*)event {
Mark Mentovai 2009/10/22 20:44:36 This change may have regressed startup time, but t
+ // The superclass's |sendEvent:| sends keyboard events to the menu and the key
+ // view loop before dispatching them to |keyDown:|. Since we want to send keys
+ // to the renderer before sending them to the menu, and we never want them to
+ // the kev view loop when the web is focussed, we change this behavior.
+ if ([event type] == NSKeyDown || [event type] == NSKeyUp) {
pink (ping after 24hrs) 2009/10/19 15:18:24 I really dislike the app controller having this ki
Nico 2009/10/19 20:06:43 I'm addressing this comment (and more) in http://c
+ if ([[[self keyWindow] firstResponder]
+ isKindOfClass:[RenderWidgetHostViewCocoa class]]) {
+ // No other mac browser sends keyup() for keyboard equivalents, so let's
+ // suppress this.
+ if (([event modifierFlags] & NSCommandKeyMask) && [event type] == NSKeyUp)
+ return;
+
+ RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>(
+ [[self keyWindow] firstResponder]);
+ [rwhv keyEvent:event];
+ return;
+ }
+ }
+
+ [super sendEvent:event];
+}
+
// NSExceptions which are caught by the event loop are logged here.
// NSException uses setjmp/longjmp, which can be very bad for C++, so
// we attempt to track and report them.
« no previous file with comments | « no previous file | chrome/browser/cocoa/chrome_event_processing_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698