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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/event_device_info.cc
diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc
index 858f57c1af159f47bdbccb489933867290c0aa22..2734b9d2f49b101d07151ac4a9f671dd143264b2 100644
--- a/ui/events/ozone/evdev/event_device_info.cc
+++ b/ui/events/ozone/evdev/event_device_info.cc
@@ -149,4 +149,41 @@ int32 EventDeviceInfo::GetAbsMaximum(unsigned int code) const {
return abs_info_[code].maximum;
}
+bool EventDeviceInfo::HasAbsXY() const {
+ if (HasAbsEvent(ABS_X) && HasAbsEvent(ABS_Y))
+ return true;
+
+ if (HasAbsEvent(ABS_MT_POSITION_X) && HasAbsEvent(ABS_MT_POSITION_Y))
+ return true;
+
+ return false;
+}
+
+bool EventDeviceInfo::HasRelXY() const {
+ return HasRelEvent(REL_X) && HasRelEvent(REL_Y);
+}
+
+bool EventDeviceInfo::IsMappedToScreen() const {
+ // Device position is mapped directly to the screen.
+ if (HasProp(INPUT_PROP_DIRECT))
+ return true;
+
+ // Device position moves the cursor.
+ if (HasProp(INPUT_PROP_POINTER))
+ return false;
+
+ // Tablets are mapped to the screen.
+ if (HasKeyEvent(BTN_TOOL_PEN) || HasKeyEvent(BTN_STYLUS) ||
+ HasKeyEvent(BTN_STYLUS2))
+ return true;
+
+ // Touchpads are not mapped to the screen.
+ if (HasKeyEvent(BTN_LEFT) || HasKeyEvent(BTN_MIDDLE) ||
+ HasKeyEvent(BTN_RIGHT) || HasKeyEvent(BTN_TOOL_FINGER))
+ return false;
+
+ // Touchscreens are mapped to the screen.
+ return true;
+}
+
} // namespace ui
« 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