diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 22:33:46 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 22:33:46 +0000 |
commit | 8e6a45cde3a16754f07584b1f4e231796a3aa55e (patch) | |
tree | d1843159571a7bbed41b9f27b67ebd480d4d3efc /views/focus | |
parent | 22f98ef5aa98b9d7d2d54f2ab9635f6e1d3ed5f9 (diff) | |
download | chromium_src-8e6a45cde3a16754f07584b1f4e231796a3aa55e.zip chromium_src-8e6a45cde3a16754f07584b1f4e231796a3aa55e.tar.gz chromium_src-8e6a45cde3a16754f07584b1f4e231796a3aa55e.tar.bz2 |
Get the correct touch identifiers from an X event.
Getting the correct touch identifiers makes it possible to do multi-finger
tracking.
BUG=none
TEST=manually
Review URL: http://codereview.chromium.org/6905074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r-- | views/focus/accelerator_handler_touch.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc index 2709e70..032b29d 100644 --- a/views/focus/accelerator_handler_touch.cc +++ b/views/focus/accelerator_handler_touch.cc @@ -65,19 +65,32 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) { return widget->OnMouseEvent(wheelev); } - MouseEvent mouseev(xev, from_native); - // TODO(sad): Determine if the captured event is a touch-event. // Is the event coming from a touch device? if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid)) { // Hide the cursor when a touch event comes in. TouchFactory::GetInstance()->SetCursorVisible(false, false); + + // With XInput 2.0, XI_ButtonPress and XI_ButtonRelease events are + // ignored, as XI_Motion events contain enough data to detect finger + // press and release. See more notes in TouchFactory::TouchParam. + if (cookie->evtype == XI_ButtonPress || + cookie->evtype == XI_ButtonRelease) + return false; + // If the TouchEvent is processed by |root|, then return. Otherwise let // it fall through so it can be used as a MouseEvent, if desired. TouchEvent touch(xev, from_native); RootView* root = widget->GetRootView(); if (root->OnTouchEvent(touch) != views::View::TOUCH_STATUS_UNKNOWN) return true; + + // We do not want to generate a mouse event for an unprocessed touch + // event here. That is already done by the gesture manager in + // RootView::OnTouchEvent. + return false; } else { + MouseEvent mouseev(xev, from_native); + // Show the cursor. Start a timer to hide the cursor after a delay on // move (not drag) events, or if the only button pressed is released. bool start_timer = mouseev.type() == ui::ET_MOUSE_MOVED; @@ -86,8 +99,9 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) { mouseev.IsOnlyMiddleMouseButton() || mouseev.IsOnlyRightMouseButton()); TouchFactory::GetInstance()->SetCursorVisible(true, start_timer); + + return widget->OnMouseEvent(mouseev); } - return widget->OnMouseEvent(mouseev); } } return false; |