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

Side by Side Diff: ui/events/ozone/evdev/event_device_info.cc

Issue 193813003: ozone: evdev: Add libgestures bindings for touchpad & mouse support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved 1 space by 1 character Created 6 years, 8 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/events/ozone/evdev/event_device_info.h ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ozone/evdev/event_device_info.h" 5 #include "ui/events/ozone/evdev/event_device_info.h"
6 6
7 #include <linux/input.h> 7 #include <linux/input.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 int32 EventDeviceInfo::GetAbsMinimum(unsigned int code) const { 144 int32 EventDeviceInfo::GetAbsMinimum(unsigned int code) const {
145 return abs_info_[code].minimum; 145 return abs_info_[code].minimum;
146 } 146 }
147 147
148 int32 EventDeviceInfo::GetAbsMaximum(unsigned int code) const { 148 int32 EventDeviceInfo::GetAbsMaximum(unsigned int code) const {
149 return abs_info_[code].maximum; 149 return abs_info_[code].maximum;
150 } 150 }
151 151
152 bool EventDeviceInfo::HasAbsXY() const {
153 if (HasAbsEvent(ABS_X) && HasAbsEvent(ABS_Y))
154 return true;
155
156 if (HasAbsEvent(ABS_MT_POSITION_X) && HasAbsEvent(ABS_MT_POSITION_Y))
157 return true;
158
159 return false;
160 }
161
162 bool EventDeviceInfo::HasRelXY() const {
163 return HasRelEvent(REL_X) && HasRelEvent(REL_Y);
164 }
165
166 bool EventDeviceInfo::IsMappedToScreen() const {
167 // Device position is mapped directly to the screen.
168 if (HasProp(INPUT_PROP_DIRECT))
169 return true;
170
171 // Device position moves the cursor.
172 if (HasProp(INPUT_PROP_POINTER))
173 return false;
174
175 // Tablets are mapped to the screen.
176 if (HasKeyEvent(BTN_TOOL_PEN) || HasKeyEvent(BTN_STYLUS) ||
177 HasKeyEvent(BTN_STYLUS2))
178 return true;
179
180 // Touchpads are not mapped to the screen.
181 if (HasKeyEvent(BTN_LEFT) || HasKeyEvent(BTN_MIDDLE) ||
182 HasKeyEvent(BTN_RIGHT) || HasKeyEvent(BTN_TOOL_FINGER))
183 return false;
184
185 // Touchscreens are mapped to the screen.
186 return true;
187 }
188
152 } // namespace ui 189 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_info.h ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698