summaryrefslogtreecommitdiffstats
path: root/src/newt/native/NewtMacWindow.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/native/NewtMacWindow.m')
-rw-r--r--src/newt/native/NewtMacWindow.m40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 1f74742ec..a3b6fa871 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -76,7 +76,7 @@ static jmethodID enqueueMouseEventID = NULL;
static jmethodID sendMouseEventID = NULL;
static jmethodID enqueueKeyEventID = NULL;
static jmethodID sendKeyEventID = NULL;
-static jmethodID enqueueRequestFocusID = NULL;
+static jmethodID requestFocusID = NULL;
static jmethodID insetsChangedID = NULL;
static jmethodID sizeChangedID = NULL;
@@ -252,7 +252,7 @@ static jmethodID windowRepaintID = NULL;
int shallBeDetached = 0;
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, jvmVersion, &shallBeDetached);
if(NULL==env) {
- NSLog(@"viewDidHide: null JNIEnv");
+ DBG_PRINT("viewDidHide: null JNIEnv\n");
return;
}
@@ -272,7 +272,7 @@ static jmethodID windowRepaintID = NULL;
int shallBeDetached = 0;
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, jvmVersion, &shallBeDetached);
if(NULL==env) {
- NSLog(@"viewDidHide: null JNIEnv");
+ DBG_PRINT("viewDidHide: null JNIEnv\n");
return;
}
@@ -290,7 +290,7 @@ static jmethodID windowRepaintID = NULL;
int shallBeDetached = 0;
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, jvmVersion, &shallBeDetached);
if(NULL==env) {
- NSLog(@"viewDidHide: null JNIEnv");
+ DBG_PRINT("viewDidHide: null JNIEnv\n");
return;
}
@@ -325,9 +325,9 @@ static jmethodID windowRepaintID = NULL;
focusChangedID = (*env)->GetMethodID(env, clazz, "focusChanged", "(ZZ)V");
windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "()V");
windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(ZIIII)V");
- enqueueRequestFocusID = (*env)->GetMethodID(env, clazz, "enqueueRequestFocus", "(Z)V");
+ requestFocusID = (*env)->GetMethodID(env, clazz, "requestFocus", "(Z)V");
if (enqueueMouseEventID && sendMouseEventID && enqueueKeyEventID && sendKeyEventID && sizeChangedID && visibleChangedID && insetsChangedID &&
- positionChangedID && focusChangedID && windowDestroyNotifyID && enqueueRequestFocusID && windowRepaintID)
+ positionChangedID && focusChangedID && windowDestroyNotifyID && requestFocusID && windowRepaintID)
{
return YES;
}
@@ -512,14 +512,14 @@ static jint mods2JavaMods(NSUInteger mods)
NewtView* view = (NewtView *) nsview;
jobject javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject == NULL) {
- NSLog(@"sendKeyEvent: null javaWindowObject");
+ DBG_PRINT("sendKeyEvent: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"sendKeyEvent: null JNIEnv");
+ DBG_PRINT("sendKeyEvent: null JNIEnv\n");
return;
}
@@ -533,6 +533,8 @@ static jint mods2JavaMods(NSUInteger mods)
// Note: the key code in the NSEvent does not map to anything we can use
jchar keyChar = (jchar) [chars characterAtIndex: i];
+ DBG_PRINT("sendKeyEvent: %d/%d char 0x%X, code 0x%X\n", i, len, (int)keyChar, (int)keyCode);
+
#ifdef USE_SENDIO_DIRECT
(*env)->CallVoidMethod(env, javaWindowObject, sendKeyEventID,
evType, javaMods, keyCode, keyChar);
@@ -567,14 +569,14 @@ static jint mods2JavaMods(NSUInteger mods)
NewtView* view = (NewtView *) nsview;
jobject javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject == NULL) {
- NSLog(@"sendMouseEvent: null javaWindowObject");
+ DBG_PRINT("sendMouseEvent: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"sendMouseEvent: null JNIEnv");
+ DBG_PRINT("sendMouseEvent: null JNIEnv\n");
return;
}
jint javaMods = mods2JavaMods([event modifierFlags]);
@@ -613,7 +615,7 @@ static jint mods2JavaMods(NSUInteger mods)
return;
}
if (evType == EVENT_MOUSE_PRESSED) {
- (*env)->CallVoidMethod(env, javaWindowObject, enqueueRequestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, javaWindowObject, requestFocusID, JNI_FALSE);
}
NSPoint location = [self screenPos2NewtClientWinPos: [NSEvent mouseLocation]];
@@ -770,14 +772,14 @@ static jint mods2JavaMods(NSUInteger mods)
NewtView* view = (NewtView *) nsview;
jobject javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject == NULL) {
- NSLog(@"windowDidResize: null javaWindowObject");
+ DBG_PRINT("windowDidResize: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"windowDidResize: null JNIEnv");
+ DBG_PRINT("windowDidResize: null JNIEnv\n");
return;
}
@@ -805,14 +807,14 @@ static jint mods2JavaMods(NSUInteger mods)
NewtView* view = (NewtView *) nsview;
jobject javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject == NULL) {
- NSLog(@"windowDidMove: null javaWindowObject");
+ DBG_PRINT("windowDidMove: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"windowDidMove: null JNIEnv");
+ DBG_PRINT("windowDidMove: null JNIEnv\n");
return;
}
@@ -841,14 +843,14 @@ static jint mods2JavaMods(NSUInteger mods)
jobject javaWindowObject = [view getJavaWindowObject];
DBG_PRINT( "*************** windowWillClose.0: 0x%p\n", (void *)(intptr_t)javaWindowObject);
if (javaWindowObject == NULL) {
- NSLog(@"windowWillClose: null javaWindowObject");
+ DBG_PRINT("windowWillClose: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"windowWillClose: null JNIEnv");
+ DBG_PRINT("windowWillClose: null JNIEnv\n");
return;
}
@@ -916,14 +918,14 @@ static jint mods2JavaMods(NSUInteger mods)
NewtView* view = (NewtView *) nsview;
jobject javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject == NULL) {
- NSLog(@"focusChanged: null javaWindowObject");
+ DBG_PRINT("focusChanged: null javaWindowObject\n");
return;
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], &shallBeDetached);
if(NULL==env) {
- NSLog(@"focusChanged: null JNIEnv");
+ DBG_PRINT("focusChanged: null JNIEnv\n");
return;
}