summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxant <xant@xant.net>2013-07-12 00:18:08 (GMT)
committer xant <xant@xant.net>2013-07-12 00:18:08 (GMT)
commit03bc017b4d5829d51ef8b6bd89b3f18419177d09 (patch)
tree61555dca795fc6710ffac93fc5ea14aed3f590e7
parent2dc5f0e9c9975b0080d3a5a3f4c3484eefce7c78 (diff)
inizialize nodejs properly and fixed various issues with the javascript after node.js and v8 ugrades
almost all examples now seem to work ... inverting the mouse coordinates is still broken
-rw-r--r--core/JMXScript.mm16
-rw-r--r--core/JMXV8PropertyAccessors.mm24
-rw-r--r--entities/video_outputs/JMXOpenGLScreen.mm4
-rw-r--r--gui/JMXBoardViewController.m2
4 files changed, 24 insertions, 22 deletions
diff --git a/core/JMXScript.mm b/core/JMXScript.mm
index a84aabb..d108a1f 100644
--- a/core/JMXScript.mm
+++ b/core/JMXScript.mm
@@ -409,7 +409,7 @@ static v8::Handle<Value> Run(const Arguments& args)
foo->Call(foo, nArgs, fArgs);
if (fArgs)
free(fArgs);
- uv_run(uv_default_loop(), (uv_run_mode)(UV_RUN_ONCE | UV_RUN_NOWAIT));
+ //uv_run(uv_default_loop(), (uv_run_mode)(UV_RUN_ONCE | UV_RUN_NOWAIT));
}
// restore quit status for nested loops
v8::Locker::StopPreemption();
@@ -604,12 +604,6 @@ static char *argv[2] = { (char *)"JMX", NULL };
{
self = [super init];
if (self) {
- if (!nodeJSTimersThread) {
- nodeJSTimersThread = [[NSThread alloc] initWithTarget:self
- selector:@selector(nodejsRun)
- object:nil];
- [nodeJSTimersThread start];
- }
}
return self;
}
@@ -815,6 +809,12 @@ static char *argv[2] = { (char *)"JMX", NULL };
//exit(4);
}
}
+ if (!nodeJSTimersThread) {
+ nodeJSTimersThread = [[NSThread alloc] initWithTarget:self
+ selector:@selector(nodejsRun)
+ object:nil];
+ [nodeJSTimersThread start];
+ }
}
- (void)clearPersistentInstances
@@ -1041,7 +1041,7 @@ static char *argv[2] = { (char *)"JMX", NULL };
Handle<Value> args[1];
args[0] = [anEvent jsObj];
for (JMXEventListener *listener in listeners) {
- Unlocker unlocker;
+ //Unlocker unlocker;
[self execFunction:listener.function withArguments:args count:1];
}
[pool release];
diff --git a/core/JMXV8PropertyAccessors.mm b/core/JMXV8PropertyAccessors.mm
index ca4b9ad..368fdfc 100644
--- a/core/JMXV8PropertyAccessors.mm
+++ b/core/JMXV8PropertyAccessors.mm
@@ -42,7 +42,7 @@ v8::Handle<Value>GetColorProperty(Local<String> name, const AccessorInfo& info)
v8::Handle<Value>GetObjectProperty(Local<String> name, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handle_scope;
id obj = (id)info.Holder()->GetPointerFromInternalField(0);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -97,7 +97,7 @@ static inline BOOL _GetProperty(id obj, char *name, void *ret)
v8::Handle<Value>GetBoolProperty(Local<String> name, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handle_scope;
BOOL ret = NO;
String::Utf8Value value(name);
@@ -109,7 +109,7 @@ v8::Handle<Value>GetBoolProperty(Local<String> name, const AccessorInfo& info)
v8::Handle<Value>GetDoubleProperty(Local<String> name, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handle_scope;
double ret = 0;
String::Utf8Value value(name);
@@ -122,7 +122,7 @@ v8::Handle<Value>GetDoubleProperty(Local<String> name, const AccessorInfo& info)
v8::Handle<Value>GetIntProperty(Local<String> name, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handle_scope;
int32_t ret = 0;
String::Utf8Value value(name);
@@ -157,7 +157,7 @@ static inline void _SetProperty(id obj, char *name, id value)
void SetStringProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!value->IsString()) {
@@ -175,7 +175,7 @@ void SetStringProperty(Local<String> name, Local<Value> value, const AccessorInf
void SetColorProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!value->IsObject()) {
@@ -194,7 +194,7 @@ void SetColorProperty(Local<String> name, Local<Value> value, const AccessorInfo
void SetNumberProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!value->IsNumber()) {
@@ -212,7 +212,7 @@ void SetNumberProperty(Local<String> name, Local<Value> value, const AccessorInf
void SetBoolProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!(value->IsBoolean() || value->IsNumber())) {
@@ -247,7 +247,7 @@ void SetBoolProperty(Local<String> name, Local<Value> value, const AccessorInfo&
void SetIntProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!value->IsInt32()) {
@@ -282,7 +282,7 @@ void SetIntProperty(Local<String> name, Local<Value> value, const AccessorInfo&
void SetDoubleProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
if (!value->IsInt32()) {
@@ -317,7 +317,7 @@ void SetDoubleProperty(Local<String> name, Local<Value> value, const AccessorInf
void SetSizeProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
String::Utf8Value str(value->ToString());
@@ -334,7 +334,7 @@ void SetSizeProperty(Local<String> name, Local<Value> value, const AccessorInfo&
void SetPointProperty(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
- //Locker lock;
+ Locker lock;
HandleScope handleScope;
String::Utf8Value nameStr(name);
String::Utf8Value str(value->ToString());
diff --git a/entities/video_outputs/JMXOpenGLScreen.mm b/entities/video_outputs/JMXOpenGLScreen.mm
index e45a35f..4f934c5 100644
--- a/entities/video_outputs/JMXOpenGLScreen.mm
+++ b/entities/video_outputs/JMXOpenGLScreen.mm
@@ -150,7 +150,7 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
__openglOutputs = [[NSMutableDictionary alloc] initWithCapacity:5];
}
JMXOpenGLViewWrapper *wrapper = [JMXOpenGLViewWrapper openglViewWrapperWithOpenglView:self];
- [__openglOutputs setObject:wrapper forKey:[wrapper hashString]];
+ [__openglOutputs setObject:wrapper forKey:[NSNumber numberWithInteger:[self hash]]];
}
return self;
}
@@ -177,7 +177,7 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink,
- (void)dealloc
{
- [__openglOutputs removeObjectForKey:[NSString stringWithFormat:@"%ld", [self hash]]];
+ [__openglOutputs removeObjectForKey:[NSNumber numberWithInteger:[self hash]]];
[self cleanup];
[lock release];
[super dealloc];
diff --git a/gui/JMXBoardViewController.m b/gui/JMXBoardViewController.m
index 0c4968a..0fadb32 100644
--- a/gui/JMXBoardViewController.m
+++ b/gui/JMXBoardViewController.m
@@ -330,6 +330,8 @@
- (void)execStatement
{
NSString *code = [jsInput stringValue];
+ if (!code.length)
+ return;
BOOL ret = [scriptController exec:code];
[jsInput setStringValue:@""];
if (!ret) {