summaryrefslogtreecommitdiff
path: root/services/inputflinger/include
diff options
context:
space:
mode:
author Jimmy <jimmyxgong@google.com> 2024-09-18 22:55:45 +0000
committer Jimmy <jimmyxgong@google.com> 2024-10-08 20:13:21 +0000
commitd77178e48e652d5de8eee5d2db400e13e5dcf547 (patch)
tree16cd331385045f7edb3977eab119522982081c96 /services/inputflinger/include
parent2ac7e8169faa060ac33deb48847d07fb9fc4e680 (diff)
Mouse: Add support to swap mouse primary button
Bug: 359349392 Bug: 352598211 Test: atest CursorInputMapperUnitTest Flag: com.android.hardware.input.mouse_swap_primary_button Change-Id: I37d70bc0ce37fc0832e6733a0a1c8936cab36ab1
Diffstat (limited to 'services/inputflinger/include')
-rw-r--r--services/inputflinger/include/InputReaderBase.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h
index 69ae587942..756a29b754 100644
--- a/services/inputflinger/include/InputReaderBase.h
+++ b/services/inputflinger/include/InputReaderBase.h
@@ -96,7 +96,8 @@ struct InputReaderConfiguration {
// The key remapping has changed.
KEY_REMAPPING = 1u << 14,
- // The mouse settings changed, this includes mouse reverse vertical scrolling.
+ // The mouse settings changed, this includes mouse reverse vertical scrolling and swap
+ // primary button.
MOUSE_SETTINGS = 1u << 15,
// All devices must be reopened.
@@ -259,6 +260,11 @@ struct InputReaderConfiguration {
// wheel downwards scrolls the content upwards.
bool mouseReverseVerticalScrollingEnabled;
+ // True if the connected mouse should have its primary button (default: left click) swapped,
+ // so that the right click will be the primary action button and the left click will be the
+ // secondary action.
+ bool mouseSwapPrimaryButtonEnabled;
+
InputReaderConfiguration()
: virtualKeyQuietTime(0),
defaultPointerDisplayId(ui::LogicalDisplayId::DEFAULT),
@@ -290,7 +296,8 @@ struct InputReaderConfiguration {
touchpadRightClickZoneEnabled(false),
stylusButtonMotionEventsEnabled(true),
stylusPointerIconEnabled(false),
- mouseReverseVerticalScrollingEnabled(false) {}
+ mouseReverseVerticalScrollingEnabled(false),
+ mouseSwapPrimaryButtonEnabled(false) {}
std::optional<DisplayViewport> getDisplayViewportByType(ViewportType type) const;
std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueDisplayId)