summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorskyostil <skyostil@chromium.org>2014-10-02 03:08:56 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-02 10:09:12 +0000
commit4db84b031042bf4f99720372f657ff53e4503a16 (patch)
tree5404610852e9b896fd411729e49d4b9adf4e31d8 /content/browser
parent949b6e5050c7a2ee2a894799db19ec325ba911ef (diff)
downloadchromium_src-4db84b031042bf4f99720372f657ff53e4503a16.zip
chromium_src-4db84b031042bf4f99720372f657ff53e4503a16.tar.gz
chromium_src-4db84b031042bf4f99720372f657ff53e4503a16.tar.bz2
Revert of Revert of Use the new java_cpp_enum rule in content. (patchset #1 id:1 of https://codereview.chromium.org/625543002/)
Reason for revert: Oops, wasn't supposed to revert this after all. Original issue's description: > Revert of Use the new java_cpp_enum rule in content. (patchset #8 id:140001 of https://codereview.chromium.org/615893003/) > > Reason for revert: > Fails to compile on several bots: > > https://chromegw.corp.google.com/i/clank.tot/builders/clang-clankium-tot-builder/builds/56800/steps/compile/logs/stdio > > First error: > FAILED: cd ../../clank/native/framework; python <snip ...> > ../../../clank/java/apps/chrome/src/com/google/android/apps/chrome/webapps/FullScreenActivityTab.java:28: error: cannot find symbol > import org.chromium.content.common.TopControlsState; > ^ > symbol: class TopControlsState > location: package org.chromium.content.common > > Original issue's description: > > Use the new java_cpp_enum rule in content. > > > > This moves most of the generated Java enums under content/ to use the > > java_cpp_enum rule removing the need for keeping the enums in > > separate list files and the need for the .template files. > > > > BUG=405532, 351558 > > > > Committed: https://crrev.com/7d5f0a581ba2f0e79b09ecbf6127ad453a861a96 > > Cr-Commit-Position: refs/heads/master@{#297789} > > TBR=jam@chromium.org,yfriedman@chromium.org,scottmg@chromium.org,jdduke@chromium.org,brettw@chromium.org,mkosiba@chromium.org > NOTREECHECKS=true > NOTRY=true > BUG=405532, 351558 > > Committed: https://crrev.com/949b6e5050c7a2ee2a894799db19ec325ba911ef > Cr-Commit-Position: refs/heads/master@{#297793} TBR=jam@chromium.org,yfriedman@chromium.org,scottmg@chromium.org,jdduke@chromium.org,brettw@chromium.org,mkosiba@chromium.org,perezju@chromium.org NOTREECHECKS=true NOTRY=true BUG=405532, 351558 Review URL: https://codereview.chromium.org/617103007 Cr-Commit-Position: refs/heads/master@{#297794}
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/android/content_view_core_impl.cc47
-rw-r--r--content/browser/android/gesture_event_type.h27
-rw-r--r--content/browser/android/gesture_event_type_list.h33
-rw-r--r--content/browser/android/popup_item_type_list.h23
-rw-r--r--content/browser/gamepad/canonical_axis_index_list.h16
-rw-r--r--content/browser/gamepad/canonical_button_index_list.h28
-rw-r--r--content/browser/gamepad/gamepad_standard_mappings.cc16
-rw-r--r--content/browser/gamepad/gamepad_standard_mappings.h52
-rw-r--r--content/browser/gamepad/gamepad_standard_mappings_linux.cc338
-rw-r--r--content/browser/gamepad/gamepad_standard_mappings_mac.mm396
-rw-r--r--content/browser/gamepad/gamepad_standard_mappings_win.cc183
-rw-r--r--content/browser/renderer_host/input/selection_event_type.h17
-rw-r--r--content/browser/renderer_host/input/selection_event_type_list.h23
13 files changed, 551 insertions, 648 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 9cd9679..d002203 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -70,10 +70,17 @@ using blink::WebInputEvent;
// Describes the type and enabled state of a select popup item.
namespace {
-enum {
-#define DEFINE_POPUP_ITEM_TYPE(name, value) POPUP_ITEM_TYPE_##name = value,
-#include "content/browser/android/popup_item_type_list.h"
-#undef DEFINE_POPUP_ITEM_TYPE
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
+enum PopupItemType {
+ // Popup item is of type group
+ POPUP_ITEM_TYPE_GROUP,
+
+ // Popup item is disabled
+ POPUP_ITEM_TYPE_DISABLED,
+
+ // Popup item is enabled
+ POPUP_ITEM_TYPE_ENABLED,
};
} //namespace
@@ -108,37 +115,37 @@ ScopedJavaLocalRef<jobject> CreateJavaRect(
int ToGestureEventType(WebInputEvent::Type type) {
switch (type) {
case WebInputEvent::GestureScrollBegin:
- return SCROLL_START;
+ return GESTURE_EVENT_TYPE_SCROLL_START;
case WebInputEvent::GestureScrollEnd:
- return SCROLL_END;
+ return GESTURE_EVENT_TYPE_SCROLL_END;
case WebInputEvent::GestureScrollUpdate:
- return SCROLL_BY;
+ return GESTURE_EVENT_TYPE_SCROLL_BY;
case WebInputEvent::GestureFlingStart:
- return FLING_START;
+ return GESTURE_EVENT_TYPE_FLING_START;
case WebInputEvent::GestureFlingCancel:
- return FLING_CANCEL;
+ return GESTURE_EVENT_TYPE_FLING_CANCEL;
case WebInputEvent::GestureShowPress:
- return SHOW_PRESS;
+ return GESTURE_EVENT_TYPE_SHOW_PRESS;
case WebInputEvent::GestureTap:
- return SINGLE_TAP_CONFIRMED;
+ return GESTURE_EVENT_TYPE_SINGLE_TAP_CONFIRMED;
case WebInputEvent::GestureTapUnconfirmed:
- return SINGLE_TAP_UNCONFIRMED;
+ return GESTURE_EVENT_TYPE_SINGLE_TAP_UNCONFIRMED;
case WebInputEvent::GestureTapDown:
- return TAP_DOWN;
+ return GESTURE_EVENT_TYPE_TAP_DOWN;
case WebInputEvent::GestureTapCancel:
- return TAP_CANCEL;
+ return GESTURE_EVENT_TYPE_TAP_CANCEL;
case WebInputEvent::GestureDoubleTap:
- return DOUBLE_TAP;
+ return GESTURE_EVENT_TYPE_DOUBLE_TAP;
case WebInputEvent::GestureLongPress:
- return LONG_PRESS;
+ return GESTURE_EVENT_TYPE_LONG_PRESS;
case WebInputEvent::GestureLongTap:
- return LONG_TAP;
+ return GESTURE_EVENT_TYPE_LONG_TAP;
case WebInputEvent::GesturePinchBegin:
- return PINCH_BEGIN;
+ return GESTURE_EVENT_TYPE_PINCH_BEGIN;
case WebInputEvent::GesturePinchEnd:
- return PINCH_END;
+ return GESTURE_EVENT_TYPE_PINCH_END;
case WebInputEvent::GesturePinchUpdate:
- return PINCH_BY;
+ return GESTURE_EVENT_TYPE_PINCH_BY;
case WebInputEvent::GestureTwoFingerTap:
case WebInputEvent::GestureScrollUpdateWithoutPropagation:
default:
diff --git a/content/browser/android/gesture_event_type.h b/content/browser/android/gesture_event_type.h
index d41311c..ce87c90 100644
--- a/content/browser/android/gesture_event_type.h
+++ b/content/browser/android/gesture_event_type.h
@@ -7,10 +7,31 @@
namespace content {
+// This file contains a list of GestureEventType's usable by ContentViewCore,
+// providing a direct mapping to and from their corresponding
+// blink::WebGestureEvent types.
+//
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser
enum GestureEventType {
-#define DEFINE_GESTURE_EVENT_TYPE(name, value) name = value,
-#include "content/browser/android/gesture_event_type_list.h"
-#undef DEFINE_GESTURE_EVENT_TYPE
+ GESTURE_EVENT_TYPE_SHOW_PRESS,
+ GESTURE_EVENT_TYPE_DOUBLE_TAP,
+ GESTURE_EVENT_TYPE_SINGLE_TAP_UP,
+ GESTURE_EVENT_TYPE_SINGLE_TAP_CONFIRMED,
+ GESTURE_EVENT_TYPE_SINGLE_TAP_UNCONFIRMED,
+ GESTURE_EVENT_TYPE_LONG_PRESS,
+ GESTURE_EVENT_TYPE_SCROLL_START,
+ GESTURE_EVENT_TYPE_SCROLL_BY,
+ GESTURE_EVENT_TYPE_SCROLL_END,
+ GESTURE_EVENT_TYPE_FLING_START,
+ GESTURE_EVENT_TYPE_FLING_CANCEL,
+ GESTURE_EVENT_TYPE_FLING_END,
+ GESTURE_EVENT_TYPE_PINCH_BEGIN,
+ GESTURE_EVENT_TYPE_PINCH_BY,
+ GESTURE_EVENT_TYPE_PINCH_END,
+ GESTURE_EVENT_TYPE_TAP_CANCEL,
+ GESTURE_EVENT_TYPE_LONG_TAP,
+ GESTURE_EVENT_TYPE_TAP_DOWN,
};
} // namespace content
diff --git a/content/browser/android/gesture_event_type_list.h b/content/browser/android/gesture_event_type_list.h
deleted file mode 100644
index 85af616..0000000
--- a/content/browser/android/gesture_event_type_list.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 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.
-
-// This file intentionally does not have header guards because this file
-// is meant to be included inside a macro to generate enum values.
-
-// This file contains a list of GestureEventType's usable by ContentViewCore,
-// providing a direct mapping to and from their corresponding
-// blink::WebGestureEvent types.
-
-#ifndef DEFINE_GESTURE_EVENT_TYPE
-#error "Please define DEFINE_GESTURE_EVENT_TYPE before including this file."
-#endif
-
-DEFINE_GESTURE_EVENT_TYPE(SHOW_PRESS, 0)
-DEFINE_GESTURE_EVENT_TYPE(DOUBLE_TAP, 1)
-DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_UP, 2)
-DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_CONFIRMED, 3)
-DEFINE_GESTURE_EVENT_TYPE(SINGLE_TAP_UNCONFIRMED, 4)
-DEFINE_GESTURE_EVENT_TYPE(LONG_PRESS, 5)
-DEFINE_GESTURE_EVENT_TYPE(SCROLL_START, 6)
-DEFINE_GESTURE_EVENT_TYPE(SCROLL_BY, 7)
-DEFINE_GESTURE_EVENT_TYPE(SCROLL_END, 8)
-DEFINE_GESTURE_EVENT_TYPE(FLING_START, 9)
-DEFINE_GESTURE_EVENT_TYPE(FLING_CANCEL, 10)
-DEFINE_GESTURE_EVENT_TYPE(FLING_END, 11)
-DEFINE_GESTURE_EVENT_TYPE(PINCH_BEGIN, 12)
-DEFINE_GESTURE_EVENT_TYPE(PINCH_BY, 13)
-DEFINE_GESTURE_EVENT_TYPE(PINCH_END, 14)
-DEFINE_GESTURE_EVENT_TYPE(TAP_CANCEL, 15)
-DEFINE_GESTURE_EVENT_TYPE(LONG_TAP, 16)
-DEFINE_GESTURE_EVENT_TYPE(TAP_DOWN, 17)
diff --git a/content/browser/android/popup_item_type_list.h b/content/browser/android/popup_item_type_list.h
deleted file mode 100644
index 3f50490..0000000
--- a/content/browser/android/popup_item_type_list.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2013 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.
-
-// This file intentionally does not have header guards because this file
-// is meant to be included inside a macro to generate enum values.
-
-// This file contains a list of sync PopupItemTypes which describe the type
-// and enabled state of a select popup item. List is used by Android when
-// displaying a new select popup menu.
-
-#ifndef DEFINE_POPUP_ITEM_TYPE
-#error "Please define DEFINE_POPUP_ITEM_TYPE before including this file."
-#endif
-
-// Popup item is of type group
-DEFINE_POPUP_ITEM_TYPE(GROUP, 0)
-
-// Popup item is disabled
-DEFINE_POPUP_ITEM_TYPE(DISABLED, 1)
-
-// Popup item is enabled
-DEFINE_POPUP_ITEM_TYPE(ENABLED, 2)
diff --git a/content/browser/gamepad/canonical_axis_index_list.h b/content/browser/gamepad/canonical_axis_index_list.h
deleted file mode 100644
index 58b85a6..0000000
--- a/content/browser/gamepad/canonical_axis_index_list.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2014 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.
-
-// This file intentionally does not have header guards, it's included
-// inside a macro to generate enum values.
-
-// This file defines the canonical axes mapping order for gamepad-like devices.
-
-// TODO(SaurabhK): Consolidate with CanonicalAxisIndex enum in
-// gamepad_standard_mappings.h, crbug.com/351558.
-CANONICAL_AXIS_INDEX(AXIS_LEFT_STICK_X, 0)
-CANONICAL_AXIS_INDEX(AXIS_LEFT_STICK_Y, 1)
-CANONICAL_AXIS_INDEX(AXIS_RIGHT_STICK_X, 2)
-CANONICAL_AXIS_INDEX(AXIS_RIGHT_STICK_Y, 3)
-CANONICAL_AXIS_INDEX(NUM_CANONICAL_AXES, 4)
diff --git a/content/browser/gamepad/canonical_button_index_list.h b/content/browser/gamepad/canonical_button_index_list.h
deleted file mode 100644
index 153ce0e..0000000
--- a/content/browser/gamepad/canonical_button_index_list.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 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.
-
-// This file intentionally does not have header guards, it's included
-// inside a macro to generate enum values.
-// This defines the canonical button mapping order for gamepad-like devices.
-
-// TODO(SaurabhK): Consolidate with CanonicalButtonIndex enum in
-// gamepad_standard_mappings.h, crbug.com/351558.
-CANONICAL_BUTTON_INDEX(BUTTON_PRIMARY, 0)
-CANONICAL_BUTTON_INDEX(BUTTON_SECONDARY, 1)
-CANONICAL_BUTTON_INDEX(BUTTON_TERTIARY, 2)
-CANONICAL_BUTTON_INDEX(BUTTON_QUATERNARY, 3)
-CANONICAL_BUTTON_INDEX(BUTTON_LEFT_SHOULDER, 4)
-CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_SHOULDER, 5)
-CANONICAL_BUTTON_INDEX(BUTTON_LEFT_TRIGGER, 6)
-CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_TRIGGER, 7)
-CANONICAL_BUTTON_INDEX(BUTTON_BACK_SELECT, 8)
-CANONICAL_BUTTON_INDEX(BUTTON_START, 9)
-CANONICAL_BUTTON_INDEX(BUTTON_LEFT_THUMBSTICK, 10)
-CANONICAL_BUTTON_INDEX(BUTTON_RIGHT_THUMBSTICK, 11)
-CANONICAL_BUTTON_INDEX(BUTTON_DPAD_UP, 12)
-CANONICAL_BUTTON_INDEX(BUTTON_DPAD_DOWN, 13)
-CANONICAL_BUTTON_INDEX(BUTTON_DPAD_LEFT, 14)
-CANONICAL_BUTTON_INDEX(BUTTON_DPAD_RIGHT, 15)
-CANONICAL_BUTTON_INDEX(BUTTON_META, 16)
-CANONICAL_BUTTON_INDEX(NUM_CANONICAL_BUTTONS, 17) \ No newline at end of file
diff --git a/content/browser/gamepad/gamepad_standard_mappings.cc b/content/browser/gamepad/gamepad_standard_mappings.cc
index 7f159e1..687d4ce1 100644
--- a/content/browser/gamepad/gamepad_standard_mappings.cc
+++ b/content/browser/gamepad/gamepad_standard_mappings.cc
@@ -51,14 +51,14 @@ void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
left = dir >= .4f && dir <= 1.f;
}
- mapped->buttons[kButtonDpadUp].pressed = up;
- mapped->buttons[kButtonDpadUp].value = up ? 1.f : 0.f;
- mapped->buttons[kButtonDpadRight].pressed = right;
- mapped->buttons[kButtonDpadRight].value = right ? 1.f : 0.f;
- mapped->buttons[kButtonDpadDown].pressed = down;
- mapped->buttons[kButtonDpadDown].value = down ? 1.f : 0.f;
- mapped->buttons[kButtonDpadLeft].pressed = left;
- mapped->buttons[kButtonDpadLeft].value = left ? 1.f : 0.f;
+ mapped->buttons[BUTTON_INDEX_DPAD_UP].pressed = up;
+ mapped->buttons[BUTTON_INDEX_DPAD_UP].value = up ? 1.f : 0.f;
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].pressed = right;
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].value = right ? 1.f : 0.f;
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN].pressed = down;
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN].value = down ? 1.f : 0.f;
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT].pressed = left;
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT].value = left ? 1.f : 0.f;
}
} // namespace content
diff --git a/content/browser/gamepad/gamepad_standard_mappings.h b/content/browser/gamepad/gamepad_standard_mappings.h
index 5a71cc8..d4908ef 100644
--- a/content/browser/gamepad/gamepad_standard_mappings.h
+++ b/content/browser/gamepad/gamepad_standard_mappings.h
@@ -24,33 +24,39 @@ GamepadStandardMappingFunction GetGamepadStandardMappingFunction(
// general, err towards leaving it *unmapped* so that content can handle
// appropriately.
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
+// GENERATED_JAVA_PREFIX_TO_STRIP: BUTTON_INDEX_
enum CanonicalButtonIndex {
- kButtonPrimary,
- kButtonSecondary,
- kButtonTertiary,
- kButtonQuaternary,
- kButtonLeftShoulder,
- kButtonRightShoulder,
- kButtonLeftTrigger,
- kButtonRightTrigger,
- kButtonBackSelect,
- kButtonStart,
- kButtonLeftThumbstick,
- kButtonRightThumbstick,
- kButtonDpadUp,
- kButtonDpadDown,
- kButtonDpadLeft,
- kButtonDpadRight,
- kButtonMeta,
- kNumButtons
+ BUTTON_INDEX_PRIMARY,
+ BUTTON_INDEX_SECONDARY,
+ BUTTON_INDEX_TERTIARY,
+ BUTTON_INDEX_QUATERNARY,
+ BUTTON_INDEX_LEFT_SHOULDER,
+ BUTTON_INDEX_RIGHT_SHOULDER,
+ BUTTON_INDEX_LEFT_TRIGGER,
+ BUTTON_INDEX_RIGHT_TRIGGER,
+ BUTTON_INDEX_BACK_SELECT,
+ BUTTON_INDEX_START,
+ BUTTON_INDEX_LEFT_THUMBSTICK,
+ BUTTON_INDEX_RIGHT_THUMBSTICK,
+ BUTTON_INDEX_DPAD_UP,
+ BUTTON_INDEX_DPAD_DOWN,
+ BUTTON_INDEX_DPAD_LEFT,
+ BUTTON_INDEX_DPAD_RIGHT,
+ BUTTON_INDEX_META,
+ BUTTON_INDEX_COUNT
};
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
+// GENERATED_JAVA_PREFIX_TO_STRIP: AXIS_INDEX_
enum CanonicalAxisIndex {
- kAxisLeftStickX,
- kAxisLeftStickY,
- kAxisRightStickX,
- kAxisRightStickY,
- kNumAxes
+ AXIS_INDEX_LEFT_STICK_X,
+ AXIS_INDEX_LEFT_STICK_Y,
+ AXIS_INDEX_RIGHT_STICK_X,
+ AXIS_INDEX_RIGHT_STICK_Y,
+ AXIS_INDEX_COUNT
};
// Matches XInput's trigger deadzone
diff --git a/content/browser/gamepad/gamepad_standard_mappings_linux.cc b/content/browser/gamepad/gamepad_standard_mappings_linux.cc
index 2465938..a085242 100644
--- a/content/browser/gamepad/gamepad_standard_mappings_linux.cc
+++ b/content/browser/gamepad/gamepad_standard_mappings_linux.cc
@@ -8,186 +8,182 @@ namespace content {
namespace {
-void MapperXInputStyleGamepad(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperXInputStyleGamepad(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[6];
- mapped->buttons[kButtonStart] = input.buttons[7];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[9];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[10];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[8];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperLakeviewResearch(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperLakeviewResearch(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
- mapped->buttons[kButtonBackSelect] = input.buttons[9];
- mapped->buttons[kButtonStart] = input.buttons[8];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[4]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[4]);
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[4]);
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperPlaystationSixAxis(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperPlaystationSixAxis(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[14];
- mapped->buttons[kButtonSecondary] = input.buttons[13];
- mapped->buttons[kButtonTertiary] = input.buttons[15];
- mapped->buttons[kButtonQuaternary] = input.buttons[12];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[10];
- mapped->buttons[kButtonRightShoulder] = input.buttons[11];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[12]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[13]);
- mapped->buttons[kButtonBackSelect] = input.buttons[0];
- mapped->buttons[kButtonStart] = input.buttons[3];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[1];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[2];
- mapped->buttons[kButtonDpadUp] = AxisToButton(input.axes[8]);
- mapped->buttons[kButtonDpadDown] = AxisToButton(input.axes[10]);
- mapped->buttons[kButtonDpadLeft] = input.buttons[7];
- mapped->buttons[kButtonDpadRight] = AxisToButton(input.axes[9]);
- mapped->buttons[kButtonMeta] = input.buttons[16];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[12]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[13]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisToButton(input.axes[8]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisToButton(input.axes[10]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = AxisToButton(input.axes[9]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[16];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperDualshock4(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDualshock4(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
enum Dualshock4Buttons {
- kTouchpadButton = kNumButtons,
- kNumDualshock4Buttons
+ DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT,
+ DUALSHOCK_BUTTON_COUNT
};
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->buttons[kButtonQuaternary] = input.buttons[3];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[4];
- mapped->buttons[kButtonRightShoulder] = input.buttons[5];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = input.buttons[8];
- mapped->buttons[kButtonStart] = input.buttons[9];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[10];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[11];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->buttons[kTouchpadButton] = input.buttons[13];
- mapped->axes[kAxisRightStickY] = input.axes[5];
-
- mapped->buttonsLength = kNumDualshock4Buttons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
+
+ mapped->buttonsLength = DUALSHOCK_BUTTON_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperXGEAR(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperXGEAR(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[4]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[4]);
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[2];
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[4]);
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[2];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-
-void MapperDragonRiseGeneric(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDragonRiseGeneric(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[5]);
- mapped->axes[kAxisLeftStickX] = input.axes[0];
- mapped->axes[kAxisLeftStickY] = input.axes[1];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[5]);
+ mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperOnLiveWireless(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperOnLiveWireless(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[6];
- mapped->buttons[kButtonStart] = input.buttons[7];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[9];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[10];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[8];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperADT1(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperADT1(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = NullButton();
- mapped->buttons[kButtonStart] = NullButton();
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[7];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[8];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[6];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
+ mapped->buttons[BUTTON_INDEX_START] = NullButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[6];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
struct MappingData {
@@ -195,21 +191,23 @@ struct MappingData {
const char* const product_id;
GamepadStandardMappingFunction function;
} AvailableMappings[] = {
- // http://www.linux-usb.org/usb.ids
- { "0079", "0006", MapperDragonRiseGeneric }, // DragonRise Generic USB
- { "045e", "028e", MapperXInputStyleGamepad }, // Xbox 360 Controller
- { "045e", "028f", MapperXInputStyleGamepad }, // Xbox 360 Wireless Controller
- { "046d", "c21d", MapperXInputStyleGamepad }, // Logitech F310
- { "046d", "c21e", MapperXInputStyleGamepad }, // Logitech F510
- { "046d", "c21f", MapperXInputStyleGamepad }, // Logitech F710
- { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS
- { "054c", "05c4", MapperDualshock4 }, // Playstation Dualshock 4
- { "0925", "0005", MapperLakeviewResearch }, // SmartJoy PLUS Adapter
- { "0925", "8866", MapperLakeviewResearch }, // WiseGroup MP-8866
- { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller
- { "2378", "1008", MapperOnLiveWireless }, // OnLive Controller (Bluetooth)
- { "2378", "100a", MapperOnLiveWireless }, // OnLive Controller (Wired)
- { "18d1", "2c40", MapperADT1 }, // ADT-1 Controller
+ // http://www.linux-usb.org/usb.ids
+ {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
+ {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Controller
+ {"045e",
+ "028f",
+ MapperXInputStyleGamepad}, // Xbox 360 Wireless Controller
+ {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310
+ {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510
+ {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710
+ {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
+ {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
+ {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter
+ {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866
+ {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller
+ {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth)
+ {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired)
+ {"18d1", "2c40", MapperADT1}, // ADT-1 Controller
};
} // namespace
diff --git a/content/browser/gamepad/gamepad_standard_mappings_mac.mm b/content/browser/gamepad/gamepad_standard_mappings_mac.mm
index 50bdbc0..ebb08ed 100644
--- a/content/browser/gamepad/gamepad_standard_mappings_mac.mm
+++ b/content/browser/gamepad/gamepad_standard_mappings_mac.mm
@@ -8,245 +8,233 @@ namespace content {
namespace {
-void MapperXbox360Gamepad(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperXbox360Gamepad(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[9];
- mapped->buttons[kButtonStart] = input.buttons[8];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[6];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[7];
- mapped->buttons[kButtonDpadUp] = input.buttons[11];
- mapped->buttons[kButtonDpadDown] = input.buttons[12];
- mapped->buttons[kButtonDpadLeft] = input.buttons[13];
- mapped->buttons[kButtonDpadRight] = input.buttons[14];
- mapped->buttons[kButtonMeta] = input.buttons[10];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[12];
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[10];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperPlaystationSixAxis(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperPlaystationSixAxis(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[14];
- mapped->buttons[kButtonSecondary] = input.buttons[13];
- mapped->buttons[kButtonTertiary] = input.buttons[15];
- mapped->buttons[kButtonQuaternary] = input.buttons[12];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[10];
- mapped->buttons[kButtonRightShoulder] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11];
- mapped->buttons[kButtonLeftTrigger] = ButtonFromButtonAndAxis(
- input.buttons[8], input.axes[14]);
- mapped->buttons[kButtonRightTrigger] = ButtonFromButtonAndAxis(
- input.buttons[9], input.axes[15]);
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] =
+ ButtonFromButtonAndAxis(input.buttons[8], input.axes[14]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] =
+ ButtonFromButtonAndAxis(input.buttons[9], input.axes[15]);
- mapped->buttons[kButtonBackSelect] = input.buttons[0];
- mapped->buttons[kButtonStart] = input.buttons[3];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[1];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[2];
// The SixAxis Dpad is pressure sensative
- mapped->buttons[kButtonDpadUp] = ButtonFromButtonAndAxis(
- input.buttons[4], input.axes[10]);
- mapped->buttons[kButtonDpadDown] = ButtonFromButtonAndAxis(
- input.buttons[6], input.axes[12]);
- mapped->buttons[kButtonDpadLeft] = ButtonFromButtonAndAxis(
- input.buttons[7], input.axes[13]);
- mapped->buttons[kButtonDpadRight] = ButtonFromButtonAndAxis(
- input.buttons[5], input.axes[11]);
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] =
+ ButtonFromButtonAndAxis(input.buttons[4], input.axes[10]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] =
+ ButtonFromButtonAndAxis(input.buttons[6], input.axes[12]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] =
+ ButtonFromButtonAndAxis(input.buttons[7], input.axes[13]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ ButtonFromButtonAndAxis(input.buttons[5], input.axes[11]);
- mapped->buttons[kButtonMeta] = input.buttons[16];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[16];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperDualshock4(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDualshock4(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
enum Dualshock4Buttons {
- kTouchpadButton = kNumButtons,
- kNumDualshock4Buttons
+ DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT,
+ DUALSHOCK_BUTTON_COUNT
};
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->buttons[kButtonQuaternary] = input.buttons[3];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[4];
- mapped->buttons[kButtonRightShoulder] = input.buttons[5];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = input.buttons[8];
- mapped->buttons[kButtonStart] = input.buttons[9];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[10];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[11];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->buttons[kTouchpadButton] = input.buttons[13];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumDualshock4Buttons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = DUALSHOCK_BUTTON_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperDirectInputStyle(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDirectInputStyle(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons - 1; /* no meta */
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperMacallyIShock(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperMacallyIShock(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
enum IShockButtons {
- kButtonC = kNumButtons,
- kButtonD,
- kButtonE,
- kNumIShockButtons
+ ISHOCK_BUTTON_C = BUTTON_INDEX_COUNT,
+ ISHOCK_BUTTON_D,
+ ISHOCK_BUTTON_E,
+ ISHOCK_BUTTON_COUNT,
};
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[6];
- mapped->buttons[kButtonSecondary] = input.buttons[5];
- mapped->buttons[kButtonTertiary] = input.buttons[7];
- mapped->buttons[kButtonQuaternary] = input.buttons[4];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[14];
- mapped->buttons[kButtonRightShoulder] = input.buttons[12];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[15];
- mapped->buttons[kButtonRightTrigger] = input.buttons[13];
- mapped->buttons[kButtonBackSelect] = input.buttons[9];
- mapped->buttons[kButtonStart] = input.buttons[10];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[16];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[17];
- mapped->buttons[kButtonDpadUp] = input.buttons[0];
- mapped->buttons[kButtonDpadDown] = input.buttons[1];
- mapped->buttons[kButtonDpadLeft] = input.buttons[2];
- mapped->buttons[kButtonDpadRight] = input.buttons[3];
- mapped->buttons[kButtonMeta] = input.buttons[11];
- mapped->buttons[kButtonC] = input.buttons[8];
- mapped->buttons[kButtonD] = input.buttons[18];
- mapped->buttons[kButtonE] = input.buttons[19];
- mapped->axes[kAxisLeftStickX] = input.axes[0];
- mapped->axes[kAxisLeftStickY] = input.axes[1];
- mapped->axes[kAxisRightStickX] = -input.axes[5];
- mapped->axes[kAxisRightStickY] = input.axes[6];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[12];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[15];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[16];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[17];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[11];
+ mapped->buttons[ISHOCK_BUTTON_C] = input.buttons[8];
+ mapped->buttons[ISHOCK_BUTTON_D] = input.buttons[18];
+ mapped->buttons[ISHOCK_BUTTON_E] = input.buttons[19];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = -input.axes[5];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[6];
- mapped->buttonsLength = kNumIShockButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = ISHOCK_BUTTON_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperXGEAR(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperXGEAR(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->axes[kAxisRightStickX] = input.axes[5];
- mapped->axes[kAxisRightStickY] = input.axes[2];
- mapped->buttonsLength = kNumButtons - 1; /* no meta */
- mapped->axesLength = kNumAxes;
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[5];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[2];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperSmartJoyPLUS(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperSmartJoyPLUS(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonStart] = input.buttons[8];
- mapped->buttons[kButtonBackSelect] = input.buttons[9];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->axes[kAxisRightStickY] = input.axes[5];
- mapped->buttonsLength = kNumButtons - 1; /* no meta */
- mapped->axesLength = kNumAxes;
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperDragonRiseGeneric(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDragonRiseGeneric(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
DpadFromAxis(mapped, input.axes[9]);
- mapped->axes[kAxisLeftStickX] = input.axes[0];
- mapped->axes[kAxisLeftStickY] = input.axes[1];
- mapped->axes[kAxisRightStickX] = input.axes[2];
- mapped->axes[kAxisRightStickY] = input.axes[5];
- mapped->buttonsLength = kNumButtons - 1; /* no meta */
- mapped->axesLength = kNumAxes;
+ mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[2];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperOnLiveWireless(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperOnLiveWireless(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[0];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[4];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[10];
- mapped->buttons[kButtonStart] = input.buttons[11];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[13];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[14];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperADT1(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperADT1(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[0];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[4];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = NullButton();
- mapped->buttons[kButtonStart] = NullButton();
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[13];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[14];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
+ mapped->buttons[BUTTON_INDEX_START] = NullButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
struct MappingData {
@@ -254,22 +242,22 @@ struct MappingData {
const char* const product_id;
GamepadStandardMappingFunction function;
} AvailableMappings[] = {
- // http://www.linux-usb.org/usb.ids
- { "0079", "0006", MapperDragonRiseGeneric }, // DragonRise Generic USB
- { "045e", "028e", MapperXbox360Gamepad }, // Xbox 360 Controller
- { "045e", "028f", MapperXbox360Gamepad }, // Xbox 360 Wireless Controller
- { "046d", "c216", MapperDirectInputStyle }, // Logitech F310, D mode
- { "046d", "c218", MapperDirectInputStyle }, // Logitech F510, D mode
- { "046d", "c219", MapperDirectInputStyle }, // Logitech F710, D mode
- { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS
- { "054c", "05c4", MapperDualshock4 }, // Playstation Dualshock 4
- { "0925", "0005", MapperSmartJoyPLUS }, // SmartJoy PLUS Adapter
- { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller
- { "2222", "0060", MapperDirectInputStyle }, // Macally iShockX, analog mode
- { "2222", "4010", MapperMacallyIShock }, // Macally iShock
- { "2378", "1008", MapperOnLiveWireless }, // OnLive Controller (Bluetooth)
- { "2378", "100a", MapperOnLiveWireless }, // OnLive Controller (Wired)
- { "18d1", "2c40", MapperADT1 }, // ADT-1 Controller
+ // http://www.linux-usb.org/usb.ids
+ {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
+ {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Controller
+ {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless Controller
+ {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode
+ {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode
+ {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode
+ {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
+ {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
+ {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter
+ {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller
+ {"2222", "0060", MapperDirectInputStyle}, // Macally iShockX, analog mode
+ {"2222", "4010", MapperMacallyIShock}, // Macally iShock
+ {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth)
+ {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired)
+ {"18d1", "2c40", MapperADT1}, // ADT-1 Controller
};
} // namespace
diff --git a/content/browser/gamepad/gamepad_standard_mappings_win.cc b/content/browser/gamepad/gamepad_standard_mappings_win.cc
index f79b451..93c1851 100644
--- a/content/browser/gamepad/gamepad_standard_mappings_win.cc
+++ b/content/browser/gamepad/gamepad_standard_mappings_win.cc
@@ -8,121 +8,116 @@ namespace content {
namespace {
-void MapperLogitechDualAction(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperLogitechDualAction(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void Mapper2Axes8Keys(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void Mapper2Axes8Keys(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[1]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[1]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[0]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[0]);
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[1]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[1]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[0]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[0]);
// Missing buttons
- mapped->buttons[kButtonLeftTrigger] = blink::WebGamepadButton();
- mapped->buttons[kButtonRightTrigger] = blink::WebGamepadButton();
- mapped->buttons[kButtonLeftThumbstick] = blink::WebGamepadButton();
- mapped->buttons[kButtonRightThumbstick] = blink::WebGamepadButton();
- mapped->buttons[kButtonMeta] = blink::WebGamepadButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = blink::WebGamepadButton();
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = blink::WebGamepadButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = blink::WebGamepadButton();
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = blink::WebGamepadButton();
+ mapped->buttons[BUTTON_INDEX_META] = blink::WebGamepadButton();
- mapped->buttonsLength = kNumButtons - 1;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1;
mapped->axesLength = 0;
}
-void MapperDualshock4(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperDualshock4(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
enum Dualshock4Buttons {
- kTouchpadButton = kNumButtons,
- kNumDualshock4Buttons
+ DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT,
+ DUALSHOCK_BUTTON_COUNT
};
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->buttons[kButtonQuaternary] = input.buttons[3];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[4];
- mapped->buttons[kButtonRightShoulder] = input.buttons[5];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = input.buttons[8];
- mapped->buttons[kButtonStart] = input.buttons[9];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[10];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[11];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->buttons[kTouchpadButton] = input.buttons[13];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumDualshock4Buttons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = DUALSHOCK_BUTTON_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperOnLiveWireless(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperOnLiveWireless(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[0];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[4];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[10];
- mapped->buttons[kButtonStart] = input.buttons[11];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[13];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[14];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
-void MapperADT1(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperADT1(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[0];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[4];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonBackSelect] = NullButton();
- mapped->buttons[kButtonStart] = NullButton();
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[13];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[14];
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->axes[kAxisRightStickY] = input.axes[5];
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
+ mapped->buttons[BUTTON_INDEX_START] = NullButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
DpadFromAxis(mapped, input.axes[9]);
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
struct MappingData {
@@ -130,13 +125,13 @@ struct MappingData {
const char* const product_id;
GamepadStandardMappingFunction function;
} AvailableMappings[] = {
- // http://www.linux-usb.org/usb.ids
- { "046d", "c216", MapperLogitechDualAction }, // Logitech DualAction
- { "0079", "0011", Mapper2Axes8Keys }, // 2Axes 8Keys Game Pad
- { "054c", "05c4", MapperDualshock4 }, // Playstation Dualshock 4
- { "2378", "1008", MapperOnLiveWireless }, // OnLive Controller (Bluetooth)
- { "2378", "100a", MapperOnLiveWireless }, // OnLive Controller (Wired)
- { "18d1", "2c40", MapperADT1 }, // ADT-1 Controller
+ // http://www.linux-usb.org/usb.ids
+ {"046d", "c216", MapperLogitechDualAction}, // Logitech DualAction
+ {"0079", "0011", Mapper2Axes8Keys}, // 2Axes 8Keys Game Pad
+ {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
+ {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth)
+ {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired)
+ {"18d1", "2c40", MapperADT1}, // ADT-1 Controller
};
} // namespace
diff --git a/content/browser/renderer_host/input/selection_event_type.h b/content/browser/renderer_host/input/selection_event_type.h
index 0bf7673..567259f 100644
--- a/content/browser/renderer_host/input/selection_event_type.h
+++ b/content/browser/renderer_host/input/selection_event_type.h
@@ -7,10 +7,21 @@
namespace content {
+// This file contains a list of events relating to selection and insertion, used
+// for notifying Java when the renderer selection has changed.
+//
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input
enum SelectionEventType {
-#define DEFINE_SELECTION_EVENT_TYPE(name, value) name = value,
-#include "content/browser/renderer_host/input/selection_event_type_list.h"
-#undef DEFINE_SELECTION_EVENT_TYPE
+ SELECTION_SHOWN,
+ SELECTION_CLEARED,
+ SELECTION_DRAG_STARTED,
+ SELECTION_DRAG_STOPPED,
+ INSERTION_SHOWN,
+ INSERTION_MOVED,
+ INSERTION_TAPPED,
+ INSERTION_CLEARED,
+ INSERTION_DRAG_STARTED,
};
} // namespace content
diff --git a/content/browser/renderer_host/input/selection_event_type_list.h b/content/browser/renderer_host/input/selection_event_type_list.h
deleted file mode 100644
index b4f3852..0000000
--- a/content/browser/renderer_host/input/selection_event_type_list.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2014 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.
-
-// This file intentionally does not have header guards because this file
-// is meant to be included inside a macro to generate enum values.
-
-// This file contains a list of events relating to selection and insertion, used
-// for notifying Java when the renderer selection has changed.
-
-#ifndef DEFINE_SELECTION_EVENT_TYPE
-#error "Please define DEFINE_SELECTION_EVENT_TYPE before including this file."
-#endif
-
-DEFINE_SELECTION_EVENT_TYPE(SELECTION_SHOWN, 0)
-DEFINE_SELECTION_EVENT_TYPE(SELECTION_CLEARED, 1)
-DEFINE_SELECTION_EVENT_TYPE(SELECTION_DRAG_STARTED, 2)
-DEFINE_SELECTION_EVENT_TYPE(SELECTION_DRAG_STOPPED, 3)
-DEFINE_SELECTION_EVENT_TYPE(INSERTION_SHOWN, 4)
-DEFINE_SELECTION_EVENT_TYPE(INSERTION_MOVED, 5)
-DEFINE_SELECTION_EVENT_TYPE(INSERTION_TAPPED, 6)
-DEFINE_SELECTION_EVENT_TYPE(INSERTION_CLEARED, 7)
-DEFINE_SELECTION_EVENT_TYPE(INSERTION_DRAG_STARTED, 8)