From d77178e48e652d5de8eee5d2db400e13e5dcf547 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 18 Sep 2024 22:55:45 +0000 Subject: 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 --- services/inputflinger/include/InputReaderBase.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'services/inputflinger/include') 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 getDisplayViewportByType(ViewportType type) const; std::optional getDisplayViewportByUniqueId(const std::string& uniqueDisplayId) -- cgit v1.2.3-59-g8ed1b