Chromium Code Reviews| Index: views/focus/accelerator_handler_touch.cc |
| diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc |
| index c76e8badbe38773b3d2fd21bf235ddc388c381af..ac0768c9cde6fd452a4be3773e9e4504c2fadf77 100644 |
| --- a/views/focus/accelerator_handler_touch.cc |
| +++ b/views/focus/accelerator_handler_touch.cc |
| @@ -47,6 +47,33 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) { |
| // TODO(sad): We don't capture XInput2 events from keyboard yet. |
| break; |
| } |
| +#if defined(USE_XI2_1) |
| + case XI_TouchBegin: |
| + case XI_TouchEnd: |
| + case XI_TouchUpdate: { |
| + XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data); |
| + Event::FromNativeEvent2 from_native; |
| + |
| + // Is the event coming from a touch device? |
| + if (TouchFactory::GetInstance()->IsTouchDevice(xievent->sourceid)) { |
|
sadrul
2011/09/07 14:56:37
This check is probably not necessary here. If some
ningxin.hu
2011/09/08 08:24:50
Agree. I am removing the check.
|
| + // Hide the cursor when a touch event comes in. |
| + TouchFactory::GetInstance()->SetCursorVisible(false, 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. |
|
sadrul
2011/09/07 14:56:37
|root| should become |widget| (and possibly correc
ningxin.hu
2011/09/08 08:24:50
Will correct the comments. Thanks.
|
| + TouchEvent touch(xev, from_native); |
| + if (widget->OnTouchEvent(touch) != ui::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 { |
| + return false; |
| + } |
| + } |
| +#else |
| case XI_ButtonPress: |
| case XI_ButtonRelease: |
| case XI_Motion: { |
| @@ -97,6 +124,7 @@ bool DispatchX2Event(Widget* widget, XEvent* xev) { |
| return widget->OnMouseEvent(mouseev); |
| } |
| } |
| +#endif |
|
sadrul
2011/09/07 14:56:37
#endif // defined(USE_XI2_1)
ningxin.hu
2011/09/08 08:24:50
Added. Thanks.
|
| } |
| return false; |
| } |