зеркало из https://github.com/mozilla/pluotsorbet.git
Merge pull request #1106 from marco-c/self_host_GestureEvent
Self host GestureEventImpl and allow running benchmarks using SpiderMonkey
This commit is contained in:
Коммит
edfbc2fcdc
|
@ -298,3 +298,12 @@ com/sun/midp/lcdui/DisplayDevice.isPrimaryDisplay.()Z
|
||||||
com/sun/midp/main/MIDletProxy.getClassName.()Ljava/lang/String;
|
com/sun/midp/main/MIDletProxy.getClassName.()Ljava/lang/String;
|
||||||
com/sun/midp/rms/RmsEnvironment.getSecureFilenameBase.(I)Ljava/lang/String;
|
com/sun/midp/rms/RmsEnvironment.getSecureFilenameBase.(I)Ljava/lang/String;
|
||||||
com/sun/midp/midletsuite/SuiteContainerAdapter.getSecureFilenameBase.(I)Ljava/lang/String;
|
com/sun/midp/midletsuite/SuiteContainerAdapter.getSecureFilenameBase.(I)Ljava/lang/String;
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getType.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getDragDistanceX.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getDragDistanceY.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getStartX.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getStartY.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getFlickDirection.()F
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeed.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeedX.()I
|
||||||
|
com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeedY.()I
|
|
@ -1,27 +1,71 @@
|
||||||
package com.nokia.mid.ui.gestures;
|
package com.nokia.mid.ui.gestures;
|
||||||
|
|
||||||
|
import com.sun.midp.events.NativeEvent;
|
||||||
|
|
||||||
public class GestureEventImpl implements GestureEvent {
|
public class GestureEventImpl implements GestureEvent {
|
||||||
public GestureEventImpl(int type, int dragDistanceX, int dragDistanceY, int startX, int startY,
|
protected NativeEvent nativeEvent;
|
||||||
float flickDirection, int flickSpeed, int flickSpeedX, int flickSpeedY,
|
|
||||||
int pinchDistanceStarting, int pinchDistanceCurrent, int pinchDistanceChange,
|
public int getType() {
|
||||||
int pinchCenterX, int pinchCenterY, int pinchCenterChangeX, int pinchCenterChangeY) {
|
return nativeEvent.intParam1;
|
||||||
// Overridden in midp/gestures.js
|
|
||||||
}
|
}
|
||||||
|
|
||||||
native public int getType();
|
public int getDragDistanceX() {
|
||||||
native public int getDragDistanceX();
|
return nativeEvent.intParam2;
|
||||||
native public int getDragDistanceY();
|
}
|
||||||
native public int getStartX();
|
|
||||||
native public int getStartY();
|
public int getDragDistanceY() {
|
||||||
native public float getFlickDirection();
|
return nativeEvent.intParam3;
|
||||||
native public int getFlickSpeed();
|
}
|
||||||
native public int getFlickSpeedX();
|
|
||||||
native public int getFlickSpeedY();
|
public int getStartX() {
|
||||||
native public int getPinchDistanceStarting();
|
return nativeEvent.intParam5;
|
||||||
native public int getPinchDistanceCurrent();
|
}
|
||||||
native public int getPinchDistanceChange();
|
|
||||||
native public int getPinchCenterX();
|
public int getStartY() {
|
||||||
native public int getPinchCenterY();
|
return nativeEvent.intParam6;
|
||||||
native public int getPinchCenterChangeX();
|
}
|
||||||
native public int getPinchCenterChangeY();
|
|
||||||
|
public float getFlickDirection() {
|
||||||
|
return nativeEvent.floatParam1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFlickSpeed() {
|
||||||
|
return nativeEvent.intParam7;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFlickSpeedX() {
|
||||||
|
return nativeEvent.intParam8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFlickSpeedY() {
|
||||||
|
return nativeEvent.intParam9;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchDistanceStarting() {
|
||||||
|
return nativeEvent.intParam10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchDistanceCurrent() {
|
||||||
|
return nativeEvent.intParam11;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchDistanceChange() {
|
||||||
|
return nativeEvent.intParam12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchCenterX() {
|
||||||
|
return nativeEvent.intParam13;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchCenterY() {
|
||||||
|
return nativeEvent.intParam14;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchCenterChangeX() {
|
||||||
|
return nativeEvent.intParam15;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPinchCenterChangeY() {
|
||||||
|
return nativeEvent.intParam16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,11 @@ public class GestureRegistrationManager implements EventListener {
|
||||||
private static Vector zoneRegistrations = new Vector();
|
private static Vector zoneRegistrations = new Vector();
|
||||||
private static Hashtable listenerRegistrations = new Hashtable();
|
private static Hashtable listenerRegistrations = new Hashtable();
|
||||||
|
|
||||||
|
// http://developer.nokia.com/resources/library/Java/_zip/GUID-237420DE-CCBE-4A74-A129-572E0708D428/com/nokia/mid/ui/gestures/GestureEvent.html
|
||||||
|
// The API imposes the restriction that the gesture event data is only valid during the call to
|
||||||
|
// GestureListener.gestureAction(Object, GestureInteractiveZone, GestureEvent).
|
||||||
|
private static GestureEventImpl gestureEvent = new GestureEventImpl();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
EventQueue eventQueue = EventQueue.getEventQueue();
|
EventQueue eventQueue = EventQueue.getEventQueue();
|
||||||
eventQueue.registerEventListener(EventTypes.GESTURE_EVENT, GestureRegistrationManager.getRegistrationManagerInstance());
|
eventQueue.registerEventListener(EventTypes.GESTURE_EVENT, GestureRegistrationManager.getRegistrationManagerInstance());
|
||||||
|
@ -40,23 +45,7 @@ public class GestureRegistrationManager implements EventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(Event event) {
|
public void process(Event event) {
|
||||||
NativeEvent nativeEvent = (NativeEvent)event;
|
gestureEvent.nativeEvent = (NativeEvent)event;
|
||||||
GestureEvent gestureEvent = new GestureEventImpl(nativeEvent.intParam1,
|
|
||||||
nativeEvent.intParam2,
|
|
||||||
nativeEvent.intParam3,
|
|
||||||
nativeEvent.intParam5,
|
|
||||||
nativeEvent.intParam6,
|
|
||||||
nativeEvent.floatParam1,
|
|
||||||
nativeEvent.intParam7,
|
|
||||||
nativeEvent.intParam8,
|
|
||||||
nativeEvent.intParam9,
|
|
||||||
nativeEvent.intParam10,
|
|
||||||
nativeEvent.intParam11,
|
|
||||||
nativeEvent.intParam12,
|
|
||||||
nativeEvent.intParam13,
|
|
||||||
nativeEvent.intParam14,
|
|
||||||
nativeEvent.intParam15,
|
|
||||||
nativeEvent.intParam16);
|
|
||||||
|
|
||||||
for (int i = 0; i < zoneRegistrations.size(); i++) {
|
for (int i = 0; i < zoneRegistrations.size(); i++) {
|
||||||
ZoneRegistration zoneReg = (ZoneRegistration)zoneRegistrations.elementAt(i);
|
ZoneRegistration zoneReg = (ZoneRegistration)zoneRegistrations.elementAt(i);
|
||||||
|
|
17
jsshell.js
17
jsshell.js
|
@ -65,13 +65,22 @@ var document = {
|
||||||
},
|
},
|
||||||
getBoundingClientRect: function() {
|
getBoundingClientRect: function() {
|
||||||
return { top: 0, left: 0, width: 0, height: 0 };
|
return { top: 0, left: 0, width: 0, height: 0 };
|
||||||
}
|
},
|
||||||
|
querySelector: function() {
|
||||||
|
return { style: "" };
|
||||||
|
},
|
||||||
|
dispatchEvent: function(event) {
|
||||||
|
},
|
||||||
|
style: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
addEventListener: function() {
|
addEventListener: function() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var Event = function() {
|
||||||
|
}
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
logConsole: "native",
|
logConsole: "native",
|
||||||
args: "",
|
args: "",
|
||||||
|
@ -81,8 +90,9 @@ try {
|
||||||
load("libs/relooper.js", "build/j2me.js","libs/zipfile.js", "blackBox.js",
|
load("libs/relooper.js", "build/j2me.js","libs/zipfile.js", "blackBox.js",
|
||||||
"libs/encoding.js", "util.js",
|
"libs/encoding.js", "util.js",
|
||||||
"override.js", "native.js", "tests/override.js",
|
"override.js", "native.js", "tests/override.js",
|
||||||
"string.js", "midp/midp.js",
|
"string.js", "midp/midp.js", "midp/gestures.js",
|
||||||
"libs/long.js", "midp/crypto.js", "libs/forge/md5.js", "libs/forge/util.js");
|
"libs/long.js", "midp/crypto.js", "libs/forge/md5.js", "libs/forge/util.js",
|
||||||
|
"build/classes.jar.js");
|
||||||
|
|
||||||
// load("build/classes.jar.js");
|
// load("build/classes.jar.js");
|
||||||
// load("build/program.jar.js");
|
// load("build/program.jar.js");
|
||||||
|
@ -96,6 +106,7 @@ try {
|
||||||
|
|
||||||
CLASSES.addPath("java/classes.jar", snarf("java/classes.jar", "binary").buffer);
|
CLASSES.addPath("java/classes.jar", snarf("java/classes.jar", "binary").buffer);
|
||||||
CLASSES.addPath("tests/tests.jar", snarf("tests/tests.jar", "binary").buffer);
|
CLASSES.addPath("tests/tests.jar", snarf("tests/tests.jar", "binary").buffer);
|
||||||
|
CLASSES.addPath("bench/benchmark.jar", snarf("bench/benchmark.jar", "binary").buffer);
|
||||||
//CLASSES.addPath("program.jar", snarf("program.jar", "binary").buffer);
|
//CLASSES.addPath("program.jar", snarf("program.jar", "binary").buffer);
|
||||||
|
|
||||||
CLASSES.initializeBuiltinClasses();
|
CLASSES.initializeBuiltinClasses();
|
||||||
|
|
|
@ -29,89 +29,3 @@ Native["com/nokia/mid/ui/gestures/GestureInteractiveZone.contains.(II)Z"] = func
|
||||||
Native["com/nokia/mid/ui/gestures/GestureInteractiveZone.supports.(I)Z"] = function(type) {
|
Native["com/nokia/mid/ui/gestures/GestureInteractiveZone.supports.(I)Z"] = function(type) {
|
||||||
return ((type & this.gestures) == type) ? 1 : 0;
|
return ((type & this.gestures) == type) ? 1 : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Override["com/nokia/mid/ui/gestures/GestureEventImpl.<init>.(IIIIIFIIIIIIIIII)V"] =
|
|
||||||
function(type, dragDistanceX, dragDistanceY, startX, startY, flickDirection, flickSpeed, flickSpeedX, flickSpeedY,
|
|
||||||
pinchDistanceStarting, pinchDistanceCurrent, pinchDistanceChange, pinchCenterX, pinchCenterY,
|
|
||||||
pinchCenterChangeX, pinchCenterChangeY) {
|
|
||||||
this.type = type;
|
|
||||||
this.dragDistanceX = dragDistanceX;
|
|
||||||
this.dragDistanceY = dragDistanceY;
|
|
||||||
this.startX = startX;
|
|
||||||
this.startY = startY;
|
|
||||||
this.flickDirection = flickDirection;
|
|
||||||
this.flickSpeed = flickSpeed;
|
|
||||||
this.flickSpeedX = flickSpeedX;
|
|
||||||
this.flickSpeedY = flickSpeedY;
|
|
||||||
this.pinchDistanceStarting = pinchDistanceStarting;
|
|
||||||
this.pinchDistanceCurrent = pinchDistanceCurrent;
|
|
||||||
this.pinchDistanceChange = pinchDistanceChange;
|
|
||||||
this.pinchCenterX = pinchCenterX;
|
|
||||||
this.pinchCenterY = pinchCenterY;
|
|
||||||
this.pinchCenterChangeX = pinchCenterChangeX;
|
|
||||||
this.pinchCenterChangeY = pinchCenterChangeY;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getType.()I"] = function() {
|
|
||||||
return this.type;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getDragDistanceX.()I"] = function() {
|
|
||||||
return this.dragDistanceX;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getDragDistanceY.()I"] = function() {
|
|
||||||
return this.dragDistanceY;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getStartX.()I"] = function() {
|
|
||||||
return this.startX;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getStartY.()I"] = function() {
|
|
||||||
return this.startY;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getFlickDirection.()F"] = function() {
|
|
||||||
return this.flickDirection;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeed.()I"] = function() {
|
|
||||||
return this.flickSpeed;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeedX.()I"] = function() {
|
|
||||||
return this.flickSpeedX;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getFlickSpeedY.()I"] = function() {
|
|
||||||
return this.flickSpeedY;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchDistanceStarting.()I"] = function() {
|
|
||||||
return this.pinchDistanceStarting;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchDistanceCurrent.()I"] = function() {
|
|
||||||
return this.pinchDistanceCurrent;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchDistanceChange.()I"] = function() {
|
|
||||||
return this.pinchDistanceChange;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchCenterX.()I"] = function() {
|
|
||||||
return this.pinchCenterX;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchCenterY.()I"] = function() {
|
|
||||||
return this.pinchCenterY;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchCenterChangeX.()I"] = function() {
|
|
||||||
return this.pinchCenterChangeX;
|
|
||||||
};
|
|
||||||
|
|
||||||
Native["com/nokia/mid/ui/gestures/GestureEventImpl.getPinchCenterChangeY.()I"] = function() {
|
|
||||||
return this.pinchCenterChangeY;
|
|
||||||
};
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче