summaryrefslogtreecommitdiffstats
path: root/views/events
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 21:35:48 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 21:35:48 +0000
commit9a6ee3bc91dbb302c73f2355236466cacfeb604f (patch)
treef5c15b3cd852ef5f0735ec825d34dd767cda9994 /views/events
parent9833514789f079b3d8353ce2cf43ec64e4e92b69 (diff)
downloadchromium_src-9a6ee3bc91dbb302c73f2355236466cacfeb604f.zip
chromium_src-9a6ee3bc91dbb302c73f2355236466cacfeb604f.tar.gz
chromium_src-9a6ee3bc91dbb302c73f2355236466cacfeb604f.tar.bz2
Remove RootView::ConvertPointToMouseHandler.
The function does not seem to do what it claims to do, and it does not seem to be actually necessary at all. Remove some other unused event constructors. BUG=chromium-os:14715 TEST=none Review URL: http://codereview.chromium.org/6883293 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/events')
-rw-r--r--views/events/event.cc24
-rw-r--r--views/events/event.h21
-rw-r--r--views/events/event_x.cc12
3 files changed, 8 insertions, 49 deletions
diff --git a/views/events/event.cc b/views/events/event.cc
index ac3bd2a..3247087 100644
--- a/views/events/event.cc
+++ b/views/events/event.cc
@@ -172,15 +172,6 @@ uint16 KeyEvent::GetCharacterFromKeyCode(ui::KeyboardCode key_code, int flags) {
////////////////////////////////////////////////////////////////////////////////
// MouseEvent, public:
-// TODO(msw): Kill this legacy constructor when we update uses.
-MouseEvent::MouseEvent(ui::EventType type,
- View* source,
- View* target,
- const gfx::Point &l,
- int flags)
- : LocatedEvent(MouseEvent(type, l.x(), l.y(), flags), source, target) {
-}
-
MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target)
: LocatedEvent(model, source, target) {
}
@@ -189,21 +180,6 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target)
// TouchEvent, public:
#if defined(TOUCH_UI)
-TouchEvent::TouchEvent(ui::EventType type,
- int x,
- int y,
- int flags,
- int touch_id,
- float radius,
- float angle,
- float ratio)
- : LocatedEvent(type, gfx::Point(x, y), flags),
- touch_id_(touch_id),
- radius_(radius),
- angle_(angle),
- ratio_(ratio) {
-}
-
TouchEvent::TouchEvent(const TouchEvent& model, View* source, View* target)
: LocatedEvent(model, source, target),
touch_id_(model.touch_id_),
diff --git a/views/events/event.h b/views/events/event.h
index 12e2e2f..7b67310 100644
--- a/views/events/event.h
+++ b/views/events/event.h
@@ -99,6 +99,7 @@ class Event {
Event(const Event& model)
: native_event_(model.native_event()),
+ native_event_2_(model.native_event_2()),
type_(model.type()),
time_stamp_(model.time_stamp()),
flags_(model.flags()) {
@@ -176,16 +177,6 @@ class MouseEvent : public LocatedEvent {
: LocatedEvent(type, gfx::Point(x, y), flags) {
}
- // TODO(msw): Kill this legacy constructor when we update uses.
- // Create a new mouse event from a type and a point. If source / target views
- // are provided, the point will be converted from |source| coordinate system
- // to |target| coordinate system.
- MouseEvent(ui::EventType type,
- View* source,
- View* target,
- const gfx::Point &l,
- int flags);
-
// Conveniences to quickly test what button is down
bool IsOnlyLeftMouseButton() const {
return (flags() & ui::EF_LEFT_BUTTON_DOWN) &&
@@ -239,16 +230,6 @@ class TouchEvent : public LocatedEvent {
public:
TouchEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
- // Create a new touch event.
- TouchEvent(ui::EventType type,
- int x,
- int y,
- int flags,
- int touch_id,
- float radius,
- float angle,
- float ratio);
-
// Create a new TouchEvent which is identical to the provided model.
// If source / target views are provided, the model location will be converted
// from |source| coordinate system to |target| coordinate system.
diff --git a/views/events/event_x.cc b/views/events/event_x.cc
index 65a1281..5441282 100644
--- a/views/events/event_x.cc
+++ b/views/events/event_x.cc
@@ -137,6 +137,8 @@ ui::EventType EventTypeFromNative(NativeEvent2 native_event) {
case GenericEvent: {
XIDeviceEvent* xievent =
static_cast<XIDeviceEvent*>(native_event->xcookie.data);
+ if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid))
+ return GetTouchEventType(native_event);
switch (xievent->evtype) {
case XI_ButtonPress:
return (xievent->detail == 4 || xievent->detail == 5) ?
@@ -189,7 +191,7 @@ gfx::Point GetEventLocation(XEvent* xev) {
return gfx::Point();
}
-int GetLocatedEventFlags(XEvent* xev, bool touch) {
+int GetLocatedEventFlags(XEvent* xev) {
switch (xev->type) {
case ButtonPress:
case ButtonRelease:
@@ -202,6 +204,8 @@ int GetLocatedEventFlags(XEvent* xev, bool touch) {
#if defined(HAVE_XINPUT2)
case GenericEvent: {
XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data);
+ bool touch =
+ TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid);
switch (xievent->evtype) {
case XI_ButtonPress:
case XI_ButtonRelease:
@@ -298,7 +302,7 @@ LocatedEvent::LocatedEvent(NativeEvent2 native_event_2,
FromNativeEvent2 from_native)
: Event(native_event_2,
EventTypeFromNative(native_event_2),
- GetLocatedEventFlags(native_event_2, false),
+ GetLocatedEventFlags(native_event_2),
from_native),
location_(GetEventLocation(native_event_2)) {
}
@@ -368,9 +372,7 @@ MouseWheelEvent::MouseWheelEvent(NativeEvent2 native_event_2,
#if defined(HAVE_XINPUT2)
TouchEvent::TouchEvent(NativeEvent2 native_event_2,
FromNativeEvent2 from_native)
- : LocatedEvent(GetTouchEventType(native_event_2),
- GetEventLocation(native_event_2),
- GetLocatedEventFlags(native_event_2, true)),
+ : LocatedEvent(native_event_2, from_native),
touch_id_(GetTouchIDFromXEvent(native_event_2)),
radius_(GetTouchRadiusFromXEvent(native_event_2)),
angle_(GetTouchAngleFromXEvent(native_event_2)),