| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/touchui/gesture_manager.h" | 5 #include "views/touchui/gesture_manager.h" |
| 6 #ifndef NDEBUG | 6 #ifndef NDEBUG |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return false; // The event was consumed by a touch sequence. | 29 return false; // The event was consumed by a touch sequence. |
| 30 | 30 |
| 31 // TODO(rjkroege): A realistic version of the GestureManager will | 31 // TODO(rjkroege): A realistic version of the GestureManager will |
| 32 // appear in a subsequent CL. This interim version permits verifying that the | 32 // appear in a subsequent CL. This interim version permits verifying that the |
| 33 // event distribution code works by turning all touch inputs into | 33 // event distribution code works by turning all touch inputs into |
| 34 // mouse approximations. | 34 // mouse approximations. |
| 35 | 35 |
| 36 // Conver the touch-event into a mouse-event. This mouse-event gets its | 36 // Conver the touch-event into a mouse-event. This mouse-event gets its |
| 37 // location information from the native-event, so it needs to convert the | 37 // location information from the native-event, so it needs to convert the |
| 38 // coordinate to the target widget. | 38 // coordinate to the target widget. |
| 39 Event::FromNativeEvent2 from_native; | 39 MouseEvent mouseev(event); |
| 40 MouseEvent mouseev(event, from_native); | |
| 41 if (ViewsDelegate::views_delegate->GetDefaultParentView()) { | 40 if (ViewsDelegate::views_delegate->GetDefaultParentView()) { |
| 42 // TODO(oshima): We may need to send the event back through | 41 // TODO(oshima): We may need to send the event back through |
| 43 // window manager to handle mouse capture correctly. | 42 // window manager to handle mouse capture correctly. |
| 44 Widget* desktop = | 43 Widget* desktop = |
| 45 ViewsDelegate::views_delegate->GetDefaultParentView()->GetWidget(); | 44 ViewsDelegate::views_delegate->GetDefaultParentView()->GetWidget(); |
| 46 Widget* source_widget = source->GetWidget(); | 45 Widget* source_widget = source->GetWidget(); |
| 47 MouseEvent converted( | 46 MouseEvent converted( |
| 48 mouseev, desktop->GetRootView(), source_widget->GetRootView()); | 47 mouseev, desktop->GetRootView(), source_widget->GetRootView()); |
| 49 source_widget->OnMouseEvent(converted); | 48 source_widget->OnMouseEvent(converted); |
| 50 } else { | 49 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 source_widget->OnMouseEvent(mouseev); | 60 source_widget->OnMouseEvent(mouseev); |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 return true; | 63 return true; |
| 65 } | 64 } |
| 66 | 65 |
| 67 GestureManager::GestureManager() { | 66 GestureManager::GestureManager() { |
| 68 } | 67 } |
| 69 | 68 |
| 70 } // namespace views | 69 } // namespace views |
| OLD | NEW |