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

Side by Side Diff: ui/base/x/valuators.cc

Issue 10868100: x11: Use kernel timestamps for touch events (if available). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/x/valuators.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/x/valuators.h" 5 #include "ui/base/x/valuators.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "ui/base/touch/touch_factory.h" 10 #include "ui/base/touch/touch_factory.h"
11 #include "ui/base/x/x11_util.h" 11 #include "ui/base/x/x11_util.h"
12 12
13 namespace { 13 namespace {
14 14
15 #define AXIS_LABEL_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major" 15 #define AXIS_LABEL_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major"
16 #define AXIS_LABEL_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor" 16 #define AXIS_LABEL_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor"
17 #define AXIS_LABEL_ABS_MT_ORIENTATION "Abs MT Orientation" 17 #define AXIS_LABEL_ABS_MT_ORIENTATION "Abs MT Orientation"
18 #define AXIS_LABEL_ABS_MT_PRESSURE "Abs MT Pressure" 18 #define AXIS_LABEL_ABS_MT_PRESSURE "Abs MT Pressure"
19 #define AXIS_LABEL_ABS_MT_SLOT_ID "Abs MT Slot ID" 19 #define AXIS_LABEL_ABS_MT_SLOT_ID "Abs MT Slot ID"
20 #define AXIS_LABEL_ABS_MT_TRACKING_ID "Abs MT Tracking ID" 20 #define AXIS_LABEL_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
21 #define AXIS_LABEL_TOUCH_TIMESTAMP "Touch Timestamp"
21 22
22 // Given the Valuator, return the correspoding XIValuatorClassInfo using 23 // Given the Valuator, return the correspoding XIValuatorClassInfo using
23 // the X device information through Atom name matching. 24 // the X device information through Atom name matching.
24 XIValuatorClassInfo* FindValuator(Display* display, 25 XIValuatorClassInfo* FindValuator(Display* display,
25 XIDeviceInfo* info, 26 XIDeviceInfo* info,
26 ui::ValuatorTracker::Valuator val) { 27 ui::ValuatorTracker::Valuator val) {
27 // Lookup table for mapping Valuator to Atom string used in X. 28 // Lookup table for mapping Valuator to Atom string used in X.
28 // A full set of Atom strings can be found at xserver-properties.h. 29 // A full set of Atom strings can be found at xserver-properties.h.
29 static struct { 30 static struct {
30 ui::ValuatorTracker::Valuator val; 31 ui::ValuatorTracker::Valuator val;
31 Atom atom; 32 Atom atom;
32 } kValuatorAtom[] = { 33 } kValuatorAtom[] = {
33 { ui::ValuatorTracker::VAL_TOUCH_MAJOR, 34 { ui::ValuatorTracker::VAL_TOUCH_MAJOR,
34 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TOUCH_MAJOR, false) }, 35 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TOUCH_MAJOR, false) },
35 { ui::ValuatorTracker::VAL_TOUCH_MINOR, 36 { ui::ValuatorTracker::VAL_TOUCH_MINOR,
36 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TOUCH_MINOR, false) }, 37 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TOUCH_MINOR, false) },
37 { ui::ValuatorTracker::VAL_ORIENTATION, 38 { ui::ValuatorTracker::VAL_ORIENTATION,
38 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_ORIENTATION, false) }, 39 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_ORIENTATION, false) },
39 { ui::ValuatorTracker::VAL_PRESSURE, 40 { ui::ValuatorTracker::VAL_PRESSURE,
40 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_PRESSURE, false) }, 41 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_PRESSURE, false) },
41 #if !defined(USE_XI2_MT) 42 #if !defined(USE_XI2_MT)
42 // For Slot ID, See this chromeos revision: http://git.chromium.org/gitweb/? 43 // For Slot ID, See this chromeos revision: http://git.chromium.org/gitweb/?
43 // p=chromiumos/overlays/chromiumos-overlay.git; 44 // p=chromiumos/overlays/chromiumos-overlay.git;
44 // a=commit;h=9164d0a75e48c4867e4ef4ab51f743ae231c059a 45 // a=commit;h=9164d0a75e48c4867e4ef4ab51f743ae231c059a
45 { ui::ValuatorTracker::VAL_SLOT_ID, 46 { ui::ValuatorTracker::VAL_SLOT_ID,
46 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_SLOT_ID, false) }, 47 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_SLOT_ID, false) },
47 #endif 48 #endif
48 { ui::ValuatorTracker::VAL_TRACKING_ID, 49 { ui::ValuatorTracker::VAL_TRACKING_ID,
49 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TRACKING_ID, false) }, 50 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_ABS_MT_TRACKING_ID, false) },
51 { ui::ValuatorTracker::VAL_TOUCH_RAW_TIMESTAMP,
52 XInternAtom(ui::GetXDisplay(), AXIS_LABEL_TOUCH_TIMESTAMP, false) },
50 { ui::ValuatorTracker::VAL_LAST_ENTRY, None }, 53 { ui::ValuatorTracker::VAL_LAST_ENTRY, None },
51 }; 54 };
52 55
53 Atom atom = None; 56 Atom atom = None;
54 57
55 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kValuatorAtom); i++) { 58 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kValuatorAtom); i++) {
56 if (val == kValuatorAtom[i].val) { 59 if (val == kValuatorAtom[i].val) {
57 atom = kValuatorAtom[i].atom; 60 atom = kValuatorAtom[i].atom;
58 break; 61 break;
59 } 62 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 valuator_max_[info->deviceid][j] = valuator->max; 177 valuator_max_[info->deviceid][j] = valuator->max;
175 } 178 }
176 } 179 }
177 } 180 }
178 181
179 if (info_list) 182 if (info_list)
180 XIFreeDeviceInfo(info_list); 183 XIFreeDeviceInfo(info_list);
181 } 184 }
182 185
183 } // namespace ui 186 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/valuators.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698