Commit b150da68 authored by sadrul@chromium.org's avatar sadrul@chromium.org

views: Some code cleanup: touch-events are not used to generate mouse-events anymore.

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10154005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133901 0039d316-1c4b-4281-b951-d872f2087c98
parent 2dd0cdba
...@@ -98,41 +98,6 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target) ...@@ -98,41 +98,6 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target)
: LocatedEvent(model, source, target) { : LocatedEvent(model, source, target) {
} }
MouseEvent::MouseEvent(const TouchEvent& touch)
: LocatedEvent(touch.native_event()) {
// The location of the event is correctly extracted from the native event. But
// it is necessary to update the event type.
ui::EventType mtype = ui::ET_UNKNOWN;
switch (touch.type()) {
case ui::ET_TOUCH_RELEASED:
mtype = ui::ET_MOUSE_RELEASED;
break;
case ui::ET_TOUCH_PRESSED:
mtype = ui::ET_MOUSE_PRESSED;
break;
case ui::ET_TOUCH_MOVED:
mtype = ui::ET_MOUSE_MOVED;
break;
default:
NOTREACHED() << "Invalid mouse event.";
}
set_type(mtype);
// It may not be possible to extract the button-information necessary for a
// MouseEvent from the native event for a TouchEvent, so the flags are
// explicitly updated as well. The button is approximated from the touchpoint
// identity.
int new_flags = flags() & ~(ui::EF_LEFT_MOUSE_BUTTON |
ui::EF_RIGHT_MOUSE_BUTTON |
ui::EF_MIDDLE_MOUSE_BUTTON);
int button = ui::EF_LEFT_MOUSE_BUTTON;
if (touch.identity() == 1)
button = ui::EF_RIGHT_MOUSE_BUTTON;
else if (touch.identity() == 2)
button = ui::EF_MIDDLE_MOUSE_BUTTON;
set_flags(new_flags | button);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// MouseWheelEvent, public: // MouseWheelEvent, public:
......
...@@ -142,8 +142,6 @@ class VIEWS_EXPORT LocatedEvent : public Event { ...@@ -142,8 +142,6 @@ class VIEWS_EXPORT LocatedEvent : public Event {
gfx::Point location_; gfx::Point location_;
}; };
class TouchEvent;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// MouseEvent class // MouseEvent class
...@@ -159,13 +157,6 @@ class VIEWS_EXPORT MouseEvent : public LocatedEvent { ...@@ -159,13 +157,6 @@ class VIEWS_EXPORT MouseEvent : public LocatedEvent {
// from |source| coordinate system to |target| coordinate system. // from |source| coordinate system to |target| coordinate system.
MouseEvent(const MouseEvent& model, View* source, View* target); MouseEvent(const MouseEvent& model, View* source, View* target);
// Creates a new MouseEvent from a TouchEvent. The location of the TouchEvent
// is the same as the MouseEvent. Other attributes (e.g. type, flags) are
// mapped from the TouchEvent to appropriate MouseEvent attributes.
// GestureManager uses this to convert TouchEvents that are not handled by any
// view.
explicit MouseEvent(const TouchEvent& touch);
// TODO(msw): Kill this legacy constructor when we update uses. // TODO(msw): Kill this legacy constructor when we update uses.
// Create a new mouse event // Create a new mouse event
MouseEvent(ui::EventType type, int x, int y, int flags) MouseEvent(ui::EventType type, int x, int y, int flags)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment