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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 case LeaveNotify: | 452 case LeaveNotify: |
453 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y); | 453 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y); |
454 case ButtonPress: | 454 case ButtonPress: |
455 case ButtonRelease: | 455 case ButtonRelease: |
456 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); | 456 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); |
457 case MotionNotify: | 457 case MotionNotify: |
458 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); | 458 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); |
459 case GenericEvent: { | 459 case GenericEvent: { |
460 XIDeviceEvent* xievent = | 460 XIDeviceEvent* xievent = |
461 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 461 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
462 return gfx::Point(static_cast<int>(xievent->event_x), | 462 float x = xievent->event_x; |
463 static_cast<int>(xievent->event_y)); | 463 float y = xievent->event_y; |
| 464 #if defined(OS_CHROMEOS) |
| 465 switch (xievent->evtype) { |
| 466 case XI_TouchBegin: |
| 467 case XI_TouchUpdate: |
| 468 case XI_TouchEnd: |
| 469 ui::DeviceDataManager::GetInstance()->ApplyTouchTransformer( |
| 470 xievent->deviceid, &x, &y); |
| 471 break; |
| 472 default: |
| 473 break; |
| 474 } |
| 475 #endif // defined(OS_CHROMEOS) |
| 476 return gfx::Point(static_cast<int>(x), static_cast<int>(y)); |
464 } | 477 } |
465 } | 478 } |
466 return gfx::Point(); | 479 return gfx::Point(); |
467 } | 480 } |
468 | 481 |
469 gfx::Point EventSystemLocationFromNative( | 482 gfx::Point EventSystemLocationFromNative( |
470 const base::NativeEvent& native_event) { | 483 const base::NativeEvent& native_event) { |
471 switch (native_event->type) { | 484 switch (native_event->type) { |
472 case EnterNotify: | 485 case EnterNotify: |
473 case LeaveNotify: { | 486 case LeaveNotify: { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 DeviceDataManager::GetInstance()->GetGestureTimes( | 715 DeviceDataManager::GetInstance()->GetGestureTimes( |
703 native_event, start_time, end_time); | 716 native_event, start_time, end_time); |
704 return true; | 717 return true; |
705 } | 718 } |
706 | 719 |
707 bool IsTouchpadEvent(const base::NativeEvent& event) { | 720 bool IsTouchpadEvent(const base::NativeEvent& event) { |
708 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 721 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
709 } | 722 } |
710 | 723 |
711 } // namespace ui | 724 } // namespace ui |
OLD | NEW |