Bug 734854 - Merge PROXIMITY_EVENT with SENSOR_EVENT. r=jdm

This commit is contained in:
Doug Turner 2012-03-20 23:36:17 -07:00
parent c78413b635
commit 5744c93ff7
4 changed files with 9 additions and 24 deletions

View File

@ -88,7 +88,7 @@ public class GeckoEvent {
private static final int VIEWPORT = 20;
private static final int VISITED = 21;
private static final int NETWORK_CHANGED = 22;
private static final int PROXIMITY_EVENT = 23;
private static final int UNUSED3_EVENT = 23;
private static final int ACTIVITY_RESUMING = 24;
private static final int SCREENSHOT = 25;
private static final int UNUSED2_EVENT = 26;
@ -124,7 +124,6 @@ public class GeckoEvent {
public Point[] mPointRadii;
public Rect mRect;
public double mX, mY, mZ;
public double mDistance;
public int mMetaState, mFlags;
public int mKeyCode, mUnicodeChar;
@ -340,10 +339,9 @@ public class GeckoEvent {
break;
case Sensor.TYPE_PROXIMITY:
// bug 734854 - maybe we can get rid of this event. is
// values[1] and values[2] valid?
event = new GeckoEvent(PROXIMITY_EVENT);
event.mDistance = s.values[0];
event = new GeckoEvent(SENSOR_EVENT);
event.mFlags = GeckoHalDefines.SENSOR_PROXIMITY;
event.mX = s.values[0];
break;
}
return event;

View File

@ -165,7 +165,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
jXField = getField("mX", "D");
jYField = getField("mY", "D");
jZField = getField("mZ", "D");
jDistanceField = getField("mDistance", "D");
jRectField = getField("mRect", "Landroid/graphics/Rect;");
jCharactersField = getField("mCharacters", "Ljava/lang/String;");
@ -507,11 +506,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
break;
}
case PROXIMITY_EVENT: {
mDistance = jenv->GetDoubleField(jobj, jDistanceField);
break;
}
case ACTIVITY_STOPPING:
case ACTIVITY_START:
case ACTIVITY_PAUSING:

View File

@ -466,7 +466,6 @@ public:
double X() { return mX; }
double Y() { return mY; }
double Z() { return mZ; }
double Distance() { return mDistance; }
const nsIntRect& Rect() { return mRect; }
nsAString& Characters() { return mCharacters; }
nsAString& CharactersExtra() { return mCharactersExtra; }
@ -502,7 +501,6 @@ protected:
int mRangeType, mRangeStyles;
int mRangeForeColor, mRangeBackColor;
double mX, mY, mZ;
double mDistance;
int mPointerIndex;
nsString mCharacters, mCharactersExtra;
nsRefPtr<nsGeoPosition> mGeoPosition;
@ -586,7 +584,7 @@ public:
VIEWPORT = 20,
VISITED = 21,
NETWORK_CHANGED = 22,
PROXIMITY_EVENT = 23,
UNUSED3_EVENT = 23,
ACTIVITY_RESUMING = 24,
SCREENSHOT = 25,
UNUSED2_EVENT = 26,

View File

@ -352,6 +352,10 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
values.AppendElement(curEvent->Z());
break;
case hal::SENSOR_PROXIMITY:
values.AppendElement(curEvent->X());
break;
default:
__android_log_print(ANDROID_LOG_ERROR,
"Gecko", "### SENSOR_EVENT fired, but type wasn't known %d",
@ -376,15 +380,6 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
break;
}
case AndroidGeckoEvent::PROXIMITY_EVENT: {
InfallibleTArray<float> values;
values.AppendElement(curEvent->Distance());
hal::SensorData sdata(hal::SENSOR_PROXIMITY, PR_Now(), values, hal::SENSOR_ACCURACY_UNKNOWN);
hal::NotifySensorChange(sdata);
break;
}
case AndroidGeckoEvent::ACTIVITY_STOPPING: {
if (curEvent->Flags() > 0)
break;