| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 int button = native_event->type == GenericEvent ? | 520 int button = native_event->type == GenericEvent ? |
| 521 EventButtonFromNative(native_event) : native_event->xbutton.button; | 521 EventButtonFromNative(native_event) : native_event->xbutton.button; |
| 522 | 522 |
| 523 switch (button) { | 523 switch (button) { |
| 524 case 4: | 524 case 4: |
| 525 return gfx::Vector2d(0, kWheelScrollAmount); | 525 return gfx::Vector2d(0, kWheelScrollAmount); |
| 526 case 5: | 526 case 5: |
| 527 return gfx::Vector2d(0, -kWheelScrollAmount); | 527 return gfx::Vector2d(0, -kWheelScrollAmount); |
| 528 case 6: | 528 case 6: |
| 529 return gfx::Vector2d(kWheelScrollAmount, 0); |
| 530 case 7: |
| 529 return gfx::Vector2d(-kWheelScrollAmount, 0); | 531 return gfx::Vector2d(-kWheelScrollAmount, 0); |
| 530 case 7: | |
| 531 return gfx::Vector2d(kWheelScrollAmount, 0); | |
| 532 default: | 532 default: |
| 533 return gfx::Vector2d(); | 533 return gfx::Vector2d(); |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 | 536 |
| 537 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 537 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
| 538 ui::EventType type = ui::EventTypeFromNative(xev); | 538 ui::EventType type = ui::EventTypeFromNative(xev); |
| 539 if (type == ui::ET_TOUCH_CANCELLED || | 539 if (type == ui::ET_TOUCH_CANCELLED || |
| 540 type == ui::ET_TOUCH_RELEASED) { | 540 type == ui::ET_TOUCH_RELEASED) { |
| 541 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 541 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 673 |
| 674 bool IsNaturalScrollEnabled() { | 674 bool IsNaturalScrollEnabled() { |
| 675 return DeviceDataManager::GetInstance()->natural_scroll_enabled(); | 675 return DeviceDataManager::GetInstance()->natural_scroll_enabled(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 bool IsTouchpadEvent(const base::NativeEvent& event) { | 678 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 679 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 679 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
| 680 } | 680 } |
| 681 | 681 |
| 682 } // namespace ui | 682 } // namespace ui |
| OLD | NEW |