Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: ui/events/x/events_x.cc

Issue 191223007: Move touch CTM from X into Chrome (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: move CTM update code into a separate file ash/touch/touch_ctm_controller.cc Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 case LeaveNotify: 427 case LeaveNotify:
428 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y); 428 return gfx::Point(native_event->xcrossing.x, native_event->xcrossing.y);
429 case ButtonPress: 429 case ButtonPress:
430 case ButtonRelease: 430 case ButtonRelease:
431 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); 431 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y);
432 case MotionNotify: 432 case MotionNotify:
433 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); 433 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y);
434 case GenericEvent: { 434 case GenericEvent: {
435 XIDeviceEvent* xievent = 435 XIDeviceEvent* xievent =
436 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 436 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
437 return gfx::Point(static_cast<int>(xievent->event_x), 437 float x = xievent->event_x;
438 static_cast<int>(xievent->event_y)); 438 float y = xievent->event_y;
439 #if defined(OS_CHROMEOS)
440 ui::EventType type = ui::EventTypeFromNative(native_event);
441 switch (type) {
sadrul 2014/03/15 19:32:51 Let's do this for xievent->evtype == XI_Touch* eve
Yufeng Shen (Slow to review) 2014/04/29 20:34:18 Done.
442 case ui::ET_TOUCH_MOVED:
443 case ui::ET_TOUCH_PRESSED:
444 case ui::ET_TOUCH_CANCELLED:
445 case ui::ET_TOUCH_RELEASED: {
446 ui::DeviceDataManager::GetInstance()->ApplyTouchCTM(
447 xievent->deviceid, &x, &y);
448 break;
449 }
450 default:
451 break;
452 }
453 #endif // defined(OS_CHROMEOS)
454 return gfx::Point(static_cast<int>(x), static_cast<int>(y));
439 } 455 }
440 } 456 }
441 return gfx::Point(); 457 return gfx::Point();
442 } 458 }
443 459
444 gfx::Point EventSystemLocationFromNative( 460 gfx::Point EventSystemLocationFromNative(
445 const base::NativeEvent& native_event) { 461 const base::NativeEvent& native_event) {
446 switch (native_event->type) { 462 switch (native_event->type) {
447 case EnterNotify: 463 case EnterNotify:
448 case LeaveNotify: { 464 case LeaveNotify: {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 689
674 bool IsNaturalScrollEnabled() { 690 bool IsNaturalScrollEnabled() {
675 return DeviceDataManager::GetInstance()->natural_scroll_enabled(); 691 return DeviceDataManager::GetInstance()->natural_scroll_enabled();
676 } 692 }
677 693
678 bool IsTouchpadEvent(const base::NativeEvent& event) { 694 bool IsTouchpadEvent(const base::NativeEvent& event) {
679 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); 695 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event);
680 } 696 }
681 697
682 } // namespace ui 698 } // namespace ui
OLDNEW
« ui/events/x/device_data_manager.cc ('K') | « ui/events/x/device_data_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698