src/macosx/native/sun/awt/AWTView.m

Print this page




 330 
 331     // check synthesized mouse entered/exited events
 332     if ((type == NSMouseEntered && mouseIsOver) || (type == NSMouseExited && !mouseIsOver)) {
 333         return;
 334     }else if ((type == NSMouseEntered && !mouseIsOver) || (type == NSMouseExited && mouseIsOver)) {
 335         mouseIsOver = !mouseIsOver;
 336     }
 337 
 338     [AWTToolkit eventCountPlusPlus];
 339 
 340     JNIEnv *env = [ThreadUtilities getJNIEnv];
 341 
 342     NSPoint eventLocation = [event locationInWindow];
 343     NSPoint localPoint = [self convertPoint: eventLocation fromView: nil];
 344     NSPoint absP = [NSEvent mouseLocation];
 345 
 346     // Convert global numbers between Cocoa's coordinate system and Java.
 347     // TODO: need consitent way for doing that both with global as well as with local coordinates.
 348     // The reason to do it here is one more native method for getting screen dimension otherwise.
 349 
 350     NSRect screenRect = [[NSScreen mainScreen] frame];
 351     absP.y = screenRect.size.height - absP.y;
 352     jint clickCount;
 353 
 354     if (type == NSMouseEntered ||
 355         type == NSMouseExited ||
 356         type == NSScrollWheel ||
 357         type == NSMouseMoved) {
 358         clickCount = 0;
 359     } else {
 360         clickCount = [event clickCount];
 361     }
 362 
 363     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
 364     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
 365     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
 366                                   [event type],
 367                                   [event modifierFlags],
 368                                   clickCount,
 369                                   [event buttonNumber],
 370                                   (jint)localPoint.x, (jint)localPoint.y,




 330 
 331     // check synthesized mouse entered/exited events
 332     if ((type == NSMouseEntered && mouseIsOver) || (type == NSMouseExited && !mouseIsOver)) {
 333         return;
 334     }else if ((type == NSMouseEntered && !mouseIsOver) || (type == NSMouseExited && mouseIsOver)) {
 335         mouseIsOver = !mouseIsOver;
 336     }
 337 
 338     [AWTToolkit eventCountPlusPlus];
 339 
 340     JNIEnv *env = [ThreadUtilities getJNIEnv];
 341 
 342     NSPoint eventLocation = [event locationInWindow];
 343     NSPoint localPoint = [self convertPoint: eventLocation fromView: nil];
 344     NSPoint absP = [NSEvent mouseLocation];
 345 
 346     // Convert global numbers between Cocoa's coordinate system and Java.
 347     // TODO: need consitent way for doing that both with global as well as with local coordinates.
 348     // The reason to do it here is one more native method for getting screen dimension otherwise.
 349 
 350     NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
 351     absP.y = screenRect.size.height - absP.y;
 352     jint clickCount;
 353 
 354     if (type == NSMouseEntered ||
 355         type == NSMouseExited ||
 356         type == NSScrollWheel ||
 357         type == NSMouseMoved) {
 358         clickCount = 0;
 359     } else {
 360         clickCount = [event clickCount];
 361     }
 362 
 363     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
 364     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
 365     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
 366                                   [event type],
 367                                   [event modifierFlags],
 368                                   clickCount,
 369                                   [event buttonNumber],
 370                                   (jint)localPoint.x, (jint)localPoint.y,