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