Bug 859951 - Split MotionEvent's action into mask and index in Java rather than in JNI code. r=wesj

This commit is contained in:
Kartikaya Gupta 2013-04-17 17:39:11 -04:00
parent 14bfbafe0a
commit 3dda6378db
4 changed files with 6 additions and 10 deletions

View File

@ -336,11 +336,11 @@ public class GeckoEvent {
}
private void initMotionEvent(MotionEvent m) {
mAction = m.getAction();
mAction = m.getActionMasked();
mTime = (System.currentTimeMillis() - SystemClock.elapsedRealtime()) + m.getEventTime();
mMetaState = m.getMetaState();
switch (mAction & MotionEvent.ACTION_MASK) {
switch (mAction) {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
@ -356,7 +356,7 @@ public class GeckoEvent {
mOrientations = new float[mCount];
mPressures = new float[mCount];
mPointRadii = new Point[mCount];
mPointerIndex = (mAction & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
mPointerIndex = m.getActionIndex();
for (int i = 0; i < mCount; i++) {
addMotionPoint(i, i, m);
}

View File

@ -697,8 +697,7 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
int startIndex = 0;
int endIndex = Count();
int action = Action() & AndroidMotionEvent::ACTION_MASK;
switch (action) {
switch (Action()) {
case AndroidMotionEvent::ACTION_DOWN:
case AndroidMotionEvent::ACTION_POINTER_DOWN: {
type = NS_TOUCH_START;

View File

@ -546,7 +546,6 @@ class AndroidMotionEvent
{
public:
enum {
ACTION_MASK = 0xff,
ACTION_DOWN = 0,
ACTION_UP = 1,
ACTION_MOVE = 2,
@ -560,8 +559,6 @@ public:
ACTION_MAGNIFY_START = 11,
ACTION_MAGNIFY = 12,
ACTION_MAGNIFY_END = 13,
ACTION_POINTER_ID_MASK = 0xff00,
ACTION_POINTER_ID_SHIFT = 8,
EDGE_TOP = 0x00000001,
EDGE_BOTTOM = 0x00000002,
EDGE_LEFT = 0x00000004,

View File

@ -1128,7 +1128,7 @@ void
nsWindow::OnMouseEvent(AndroidGeckoEvent *ae)
{
uint32_t msg;
switch (ae->Action() & AndroidMotionEvent::ACTION_MASK) {
switch (ae->Action()) {
#ifndef MOZ_ONLY_TOUCH_EVENTS
case AndroidMotionEvent::ACTION_DOWN:
msg = NS_MOUSE_BUTTON_DOWN;
@ -1250,7 +1250,7 @@ nsWindow::OnNativeGestureEvent(AndroidGeckoEvent *ae)
double delta = ae->X();
int msg = 0;
switch (ae->Action() & AndroidMotionEvent::ACTION_MASK) {
switch (ae->Action()) {
case AndroidMotionEvent::ACTION_MAGNIFY_START:
msg = NS_SIMPLE_GESTURE_MAGNIFY_START;
mStartDist = delta;