Support pointer capture in InputReader
When pointer capture is enabled, the pointer icon is hidden,
the pointer location is not changing, and CursorInputMapper
generates "captured" events with relative offsets instead of
absolute positions.
Captured events have their source set to a newly introduced
SOURCE_MOUSE_RELATIVE (of SOURCE_CLASS_TRACKBALL).
Test: InputReader_test --gtest_filter=
CursorInputMapperTest.Process_PointerCapture
Bug: 30897034
Change-Id: Id30cb8e7edac56ab813e22a834cc44ab263d1003
diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h
index 8e2fe95..3171526 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -144,6 +144,9 @@
// The presence of an external stylus has changed.
CHANGE_EXTERNAL_STYLUS_PRESENCE = 1 << 7,
+ // The pointer capture mode has changed.
+ CHANGE_POINTER_CAPTURE = 1 << 8,
+
// All devices must be reopened.
CHANGE_MUST_REOPEN = 1 << 31,
};
@@ -231,6 +234,9 @@
// True to show the location of touches on the touch screen as spots.
bool showTouches;
+ // True if pointer capture is enabled.
+ bool pointerCapture;
+
InputReaderConfiguration() :
virtualKeyQuietTime(0),
pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f),
@@ -1200,6 +1206,7 @@
struct Parameters {
enum Mode {
MODE_POINTER,
+ MODE_POINTER_RELATIVE,
MODE_NAVIGATION,
};