bug 852935 - Add Android gamepad backend. r=snorp, rs=smaug

This commit is contained in:
Ted Mielczarek
2014-04-22 10:53:48 -04:00
parent 2cb03f9fe1
commit 8115881654
17 changed files with 706 additions and 6 deletions

View File

@@ -537,6 +537,11 @@ public:
RefCountedJavaObject* ByteBuffer() { return mByteBuffer; }
int Width() { return mWidth; }
int Height() { return mHeight; }
int ID() { return mID; }
int GamepadButton() { return mGamepadButton; }
bool GamepadButtonPressed() { return mGamepadButtonPressed; }
float GamepadButtonValue() { return mGamepadButtonValue; }
const nsTArray<float>& GamepadValues() { return mGamepadValues; }
int RequestId() { return mCount; } // for convenience
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
@@ -574,6 +579,11 @@ protected:
short mScreenOrientation;
nsRefPtr<RefCountedJavaObject> mByteBuffer;
int mWidth, mHeight;
int mID;
int mGamepadButton;
bool mGamepadButtonPressed;
float mGamepadButtonValue;
nsTArray<float> mGamepadValues;
nsCOMPtr<nsIObserver> mObserver;
nsTArray<nsString> mPrefNames;
@@ -652,6 +662,12 @@ protected:
static jfieldID jWidthField;
static jfieldID jHeightField;
static jfieldID jIDField;
static jfieldID jGamepadButtonField;
static jfieldID jGamepadButtonPressedField;
static jfieldID jGamepadButtonValueField;
static jfieldID jGamepadValuesField;
static jclass jDomKeyLocationClass;
static jfieldID jDomKeyLocationValueField;
@@ -693,6 +709,8 @@ public:
TELEMETRY_UI_SESSION_START = 42,
TELEMETRY_UI_SESSION_STOP = 43,
TELEMETRY_UI_EVENT = 44,
GAMEPAD_ADDREMOVE = 45,
GAMEPAD_DATA = 46,
dummy_java_enum_list_end
};
@@ -719,6 +737,16 @@ public:
IME_ACKNOWLEDGE_FOCUS = 6,
dummy_ime_enum_list_end
};
enum {
ACTION_GAMEPAD_ADDED = 1,
ACTION_GAMEPAD_REMOVED = 2
};
enum {
ACTION_GAMEPAD_BUTTON = 1,
ACTION_GAMEPAD_AXES = 2
};
};
class nsJNIString : public nsString