mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 888482 - Make new event to set layer client in Gecko; r=snorp
This commit is contained in:
parent
df46e75a9c
commit
3418bcd4be
@ -76,6 +76,7 @@ public class GeckoEvent {
|
|||||||
KEY_EVENT(1),
|
KEY_EVENT(1),
|
||||||
MOTION_EVENT(2),
|
MOTION_EVENT(2),
|
||||||
SENSOR_EVENT(3),
|
SENSOR_EVENT(3),
|
||||||
|
PROCESS_OBJECT(4),
|
||||||
LOCATION_EVENT(5),
|
LOCATION_EVENT(5),
|
||||||
IME_EVENT(6),
|
IME_EVENT(6),
|
||||||
SIZE_CHANGED(8),
|
SIZE_CHANGED(8),
|
||||||
@ -183,6 +184,8 @@ public class GeckoEvent {
|
|||||||
public static final int ACTION_GAMEPAD_BUTTON = 1;
|
public static final int ACTION_GAMEPAD_BUTTON = 1;
|
||||||
public static final int ACTION_GAMEPAD_AXES = 2;
|
public static final int ACTION_GAMEPAD_AXES = 2;
|
||||||
|
|
||||||
|
public static final int ACTION_OBJECT_LAYER_CLIENT = 1;
|
||||||
|
|
||||||
private final int mType;
|
private final int mType;
|
||||||
private int mAction;
|
private int mAction;
|
||||||
private boolean mAckNeeded;
|
private boolean mAckNeeded;
|
||||||
@ -245,6 +248,8 @@ public class GeckoEvent {
|
|||||||
|
|
||||||
private String[] mPrefNames;
|
private String[] mPrefNames;
|
||||||
|
|
||||||
|
private Object mObject;
|
||||||
|
|
||||||
private GeckoEvent(NativeGeckoEvent event) {
|
private GeckoEvent(NativeGeckoEvent event) {
|
||||||
mType = event.value;
|
mType = event.value;
|
||||||
}
|
}
|
||||||
@ -597,6 +602,13 @@ public class GeckoEvent {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GeckoEvent createObjectEvent(final int action, final Object object) {
|
||||||
|
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.PROCESS_OBJECT);
|
||||||
|
event.mAction = action;
|
||||||
|
event.mObject = object;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
public static GeckoEvent createLocationEvent(Location l) {
|
public static GeckoEvent createLocationEvent(Location l) {
|
||||||
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.LOCATION_EVENT);
|
GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.LOCATION_EVENT);
|
||||||
event.mLocation = l;
|
event.mLocation = l;
|
||||||
|
@ -71,6 +71,7 @@ jfieldID AndroidGeckoEvent::jGamepadButtonPressedField = 0;
|
|||||||
jfieldID AndroidGeckoEvent::jGamepadButtonValueField = 0;
|
jfieldID AndroidGeckoEvent::jGamepadButtonValueField = 0;
|
||||||
jfieldID AndroidGeckoEvent::jGamepadValuesField = 0;
|
jfieldID AndroidGeckoEvent::jGamepadValuesField = 0;
|
||||||
jfieldID AndroidGeckoEvent::jPrefNamesField = 0;
|
jfieldID AndroidGeckoEvent::jPrefNamesField = 0;
|
||||||
|
jfieldID AndroidGeckoEvent::jObjectField = 0;
|
||||||
|
|
||||||
jclass AndroidGeckoEvent::jDomKeyLocationClass = 0;
|
jclass AndroidGeckoEvent::jDomKeyLocationClass = 0;
|
||||||
jfieldID AndroidGeckoEvent::jDomKeyLocationValueField = 0;
|
jfieldID AndroidGeckoEvent::jDomKeyLocationValueField = 0;
|
||||||
@ -183,6 +184,7 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
|
|||||||
jGamepadButtonValueField = getField("mGamepadButtonValue", "F");
|
jGamepadButtonValueField = getField("mGamepadButtonValue", "F");
|
||||||
jGamepadValuesField = getField("mGamepadValues", "[F");
|
jGamepadValuesField = getField("mGamepadValues", "[F");
|
||||||
jPrefNamesField = getField("mPrefNames", "[Ljava/lang/String;");
|
jPrefNamesField = getField("mPrefNames", "[Ljava/lang/String;");
|
||||||
|
jObjectField = getField("mObject", "Ljava/lang/Object;");
|
||||||
|
|
||||||
// Init GeckoEvent.DomKeyLocation enum
|
// Init GeckoEvent.DomKeyLocation enum
|
||||||
jDomKeyLocationClass = getClassGlobalRef("org/mozilla/gecko/GeckoEvent$DomKeyLocation");
|
jDomKeyLocationClass = getClassGlobalRef("org/mozilla/gecko/GeckoEvent$DomKeyLocation");
|
||||||
@ -503,6 +505,13 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
|
|||||||
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
|
mMetaState = jenv->GetIntField(jobj, jMetaStateField);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROCESS_OBJECT: {
|
||||||
|
const jobject obj = jenv->GetObjectField(jobj, jObjectField);
|
||||||
|
mObject.Init(obj, jenv);
|
||||||
|
jenv->DeleteLocalRef(obj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LOCATION_EVENT: {
|
case LOCATION_EVENT: {
|
||||||
jobject location = jenv->GetObjectField(jobj, jLocationField);
|
jobject location = jenv->GetObjectField(jobj, jLocationField);
|
||||||
mGeoPosition = AndroidLocation::CreateGeoPosition(jenv, location);
|
mGeoPosition = AndroidLocation::CreateGeoPosition(jenv, location);
|
||||||
|
@ -552,6 +552,7 @@ public:
|
|||||||
float GamepadButtonValue() { return mGamepadButtonValue; }
|
float GamepadButtonValue() { return mGamepadButtonValue; }
|
||||||
const nsTArray<float>& GamepadValues() { return mGamepadValues; }
|
const nsTArray<float>& GamepadValues() { return mGamepadValues; }
|
||||||
int RequestId() { return mCount; } // for convenience
|
int RequestId() { return mCount; } // for convenience
|
||||||
|
const AutoGlobalWrappedJavaObject& Object() { return mObject; }
|
||||||
bool CanCoalesceWith(AndroidGeckoEvent* ae);
|
bool CanCoalesceWith(AndroidGeckoEvent* ae);
|
||||||
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
|
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
|
||||||
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
||||||
@ -601,6 +602,7 @@ protected:
|
|||||||
nsTArray<nsString> mPrefNames;
|
nsTArray<nsString> mPrefNames;
|
||||||
MultiTouchInput mApzInput;
|
MultiTouchInput mApzInput;
|
||||||
mozilla::layers::ScrollableLayerGuid mApzGuid;
|
mozilla::layers::ScrollableLayerGuid mApzGuid;
|
||||||
|
AutoGlobalWrappedJavaObject mObject;
|
||||||
|
|
||||||
void ReadIntArray(nsTArray<int> &aVals,
|
void ReadIntArray(nsTArray<int> &aVals,
|
||||||
JNIEnv *jenv,
|
JNIEnv *jenv,
|
||||||
@ -685,6 +687,8 @@ protected:
|
|||||||
static jfieldID jGamepadButtonValueField;
|
static jfieldID jGamepadButtonValueField;
|
||||||
static jfieldID jGamepadValuesField;
|
static jfieldID jGamepadValuesField;
|
||||||
|
|
||||||
|
static jfieldID jObjectField;
|
||||||
|
|
||||||
static jclass jDomKeyLocationClass;
|
static jclass jDomKeyLocationClass;
|
||||||
static jfieldID jDomKeyLocationValueField;
|
static jfieldID jDomKeyLocationValueField;
|
||||||
|
|
||||||
@ -694,6 +698,7 @@ public:
|
|||||||
KEY_EVENT = 1,
|
KEY_EVENT = 1,
|
||||||
MOTION_EVENT = 2,
|
MOTION_EVENT = 2,
|
||||||
SENSOR_EVENT = 3,
|
SENSOR_EVENT = 3,
|
||||||
|
PROCESS_OBJECT = 4,
|
||||||
LOCATION_EVENT = 5,
|
LOCATION_EVENT = 5,
|
||||||
IME_EVENT = 6,
|
IME_EVENT = 6,
|
||||||
SIZE_CHANGED = 8,
|
SIZE_CHANGED = 8,
|
||||||
@ -766,6 +771,11 @@ public:
|
|||||||
ACTION_GAMEPAD_BUTTON = 1,
|
ACTION_GAMEPAD_BUTTON = 1,
|
||||||
ACTION_GAMEPAD_AXES = 2
|
ACTION_GAMEPAD_AXES = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ACTION_OBJECT_LAYER_CLIENT = 1,
|
||||||
|
dummy_object_enum_list_end
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsJNIString : public nsString
|
class nsJNIString : public nsString
|
||||||
|
@ -312,6 +312,20 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AndroidGeckoEvent::PROCESS_OBJECT: {
|
||||||
|
JNIEnv* const env = AndroidBridge::Bridge()->GetJNIEnv();
|
||||||
|
AutoLocalJNIFrame frame(env, 1);
|
||||||
|
|
||||||
|
switch (curEvent->Action()) {
|
||||||
|
case AndroidGeckoEvent::ACTION_OBJECT_LAYER_CLIENT:
|
||||||
|
// SetLayerClient expects a local reference
|
||||||
|
const jobject obj = env->NewLocalRef(curEvent->Object().wrappedObject());
|
||||||
|
AndroidBridge::Bridge()->SetLayerClient(env, obj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AndroidGeckoEvent::LOCATION_EVENT: {
|
case AndroidGeckoEvent::LOCATION_EVENT: {
|
||||||
if (!gLocationCallback)
|
if (!gLocationCallback)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user