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

Unified Diff: ui/events/ozone/evdev/palm_suppression_filter.h

Issue 2263693003: Add palm suppression feature to EventConverterEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stylus
Patch Set: use touch major = max to recognize palms Created 4 years, 4 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
Index: ui/events/ozone/evdev/palm_suppression_filter.h
diff --git a/ui/events/ozone/evdev/palm_suppression_filter.h b/ui/events/ozone/evdev/palm_suppression_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..9acc286c3ef2e59838f25a02618c26a73a1c0ac1
--- /dev/null
+++ b/ui/events/ozone/evdev/palm_suppression_filter.h
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_OZONE_EVDEV_PALM_SUPPRESSION_FILTER_H_
+#define UI_EVENTS_OZONE_EVDEV_PALM_SUPPRESSION_FILTER_H_
+
+#include <bitset>
+#include <set>
+
+#include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
+#include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
+#include "ui/events/ozone/evdev/touch_evdev_types.h"
+
+namespace ui {
+
+class DeviceEventDispatcherEvdev;
+
+class EVENTS_OZONE_EVDEV_EXPORT PalmSuppressionFilter {
+ public:
+ explicit PalmSuppressionFilter(DeviceEventDispatcherEvdev* dispatcher);
+ virtual ~PalmSuppressionFilter();
+
+ // Returns true if the touch event should be dispatched by the caller.
+ bool FilterTouch(const TouchEventParams& params);
+
+ // Enable palm suppression. Might generate cancel events for existing
+ // touches.
+ void EnableSuppression(bool enabled, base::TimeTicks timestamp);
+
+ // Reset the filter to a clean state which allows all touches.
+ void Reset();
+
+ private:
+ void CancelExistingTouches(base::TimeTicks timestamp);
+
+ DeviceEventDispatcherEvdev* dispatcher_;
+
+ // Bitset of slots that are currently reported to the upper layers
+ std::bitset<kNumTouchEvdevSlots> reported_slots_;
+
+ // Device id of the touchscreen. Initialized with the first call to
+ // FilterTouch.
+ int touch_device_id_ = -1;
+
+ // True when all touch input is currently being suppressed.
+ bool suppressing_ = false;
+
+ // True when all touch input is supposed to pass through.
+ bool pass_through_ = true;
+
+ DISALLOW_COPY_AND_ASSIGN(PalmSuppressionFilter);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_OZONE_EVDEV_PALM_SUPPRESSION_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698