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

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

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 ui::DeviceDataManagerX11::DT_TOUCH_MINOR, 0.0) / 2.0; 791 ui::DeviceDataManagerX11::DT_TOUCH_MINOR, 0.0) / 2.0;
792 ScaleTouchRadius(native_event, &radius); 792 ScaleTouchRadius(native_event, &radius);
793 return radius; 793 return radius;
794 } 794 }
795 795
796 float GetTouchAngle(const base::NativeEvent& native_event) { 796 float GetTouchAngle(const base::NativeEvent& native_event) {
797 return GetTouchParamFromXEvent(native_event, 797 return GetTouchParamFromXEvent(native_event,
798 ui::DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.0) / 2.0; 798 ui::DeviceDataManagerX11::DT_TOUCH_ORIENTATION, 0.0) / 2.0;
799 } 799 }
800 800
801 float GetTouchTilt(const base::NativeEvent& native_event) {
802 NOTIMPLEMENTED();
803 return 0.0f;
804 }
805
801 float GetTouchForce(const base::NativeEvent& native_event) { 806 float GetTouchForce(const base::NativeEvent& native_event) {
802 double force = 0.0; 807 double force = 0.0;
803 force = GetTouchParamFromXEvent(native_event, 808 force = GetTouchParamFromXEvent(native_event,
804 ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, 0.0); 809 ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, 0.0);
805 unsigned int deviceid = 810 unsigned int deviceid =
806 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; 811 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid;
807 // Force is normalized to fall into [0, 1] 812 // Force is normalized to fall into [0, 1]
808 if (!ui::DeviceDataManagerX11::GetInstance()->NormalizeData( 813 if (!ui::DeviceDataManagerX11::GetInstance()->NormalizeData(
809 deviceid, ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, &force)) 814 deviceid, ui::DeviceDataManagerX11::DT_TOUCH_PRESSURE, &force))
810 force = 0.0; 815 force = 0.0;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 xievent->detail = 919 xievent->detail =
915 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); 920 UpdateX11EventButton(event->changed_button_flags(), xievent->detail);
916 break; 921 break;
917 } 922 }
918 default: 923 default:
919 break; 924 break;
920 } 925 }
921 } 926 }
922 927
923 } // namespace ui 928 } // namespace ui
OLDNEW
« ui/events/gesture_detection/motion_event.h ('K') | « ui/events/win/events_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698