summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 20:58:46 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 20:58:46 +0000
commitef77dc138e27f5f143589a4c27ca760e0ac2d079 (patch)
treeec74891830751da7980641ac99d9ebd58d00ad6c /chrome/browser/cocoa
parentd48f1e0c85c0fda7e02a9f5d6e99740cc37b47b9 (diff)
downloadchromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.zip
chromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.tar.gz
chromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.tar.bz2
Pump events to the renderer. Doesn't work currently due to activation issues.
Review URL: http://codereview.chromium.org/21306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/event_view.h25
-rw-r--r--chrome/browser/cocoa/event_view.mm99
2 files changed, 124 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/event_view.h b/chrome/browser/cocoa/event_view.h
new file mode 100644
index 0000000..fc49232
--- /dev/null
+++ b/chrome/browser/cocoa/event_view.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_COCOA_EVENT_VIEW_H_
+#define CHROME_BROWSER_COCOA_EVENT_VIEW_H_
+
+#import <Cocoa/Cocoa.h>
+
+// A view that registers for mouse move events, and funnels all events.
+
+@interface EventView : NSView {
+ @private
+ NSTrackingArea *trackingArea_;
+}
+
+- (id)initWithFrame:(NSRect)frame;
+
+// Override these methods in a subclass.
+- (void)mouseEvent:(NSEvent *)theEvent;
+- (void)keyEvent:(NSEvent *)theEvent;
+
+@end
+
+#endif // CHROME_BROWSER_COCOA_EVENT_VIEW_H_
diff --git a/chrome/browser/cocoa/event_view.mm b/chrome/browser/cocoa/event_view.mm
new file mode 100644
index 0000000..3cb4c44
--- /dev/null
+++ b/chrome/browser/cocoa/event_view.mm
@@ -0,0 +1,99 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/cocoa/event_view.h"
+
+@implementation EventView
+
+- (id)initWithFrame:(NSRect)frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ trackingArea_ =
+ [[NSTrackingArea alloc] initWithRect:frame
+ options:NSTrackingMouseMoved |
+ NSTrackingActiveInActiveApp |
+ NSTrackingInVisibleRect
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea_];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [self removeTrackingArea:trackingArea_];
+ [trackingArea_ release];
+
+ [super dealloc];
+}
+
+- (void)mouseEvent:(NSEvent *)theEvent {
+ // This method left intentionally blank.
+}
+
+- (void)keyEvent:(NSEvent *)theEvent {
+ // This method left intentionally blank.
+}
+
+- (void)mouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseMoved:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseEntered:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseExited:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)keyDown:(NSEvent *)theEvent {
+ [self keyEvent:theEvent];
+}
+
+- (void)keyUp:(NSEvent *)theEvent {
+ [self keyEvent:theEvent];
+}
+
+- (BOOL)isOpaque {
+ return YES;
+}
+
+@end