diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-24 17:41:34 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-24 17:41:34 +0000 |
commit | 044dc48ab959e37a5f9960a46e7ffeeaf201fb54 (patch) | |
tree | 25d3b3fb7ecb5bbcf3836fb293f2265c1d9a7fbb /webkit/glue/webinputevent_mac.mm | |
parent | ab6513714d7bd8e5b13d99f89c2bff468b8dcce5 (diff) | |
download | chromium_src-044dc48ab959e37a5f9960a46e7ffeeaf201fb54.zip chromium_src-044dc48ab959e37a5f9960a46e7ffeeaf201fb54.tar.gz chromium_src-044dc48ab959e37a5f9960a46e7ffeeaf201fb54.tar.bz2 |
Hook up mouse events with the correct coordinates. Make sure they are view-local and flipped.
Review URL: http://codereview.chromium.org/8150
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webinputevent_mac.mm')
-rw-r--r-- | webkit/glue/webinputevent_mac.mm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/webkit/glue/webinputevent_mac.mm b/webkit/glue/webinputevent_mac.mm index 0355bcc..8fc524d 100644 --- a/webkit/glue/webinputevent_mac.mm +++ b/webkit/glue/webinputevent_mac.mm @@ -17,7 +17,7 @@ static const unsigned long kDefaultScrollLinesPerWheelDelta = 3; // WebMouseEvent -------------------------------------------------------------- -WebMouseEvent::WebMouseEvent(NSEvent *event) { +WebMouseEvent::WebMouseEvent(NSEvent *event, NSView* view) { switch ([event type]) { case NSMouseExited: type = MOUSE_LEAVE; @@ -72,9 +72,10 @@ WebMouseEvent::WebMouseEvent(NSEvent *event) { global_x = location.x; global_y = location.y; - location = [event locationInWindow]; // local (to receiving window) + NSPoint windowLocal = [event locationInWindow]; + location = [view convertPoint:windowLocal fromView:nil]; + y = [view frame].size.height - location.y; // flip y x = location.x; - y = location.y; // set modifiers: @@ -95,7 +96,7 @@ WebMouseEvent::WebMouseEvent(NSEvent *event) { // WebMouseWheelEvent --------------------------------------------------------- -WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event) { +WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event, NSView* view) { type = MOUSE_WHEEL; button = BUTTON_NONE; @@ -103,9 +104,10 @@ WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event) { global_x = location.x; global_y = location.y; - location = [event locationInWindow]; // local (to receiving window) + NSPoint windowLocal = [event locationInWindow]; + location = [view convertPoint:windowLocal fromView:nil]; + y = [view frame].size.height - location.y; // flip y x = location.x; - y = location.y; int wheel_delta = [event deltaY]; const int delta_lines = wheel_delta * kDefaultScrollLinesPerWheelDelta; |