| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/events/event_constants.h" | 5 #include "ui/events/event_constants.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 364 } |
| 365 case XI_ButtonRelease: { | 365 case XI_ButtonRelease: { |
| 366 int button = EventButtonFromNative(native_event); | 366 int button = EventButtonFromNative(native_event); |
| 367 // Drop wheel events; we should've already scrolled on the press. | 367 // Drop wheel events; we should've already scrolled on the press. |
| 368 if (button >= kMinWheelButton && button <= kMaxWheelButton) | 368 if (button >= kMinWheelButton && button <= kMaxWheelButton) |
| 369 return ET_UNKNOWN; | 369 return ET_UNKNOWN; |
| 370 return ET_MOUSE_RELEASED; | 370 return ET_MOUSE_RELEASED; |
| 371 } | 371 } |
| 372 case XI_Motion: { | 372 case XI_Motion: { |
| 373 bool is_cancel; | 373 bool is_cancel; |
| 374 if (GetFlingData(native_event, NULL, NULL, NULL, NULL, &is_cancel)) { | 374 DeviceDataManagerX11* devices = DeviceDataManagerX11::GetInstance(); |
| 375 if (GetFlingData(native_event, NULL, NULL, NULL, NULL, &is_cancel)) |
| 375 return is_cancel ? ET_SCROLL_FLING_CANCEL : ET_SCROLL_FLING_START; | 376 return is_cancel ? ET_SCROLL_FLING_CANCEL : ET_SCROLL_FLING_START; |
| 376 } else if (DeviceDataManagerX11::GetInstance()->IsScrollEvent( | 377 if (devices->IsScrollEvent(native_event)) { |
| 377 native_event)) { | 378 return devices->IsTouchpadXInputEvent(native_event) ? ET_SCROLL |
| 378 return IsTouchpadEvent(native_event) ? ET_SCROLL : ET_MOUSEWHEEL; | 379 : ET_MOUSEWHEEL; |
| 379 } else if (DeviceDataManagerX11::GetInstance()->IsCMTMetricsEvent( | 380 } |
| 380 native_event)) { | 381 if (devices->IsCMTMetricsEvent(native_event)) |
| 381 return ET_UMA_DATA; | 382 return ET_UMA_DATA; |
| 382 } else if (GetButtonMaskForX2Event(xievent)) { | 383 if (GetButtonMaskForX2Event(xievent)) |
| 383 return ET_MOUSE_DRAGGED; | 384 return ET_MOUSE_DRAGGED; |
| 384 } | |
| 385 return ET_MOUSE_MOVED; | 385 return ET_MOUSE_MOVED; |
| 386 } | 386 } |
| 387 case XI_KeyPress: | 387 case XI_KeyPress: |
| 388 return ET_KEY_PRESSED; | 388 return ET_KEY_PRESSED; |
| 389 case XI_KeyRelease: | 389 case XI_KeyRelease: |
| 390 return ET_KEY_RELEASED; | 390 return ET_KEY_RELEASED; |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 default: | 393 default: |
| 394 break; | 394 break; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 if (!start_time) | 801 if (!start_time) |
| 802 start_time = &start_time_; | 802 start_time = &start_time_; |
| 803 if (!end_time) | 803 if (!end_time) |
| 804 end_time = &end_time_; | 804 end_time = &end_time_; |
| 805 | 805 |
| 806 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 806 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
| 807 native_event, start_time, end_time); | 807 native_event, start_time, end_time); |
| 808 return true; | 808 return true; |
| 809 } | 809 } |
| 810 | 810 |
| 811 bool IsTouchpadEvent(const base::NativeEvent& event) { | |
| 812 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); | |
| 813 } | |
| 814 | |
| 815 } // namespace ui | 811 } // namespace ui |
| OLD | NEW |