| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 case LeaveNotify: | 432 case LeaveNotify: |
| 433 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y); | 433 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y); |
| 434 case ButtonPress: | 434 case ButtonPress: |
| 435 case ButtonRelease: | 435 case ButtonRelease: |
| 436 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); | 436 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); |
| 437 case MotionNotify: | 437 case MotionNotify: |
| 438 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); | 438 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); |
| 439 case GenericEvent: { | 439 case GenericEvent: { |
| 440 XIDeviceEvent* xievent = | 440 XIDeviceEvent* xievent = |
| 441 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 441 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
| 442 return gfx::Point(static_cast<int>(xievent->event_x), | 442 float x = xievent->event_x; |
| 443 static_cast<int>(xievent->event_y)); | 443 float y = xievent->event_y; |
| 444 #if defined(OS_CHROMEOS) |
| 445 switch (xievent->evtype) { |
| 446 case XI_TouchBegin: |
| 447 case XI_TouchUpdate: |
| 448 case XI_TouchEnd: |
| 449 ui::DeviceDataManager::GetInstance()->ApplyTouchTransformer( |
| 450 xievent->deviceid, &x, &y); |
| 451 break; |
| 452 default: |
| 453 break; |
| 454 } |
| 455 #endif // defined(OS_CHROMEOS) |
| 456 return gfx::Point(static_cast<int>(x), static_cast<int>(y)); |
| 444 } | 457 } |
| 445 } | 458 } |
| 446 return gfx::Point(); | 459 return gfx::Point(); |
| 447 } | 460 } |
| 448 | 461 |
| 449 gfx::Point EventSystemLocationFromNative( | 462 gfx::Point EventSystemLocationFromNative( |
| 450 const base::NativeEvent& native_event) { | 463 const base::NativeEvent& native_event) { |
| 451 switch (native_event->type) { | 464 switch (native_event->type) { |
| 452 case EnterNotify: | 465 case EnterNotify: |
| 453 case LeaveNotify: { | 466 case LeaveNotify: { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 DeviceDataManager::GetInstance()->GetGestureTimes( | 683 DeviceDataManager::GetInstance()->GetGestureTimes( |
| 671 native_event, start_time, end_time); | 684 native_event, start_time, end_time); |
| 672 return true; | 685 return true; |
| 673 } | 686 } |
| 674 | 687 |
| 675 bool IsTouchpadEvent(const base::NativeEvent& event) { | 688 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 676 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 689 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
| 677 } | 690 } |
| 678 | 691 |
| 679 } // namespace ui | 692 } // namespace ui |
| OLD | NEW |