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> |
11 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
12 #include <X11/Xutil.h> | 12 #include <X11/Xutil.h> |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
16 #include "ui/events/event_utils.h" | 16 #include "ui/events/event_utils.h" |
17 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 17 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
18 #include "ui/events/x/device_data_manager.h" | 18 #include "ui/events/x/device_data_manager_x11.h" |
19 #include "ui/events/x/device_list_cache_x.h" | 19 #include "ui/events/x/device_list_cache_x.h" |
20 #include "ui/events/x/touch_factory_x11.h" | 20 #include "ui/events/x/touch_factory_x11.h" |
21 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
22 #include "ui/gfx/point.h" | 22 #include "ui/gfx/point.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
25 #include "ui/gfx/x/x11_atom_cache.h" | 25 #include "ui/gfx/x/x11_atom_cache.h" |
26 #include "ui/gfx/x/x11_types.h" | 26 #include "ui/gfx/x/x11_types.h" |
27 | 27 |
28 namespace { | 28 namespace { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (ui::GetTouchForce(native_event) < 1.0f) | 111 if (ui::GetTouchForce(native_event) < 1.0f) |
112 return false; | 112 return false; |
113 | 113 |
114 if (ui::EventLocationFromNative(native_event) != gfx::Point()) | 114 if (ui::EventLocationFromNative(native_event) != gfx::Point()) |
115 return false; | 115 return false; |
116 | 116 |
117 // Radius is in pixels, and the valuator is the diameter in pixels. | 117 // Radius is in pixels, and the valuator is the diameter in pixels. |
118 double radius = ui::GetTouchRadiusX(native_event), min, max; | 118 double radius = ui::GetTouchRadiusX(native_event), min, max; |
119 unsigned int deviceid = | 119 unsigned int deviceid = |
120 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; | 120 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; |
121 if (!ui::DeviceDataManager::GetInstance()->GetDataRange( | 121 if (!ui::DeviceDataManagerX11::GetInstance()->GetDataRange( |
122 deviceid, ui::DeviceDataManager::DT_TOUCH_MAJOR, &min, &max)) { | 122 deviceid, ui::DeviceDataManagerX11::DT_TOUCH_MAJOR, &min, &max)) { |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 return radius * 2 == max; | 126 return radius * 2 == max; |
127 } | 127 } |
128 #endif | 128 #endif |
129 | 129 |
130 int GetEventFlagsFromXState(unsigned int state) { | 130 int GetEventFlagsFromXState(unsigned int state) { |
131 int flags = 0; | 131 int flags = 0; |
132 if (state & ControlMask) | 132 if (state & ControlMask) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 default: | 196 default: |
197 return 0; | 197 return 0; |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 int GetButtonMaskForX2Event(XIDeviceEvent* xievent) { | 201 int GetButtonMaskForX2Event(XIDeviceEvent* xievent) { |
202 int buttonflags = 0; | 202 int buttonflags = 0; |
203 for (int i = 0; i < 8 * xievent->buttons.mask_len; i++) { | 203 for (int i = 0; i < 8 * xievent->buttons.mask_len; i++) { |
204 if (XIMaskIsSet(xievent->buttons.mask, i)) { | 204 if (XIMaskIsSet(xievent->buttons.mask, i)) { |
205 int button = (xievent->sourceid == xievent->deviceid) ? | 205 int button = (xievent->sourceid == xievent->deviceid) ? |
206 ui::DeviceDataManager::GetInstance()->GetMappedButton(i) : i; | 206 ui::DeviceDataManagerX11::GetInstance()->GetMappedButton(i) : i; |
207 buttonflags |= GetEventFlagsForButton(button); | 207 buttonflags |= GetEventFlagsForButton(button); |
208 } | 208 } |
209 } | 209 } |
210 return buttonflags; | 210 return buttonflags; |
211 } | 211 } |
212 | 212 |
213 ui::EventType GetTouchEventType(const base::NativeEvent& native_event) { | 213 ui::EventType GetTouchEventType(const base::NativeEvent& native_event) { |
214 XIDeviceEvent* event = | 214 XIDeviceEvent* event = |
215 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 215 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
216 #if defined(USE_XI2_MT) | 216 #if defined(USE_XI2_MT) |
(...skipping 23 matching lines...) Expand all Loading... |
240 GetButtonMaskForX2Event(event)) | 240 GetButtonMaskForX2Event(event)) |
241 return ui::ET_TOUCH_MOVED; | 241 return ui::ET_TOUCH_MOVED; |
242 return ui::ET_UNKNOWN; | 242 return ui::ET_UNKNOWN; |
243 default: | 243 default: |
244 NOTREACHED(); | 244 NOTREACHED(); |
245 } | 245 } |
246 return ui::ET_UNKNOWN; | 246 return ui::ET_UNKNOWN; |
247 } | 247 } |
248 | 248 |
249 double GetTouchParamFromXEvent(XEvent* xev, | 249 double GetTouchParamFromXEvent(XEvent* xev, |
250 ui::DeviceDataManager::DataType val, | 250 ui::DeviceDataManagerX11::DataType val, |
251 double default_value) { | 251 double default_value) { |
252 ui::DeviceDataManager::GetInstance()->GetEventData( | 252 ui::DeviceDataManagerX11::GetInstance()->GetEventData( |
253 *xev, val, &default_value); | 253 *xev, val, &default_value); |
254 return default_value; | 254 return default_value; |
255 } | 255 } |
256 | 256 |
257 } // namespace | 257 } // namespace |
258 | 258 |
259 namespace ui { | 259 namespace ui { |
260 | 260 |
261 void UpdateDeviceList() { | 261 void UpdateDeviceList() { |
262 XDisplay* display = gfx::GetXDisplay(); | 262 XDisplay* display = gfx::GetXDisplay(); |
263 DeviceListCacheX::GetInstance()->UpdateDeviceList(display); | 263 DeviceListCacheX::GetInstance()->UpdateDeviceList(display); |
264 TouchFactory::GetInstance()->UpdateDeviceList(display); | 264 TouchFactory::GetInstance()->UpdateDeviceList(display); |
265 DeviceDataManager::GetInstance()->UpdateDeviceList(display); | 265 DeviceDataManagerX11::GetInstance()->UpdateDeviceList(display); |
266 } | 266 } |
267 | 267 |
268 EventType EventTypeFromNative(const base::NativeEvent& native_event) { | 268 EventType EventTypeFromNative(const base::NativeEvent& native_event) { |
269 switch (native_event->type) { | 269 switch (native_event->type) { |
270 case KeyPress: | 270 case KeyPress: |
271 return ET_KEY_PRESSED; | 271 return ET_KEY_PRESSED; |
272 case KeyRelease: | 272 case KeyRelease: |
273 return ET_KEY_RELEASED; | 273 return ET_KEY_RELEASED; |
274 case ButtonPress: | 274 case ButtonPress: |
275 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton && | 275 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton && |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 int button = EventButtonFromNative(native_event); | 325 int button = EventButtonFromNative(native_event); |
326 // Drop wheel events; we should've already scrolled on the press. | 326 // Drop wheel events; we should've already scrolled on the press. |
327 if (button >= kMinWheelButton && button <= kMaxWheelButton) | 327 if (button >= kMinWheelButton && button <= kMaxWheelButton) |
328 return ET_UNKNOWN; | 328 return ET_UNKNOWN; |
329 return ET_MOUSE_RELEASED; | 329 return ET_MOUSE_RELEASED; |
330 } | 330 } |
331 case XI_Motion: { | 331 case XI_Motion: { |
332 bool is_cancel; | 332 bool is_cancel; |
333 if (GetFlingData(native_event, NULL, NULL, NULL, NULL, &is_cancel)) { | 333 if (GetFlingData(native_event, NULL, NULL, NULL, NULL, &is_cancel)) { |
334 return is_cancel ? ET_SCROLL_FLING_CANCEL : ET_SCROLL_FLING_START; | 334 return is_cancel ? ET_SCROLL_FLING_CANCEL : ET_SCROLL_FLING_START; |
335 } else if (DeviceDataManager::GetInstance()->IsScrollEvent( | 335 } else if (DeviceDataManagerX11::GetInstance()->IsScrollEvent( |
336 native_event)) { | 336 native_event)) { |
337 return IsTouchpadEvent(native_event) ? ET_SCROLL : ET_MOUSEWHEEL; | 337 return IsTouchpadEvent(native_event) ? ET_SCROLL : ET_MOUSEWHEEL; |
338 } else if (DeviceDataManager::GetInstance()->IsCMTMetricsEvent( | 338 } else if (DeviceDataManagerX11::GetInstance()->IsCMTMetricsEvent( |
339 native_event)) { | 339 native_event)) { |
340 return ET_UMA_DATA; | 340 return ET_UMA_DATA; |
341 } else if (GetButtonMaskForX2Event(xievent)) { | 341 } else if (GetButtonMaskForX2Event(xievent)) { |
342 return ET_MOUSE_DRAGGED; | 342 return ET_MOUSE_DRAGGED; |
343 } else { | 343 } else { |
344 return ET_MOUSE_MOVED; | 344 return ET_MOUSE_MOVED; |
345 } | 345 } |
346 } | 346 } |
347 } | 347 } |
348 } | 348 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 case EnterNotify: | 428 case EnterNotify: |
429 case LeaveNotify: | 429 case LeaveNotify: |
430 return base::TimeDelta::FromMilliseconds(native_event->xcrossing.time); | 430 return base::TimeDelta::FromMilliseconds(native_event->xcrossing.time); |
431 break; | 431 break; |
432 case GenericEvent: { | 432 case GenericEvent: { |
433 double start, end; | 433 double start, end; |
434 double touch_timestamp; | 434 double touch_timestamp; |
435 if (GetGestureTimes(native_event, &start, &end)) { | 435 if (GetGestureTimes(native_event, &start, &end)) { |
436 // If the driver supports gesture times, use them. | 436 // If the driver supports gesture times, use them. |
437 return base::TimeDelta::FromMicroseconds(end * 1000000); | 437 return base::TimeDelta::FromMicroseconds(end * 1000000); |
438 } else if (DeviceDataManager::GetInstance()->GetEventData(*native_event, | 438 } else if (DeviceDataManagerX11::GetInstance()->GetEventData( |
439 DeviceDataManager::DT_TOUCH_RAW_TIMESTAMP, &touch_timestamp)) { | 439 *native_event, |
| 440 DeviceDataManagerX11::DT_TOUCH_RAW_TIMESTAMP, |
| 441 &touch_timestamp)) { |
440 return base::TimeDelta::FromMicroseconds(touch_timestamp * 1000000); | 442 return base::TimeDelta::FromMicroseconds(touch_timestamp * 1000000); |
441 } else { | 443 } else { |
442 XIDeviceEvent* xide = | 444 XIDeviceEvent* xide = |
443 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 445 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
444 return base::TimeDelta::FromMilliseconds(xide->time); | 446 return base::TimeDelta::FromMilliseconds(xide->time); |
445 } | 447 } |
446 break; | 448 break; |
447 } | 449 } |
448 } | 450 } |
449 NOTREACHED(); | 451 NOTREACHED(); |
(...skipping 13 matching lines...) Expand all Loading... |
463 case GenericEvent: { | 465 case GenericEvent: { |
464 XIDeviceEvent* xievent = | 466 XIDeviceEvent* xievent = |
465 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 467 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
466 float x = xievent->event_x; | 468 float x = xievent->event_x; |
467 float y = xievent->event_y; | 469 float y = xievent->event_y; |
468 #if defined(OS_CHROMEOS) | 470 #if defined(OS_CHROMEOS) |
469 switch (xievent->evtype) { | 471 switch (xievent->evtype) { |
470 case XI_TouchBegin: | 472 case XI_TouchBegin: |
471 case XI_TouchUpdate: | 473 case XI_TouchUpdate: |
472 case XI_TouchEnd: | 474 case XI_TouchEnd: |
473 ui::DeviceDataManager::GetInstance()->ApplyTouchTransformer( | 475 ui::DeviceDataManagerX11::GetInstance()->ApplyTouchTransformer( |
474 xievent->deviceid, &x, &y); | 476 xievent->deviceid, &x, &y); |
475 break; | 477 break; |
476 default: | 478 default: |
477 break; | 479 break; |
478 } | 480 } |
479 #endif // defined(OS_CHROMEOS) | 481 #endif // defined(OS_CHROMEOS) |
480 return gfx::Point(static_cast<int>(x), static_cast<int>(y)); | 482 return gfx::Point(static_cast<int>(x), static_cast<int>(y)); |
481 } | 483 } |
482 } | 484 } |
483 return gfx::Point(); | 485 return gfx::Point(); |
(...skipping 26 matching lines...) Expand all Loading... |
510 return gfx::Point(); | 512 return gfx::Point(); |
511 } | 513 } |
512 | 514 |
513 int EventButtonFromNative(const base::NativeEvent& native_event) { | 515 int EventButtonFromNative(const base::NativeEvent& native_event) { |
514 CHECK_EQ(GenericEvent, native_event->type); | 516 CHECK_EQ(GenericEvent, native_event->type); |
515 XIDeviceEvent* xievent = | 517 XIDeviceEvent* xievent = |
516 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | 518 static_cast<XIDeviceEvent*>(native_event->xcookie.data); |
517 int button = xievent->detail; | 519 int button = xievent->detail; |
518 | 520 |
519 return (xievent->sourceid == xievent->deviceid) ? | 521 return (xievent->sourceid == xievent->deviceid) ? |
520 DeviceDataManager::GetInstance()->GetMappedButton(button) : button; | 522 DeviceDataManagerX11::GetInstance()->GetMappedButton(button) : button; |
521 } | 523 } |
522 | 524 |
523 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 525 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
524 return KeyboardCodeFromXKeyEvent(native_event); | 526 return KeyboardCodeFromXKeyEvent(native_event); |
525 } | 527 } |
526 | 528 |
527 const char* CodeFromNative(const base::NativeEvent& native_event) { | 529 const char* CodeFromNative(const base::NativeEvent& native_event) { |
528 return CodeFromXEvent(native_event); | 530 return CodeFromXEvent(native_event); |
529 } | 531 } |
530 | 532 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 588 |
587 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { | 589 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { |
588 delete event; | 590 delete event; |
589 } | 591 } |
590 | 592 |
591 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { | 593 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { |
592 ui::EventType type = ui::EventTypeFromNative(xev); | 594 ui::EventType type = ui::EventTypeFromNative(xev); |
593 if (type == ui::ET_TOUCH_CANCELLED || | 595 if (type == ui::ET_TOUCH_CANCELLED || |
594 type == ui::ET_TOUCH_RELEASED) { | 596 type == ui::ET_TOUCH_RELEASED) { |
595 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 597 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
596 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); | 598 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
597 double tracking_id; | 599 double tracking_id; |
598 if (manager->GetEventData( | 600 if (manager->GetEventData( |
599 *xev, ui::DeviceDataManager::DT_TOUCH_TRACKING_ID, &tracking_id)) { | 601 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
600 factory->ReleaseSlotForTrackingID(tracking_id); | 602 factory->ReleaseSlotForTrackingID(tracking_id); |
601 } | 603 } |
602 } | 604 } |
603 } | 605 } |
604 | 606 |
605 int GetTouchId(const base::NativeEvent& xev) { | 607 int GetTouchId(const base::NativeEvent& xev) { |
606 double slot = 0; | 608 double slot = 0; |
607 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); | 609 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
608 double tracking_id; | 610 double tracking_id; |
609 if (!manager->GetEventData( | 611 if (!manager->GetEventData( |
610 *xev, ui::DeviceDataManager::DT_TOUCH_TRACKING_ID, &tracking_id)) { | 612 *xev, ui::DeviceDataManagerX11::DT_TOUCH_TRACKING_ID, &tracking_id)) { |
611 LOG(ERROR) << "Could not get the tracking ID for the event. Using 0."; | 613 LOG(ERROR) << "Could not get the tracking ID for the event. Using 0."; |
612 } else { | 614 } else { |
613 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); | 615 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); |
614 slot = factory->GetSlotForTrackingID(tracking_id); | 616 slot = factory->GetSlotForTrackingID(tracking_id); |
615 } | 617 } |
616 return slot; | 618 return slot; |
617 } | 619 } |
618 | 620 |
619 float GetTouchRadiusX(const base::NativeEvent& native_event) { | 621 float GetTouchRadiusX(const base::NativeEvent& native_event) { |
620 return GetTouchParamFromXEvent(native_event, | 622 return GetTouchParamFromXEvent(native_event, |
621 ui::DeviceDataManager::DT_TOUCH_MAJOR, 0.0) / 2.0; | 623 ui::DeviceDataManagerX11::DT_TOUCH_MAJOR, 0.0) / 2.0; |
622 } | 624 } |
623 | 625 |
624 float GetTouchRadiusY(const base::NativeEvent& native_event) { | 626 float GetTouchRadiusY(const base::NativeEvent& native_event) { |
625 return GetTouchParamFromXEvent(native_event, | 627 return GetTouchParamFromXEvent(native_event, |
626 ui::DeviceDataManager::DT_TOUCH_MINOR, 0.0) / 2.0; | 628 ui::DeviceDataManagerX11::DT_TOUCH_MINOR, 0.0) / 2.0; |
627 } | 629 } |
628 | 630 |
629 float GetTouchAngle(const base::NativeEvent& native_event) { | 631 float GetTouchAngle(const base::NativeEvent& native_event) { |
630 return GetTouchParamFromXEvent(native_event, | 632 return GetTouchParamFromXEvent(native_event, |
631 ui::DeviceDataManager::DT_TOUCH_ORIENTATION, 0.0) / 2.0; | 633 ui::DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.0) / 2.0; |
632 } | 634 } |
633 | 635 |
634 float GetTouchForce(const base::NativeEvent& native_event) { | 636 float GetTouchForce(const base::NativeEvent& native_event) { |
635 double force = 0.0; | 637 double force = 0.0; |
636 force = GetTouchParamFromXEvent(native_event, | 638 force = GetTouchParamFromXEvent(native_event, |
637 ui::DeviceDataManager::DT_TOUCH_PRESSURE, 0.0); | 639 ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, 0.0); |
638 unsigned int deviceid = | 640 unsigned int deviceid = |
639 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; | 641 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; |
640 // Force is normalized to fall into [0, 1] | 642 // Force is normalized to fall into [0, 1] |
641 if (!ui::DeviceDataManager::GetInstance()->NormalizeData( | 643 if (!ui::DeviceDataManagerX11::GetInstance()->NormalizeData( |
642 deviceid, ui::DeviceDataManager::DT_TOUCH_PRESSURE, &force)) | 644 deviceid, ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, &force)) |
643 force = 0.0; | 645 force = 0.0; |
644 return force; | 646 return force; |
645 } | 647 } |
646 | 648 |
647 bool GetScrollOffsets(const base::NativeEvent& native_event, | 649 bool GetScrollOffsets(const base::NativeEvent& native_event, |
648 float* x_offset, | 650 float* x_offset, |
649 float* y_offset, | 651 float* y_offset, |
650 float* x_offset_ordinal, | 652 float* x_offset_ordinal, |
651 float* y_offset_ordinal, | 653 float* y_offset_ordinal, |
652 int* finger_count) { | 654 int* finger_count) { |
653 if (!DeviceDataManager::GetInstance()->IsScrollEvent(native_event)) | 655 if (!DeviceDataManagerX11::GetInstance()->IsScrollEvent(native_event)) |
654 return false; | 656 return false; |
655 | 657 |
656 // Temp values to prevent passing NULLs to DeviceDataManager. | 658 // Temp values to prevent passing NULLs to DeviceDataManager. |
657 float x_offset_, y_offset_; | 659 float x_offset_, y_offset_; |
658 float x_offset_ordinal_, y_offset_ordinal_; | 660 float x_offset_ordinal_, y_offset_ordinal_; |
659 int finger_count_; | 661 int finger_count_; |
660 if (!x_offset) | 662 if (!x_offset) |
661 x_offset = &x_offset_; | 663 x_offset = &x_offset_; |
662 if (!y_offset) | 664 if (!y_offset) |
663 y_offset = &y_offset_; | 665 y_offset = &y_offset_; |
664 if (!x_offset_ordinal) | 666 if (!x_offset_ordinal) |
665 x_offset_ordinal = &x_offset_ordinal_; | 667 x_offset_ordinal = &x_offset_ordinal_; |
666 if (!y_offset_ordinal) | 668 if (!y_offset_ordinal) |
667 y_offset_ordinal = &y_offset_ordinal_; | 669 y_offset_ordinal = &y_offset_ordinal_; |
668 if (!finger_count) | 670 if (!finger_count) |
669 finger_count = &finger_count_; | 671 finger_count = &finger_count_; |
670 | 672 |
671 DeviceDataManager::GetInstance()->GetScrollOffsets( | 673 DeviceDataManagerX11::GetInstance()->GetScrollOffsets( |
672 native_event, | 674 native_event, |
673 x_offset, y_offset, | 675 x_offset, y_offset, |
674 x_offset_ordinal, y_offset_ordinal, | 676 x_offset_ordinal, y_offset_ordinal, |
675 finger_count); | 677 finger_count); |
676 return true; | 678 return true; |
677 } | 679 } |
678 | 680 |
679 bool GetFlingData(const base::NativeEvent& native_event, | 681 bool GetFlingData(const base::NativeEvent& native_event, |
680 float* vx, | 682 float* vx, |
681 float* vy, | 683 float* vy, |
682 float* vx_ordinal, | 684 float* vx_ordinal, |
683 float* vy_ordinal, | 685 float* vy_ordinal, |
684 bool* is_cancel) { | 686 bool* is_cancel) { |
685 if (!DeviceDataManager::GetInstance()->IsFlingEvent(native_event)) | 687 if (!DeviceDataManagerX11::GetInstance()->IsFlingEvent(native_event)) |
686 return false; | 688 return false; |
687 | 689 |
688 float vx_, vy_; | 690 float vx_, vy_; |
689 float vx_ordinal_, vy_ordinal_; | 691 float vx_ordinal_, vy_ordinal_; |
690 bool is_cancel_; | 692 bool is_cancel_; |
691 if (!vx) | 693 if (!vx) |
692 vx = &vx_; | 694 vx = &vx_; |
693 if (!vy) | 695 if (!vy) |
694 vy = &vy_; | 696 vy = &vy_; |
695 if (!vx_ordinal) | 697 if (!vx_ordinal) |
696 vx_ordinal = &vx_ordinal_; | 698 vx_ordinal = &vx_ordinal_; |
697 if (!vy_ordinal) | 699 if (!vy_ordinal) |
698 vy_ordinal = &vy_ordinal_; | 700 vy_ordinal = &vy_ordinal_; |
699 if (!is_cancel) | 701 if (!is_cancel) |
700 is_cancel = &is_cancel_; | 702 is_cancel = &is_cancel_; |
701 | 703 |
702 DeviceDataManager::GetInstance()->GetFlingData( | 704 DeviceDataManagerX11::GetInstance()->GetFlingData( |
703 native_event, vx, vy, vx_ordinal, vy_ordinal, is_cancel); | 705 native_event, vx, vy, vx_ordinal, vy_ordinal, is_cancel); |
704 return true; | 706 return true; |
705 } | 707 } |
706 | 708 |
707 bool GetGestureTimes(const base::NativeEvent& native_event, | 709 bool GetGestureTimes(const base::NativeEvent& native_event, |
708 double* start_time, | 710 double* start_time, |
709 double* end_time) { | 711 double* end_time) { |
710 if (!DeviceDataManager::GetInstance()->HasGestureTimes(native_event)) | 712 if (!DeviceDataManagerX11::GetInstance()->HasGestureTimes(native_event)) |
711 return false; | 713 return false; |
712 | 714 |
713 double start_time_, end_time_; | 715 double start_time_, end_time_; |
714 if (!start_time) | 716 if (!start_time) |
715 start_time = &start_time_; | 717 start_time = &start_time_; |
716 if (!end_time) | 718 if (!end_time) |
717 end_time = &end_time_; | 719 end_time = &end_time_; |
718 | 720 |
719 DeviceDataManager::GetInstance()->GetGestureTimes( | 721 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
720 native_event, start_time, end_time); | 722 native_event, start_time, end_time); |
721 return true; | 723 return true; |
722 } | 724 } |
723 | 725 |
724 bool IsTouchpadEvent(const base::NativeEvent& event) { | 726 bool IsTouchpadEvent(const base::NativeEvent& event) { |
725 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 727 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); |
726 } | 728 } |
727 | 729 |
728 } // namespace ui | 730 } // namespace ui |
OLD | NEW |