mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 906088 - part 3 - add Preferences events to AndroidGeckoEvent; r=blassey
This is just the C++ side of things; it's simpler to have this code split out as a separate patch to review.
This commit is contained in:
parent
5a8ea91082
commit
88480067e4
@ -61,6 +61,7 @@ jfieldID AndroidGeckoEvent::jScreenOrientationField = 0;
|
||||
jfieldID AndroidGeckoEvent::jByteBufferField = 0;
|
||||
jfieldID AndroidGeckoEvent::jWidthField = 0;
|
||||
jfieldID AndroidGeckoEvent::jHeightField = 0;
|
||||
jfieldID AndroidGeckoEvent::jPrefNamesField = 0;
|
||||
|
||||
jclass AndroidGeckoEvent::jDomKeyLocationClass = 0;
|
||||
jfieldID AndroidGeckoEvent::jDomKeyLocationValueField = 0;
|
||||
@ -204,6 +205,7 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
|
||||
jByteBufferField = getField("mBuffer", "Ljava/nio/ByteBuffer;");
|
||||
jWidthField = getField("mWidth", "I");
|
||||
jHeightField = getField("mHeight", "I");
|
||||
jPrefNamesField = getField("mPrefNames", "[Ljava/lang/String;");
|
||||
|
||||
// Init GeckoEvent.DomKeyLocation enum
|
||||
jDomKeyLocationClass = getClassGlobalRef("org/mozilla/gecko/GeckoEvent$DomKeyLocation");
|
||||
@ -413,6 +415,21 @@ AndroidGeckoEvent::ReadFloatArray(nsTArray<float> &aVals,
|
||||
jenv->ReleaseFloatArrayElements(jFloatArray, vals, JNI_ABORT);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoEvent::ReadStringArray(nsTArray<nsString> &array,
|
||||
JNIEnv *jenv,
|
||||
jfieldID field)
|
||||
{
|
||||
jarray jArray = (jarray)jenv->GetObjectField(wrapped_obj, field);
|
||||
jsize length = jenv->GetArrayLength(jArray);
|
||||
jobjectArray jStringArray = (jobjectArray)jArray;
|
||||
nsString *strings = array.AppendElements(length);
|
||||
for (jsize i = 0; i < length; ++i) {
|
||||
jstring javastring = (jstring) jenv->GetObjectArrayElement(jStringArray, i);
|
||||
ReadStringFromJString(strings[i], jenv, javastring);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoEvent::ReadRectField(JNIEnv *jenv)
|
||||
{
|
||||
@ -648,6 +665,13 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
|
||||
break;
|
||||
}
|
||||
|
||||
case PREFERENCES_OBSERVE:
|
||||
case PREFERENCES_GET: {
|
||||
ReadStringArray(mPrefNames, jenv, jPrefNamesField);
|
||||
mCount = jenv->GetIntField(jobj, jCountField);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -547,6 +547,7 @@ public:
|
||||
const nsTArray<float>& Pressures() { return mPressures; }
|
||||
const nsTArray<float>& Orientations() { return mOrientations; }
|
||||
const nsTArray<nsIntPoint>& PointRadii() { return mPointRadii; }
|
||||
const nsTArray<nsString>& PrefNames() { return mPrefNames; }
|
||||
double X() { return mX; }
|
||||
double Y() { return mY; }
|
||||
double Z() { return mZ; }
|
||||
@ -585,6 +586,7 @@ public:
|
||||
RefCountedJavaObject* ByteBuffer() { return mByteBuffer; }
|
||||
int Width() { return mWidth; }
|
||||
int Height() { return mHeight; }
|
||||
int RequestId() { return mCount; } // for convenience
|
||||
nsTouchEvent MakeTouchEvent(nsIWidget* widget);
|
||||
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
||||
void UnionRect(nsIntRect const& aRect);
|
||||
@ -622,6 +624,7 @@ protected:
|
||||
nsRefPtr<RefCountedJavaObject> mByteBuffer;
|
||||
int mWidth, mHeight;
|
||||
nsCOMPtr<nsIObserver> mObserver;
|
||||
nsTArray<nsString> mPrefNames;
|
||||
|
||||
void ReadIntArray(nsTArray<int> &aVals,
|
||||
JNIEnv *jenv,
|
||||
@ -635,6 +638,9 @@ protected:
|
||||
JNIEnv *jenv,
|
||||
jfieldID field,
|
||||
int32_t count);
|
||||
void ReadStringArray(nsTArray<nsString> &aStrings,
|
||||
JNIEnv *jenv,
|
||||
jfieldID field);
|
||||
void ReadRectField(JNIEnv *jenv);
|
||||
void ReadCharactersField(JNIEnv *jenv);
|
||||
void ReadCharactersExtraField(JNIEnv *jenv);
|
||||
@ -682,6 +688,7 @@ protected:
|
||||
static jfieldID jRangeBackColorField;
|
||||
static jfieldID jRangeLineColorField;
|
||||
static jfieldID jLocationField;
|
||||
static jfieldID jPrefNamesField;
|
||||
|
||||
static jfieldID jBandwidthField;
|
||||
static jfieldID jCanBeMeteredField;
|
||||
@ -729,6 +736,8 @@ public:
|
||||
NETWORK_LINK_CHANGE = 36,
|
||||
TELEMETRY_HISTOGRAM_ADD = 37,
|
||||
ADD_OBSERVER = 38,
|
||||
PREFERENCES_OBSERVE = 39,
|
||||
PREFERENCES_GET = 40,
|
||||
dummy_java_enum_list_end
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user