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