diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/haiku/PlatformMouseEventHaiku.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/haiku/PlatformMouseEventHaiku.cpp')
-rw-r--r-- | WebCore/platform/haiku/PlatformMouseEventHaiku.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp b/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp index d212f8b..f1051a5 100644 --- a/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp +++ b/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> * * All rights reserved. * @@ -30,36 +31,30 @@ #include "PlatformMouseEvent.h" #include <Message.h> -#include <SupportDefs.h> - +#include <View.h> namespace WebCore { PlatformMouseEvent::PlatformMouseEvent(const BMessage* message) - : m_timestamp(message->FindInt64("when")) - , m_position(IntPoint(message->FindPoint("where"))) - , m_globalPosition(message->FindPoint("globalPosition")) - , m_shiftKey(false) - , m_ctrlKey(false) - , m_altKey(false) - , m_metaKey(false) + : m_position(message->FindPoint("be:view_where")) + , m_globalPosition(message->FindPoint("screen_where")) , m_clickCount(message->FindInt32("clicks")) + , m_timestamp(message->FindInt64("when") / 1000000.0) { - int32 buttons = message->FindInt32("buttons"); - switch (buttons) { - case 1: + int32 buttons = 0; + if (message->what == B_MOUSE_UP) + message->FindInt32("previous buttons", &buttons); + else + message->FindInt32("buttons", &buttons); + + if (buttons & B_PRIMARY_MOUSE_BUTTON) m_button = LeftButton; - break; - case 2: + else if (buttons & B_SECONDARY_MOUSE_BUTTON) m_button = RightButton; - break; - case 3: + else if (buttons & B_TERTIARY_MOUSE_BUTTON) m_button = MiddleButton; - break; - default: + else m_button = NoButton; - break; - }; switch (message->what) { case B_MOUSE_DOWN: @@ -67,15 +62,18 @@ PlatformMouseEvent::PlatformMouseEvent(const BMessage* message) break; case B_MOUSE_UP: m_eventType = MouseEventReleased; - m_button = LeftButton; // FIXME: Webcore wants to know the button released but we don't know. break; case B_MOUSE_MOVED: - m_eventType = MouseEventMoved; - break; default: m_eventType = MouseEventMoved; break; }; + + int32 modifiers = message->FindInt32("modifiers"); + m_shiftKey = modifiers & B_SHIFT_KEY; + m_ctrlKey = modifiers & B_CONTROL_KEY; + m_altKey = modifiers & B_COMMAND_KEY; + m_metaKey = modifiers & B_OPTION_KEY; } } // namespace WebCore |