123 } 124 125 -(void) deliverJavaMouseEvent: (NSEvent *) event { 126 [AWTToolkit eventCountPlusPlus]; 127 128 JNIEnv *env = [ThreadUtilities getJNIEnv]; 129 130 NSPoint eventLocation = [event locationInWindow]; 131 NSPoint localPoint = [view convertPoint: eventLocation fromView: nil]; 132 localPoint.y = [view bounds].size.height - localPoint.y; 133 134 NSPoint absP = [NSEvent mouseLocation]; 135 NSEventType type = [event type]; 136 137 NSRect screenRect = [[NSScreen mainScreen] frame]; 138 absP.y = screenRect.size.height - absP.y; 139 jint clickCount; 140 141 clickCount = [event clickCount]; 142 143 static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent"); 144 static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V"); 145 jobject jEvent = JNFNewObject(env, jctor_NSEvent, 146 [event type], 147 [event modifierFlags], 148 clickCount, 149 [event buttonNumber], 150 (jint)localPoint.x, (jint)localPoint.y, 151 (jint)absP.x, (jint)absP.y, 152 [event deltaY], 153 [event deltaX]); 154 CHECK_NULL(jEvent); 155 156 static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon"); 157 static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V"); 158 JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent); 159 (*env)->DeleteLocalRef(env, jEvent); 160 } 161 162 @end //AWTTrayIcon 163 //================================================ 164 165 @implementation AWTTrayIconView 166 167 -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon { 168 self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)]; 169 170 [self setTrayIcon: theTrayIcon]; 171 isHighlighted = NO; 172 image = nil; 173 | 123 } 124 125 -(void) deliverJavaMouseEvent: (NSEvent *) event { 126 [AWTToolkit eventCountPlusPlus]; 127 128 JNIEnv *env = [ThreadUtilities getJNIEnv]; 129 130 NSPoint eventLocation = [event locationInWindow]; 131 NSPoint localPoint = [view convertPoint: eventLocation fromView: nil]; 132 localPoint.y = [view bounds].size.height - localPoint.y; 133 134 NSPoint absP = [NSEvent mouseLocation]; 135 NSEventType type = [event type]; 136 137 NSRect screenRect = [[NSScreen mainScreen] frame]; 138 absP.y = screenRect.size.height - absP.y; 139 jint clickCount; 140 141 clickCount = [event clickCount]; 142 143 jint scrollPhase = 0; 144 if (type == NSScrollWheel) { 145 scrollPhase = [AWTToolkit scrollStateWithPhase: [event phase] 146 withMomentumPhase: [event momentumPhase]]; 147 } 148 149 static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent"); 150 static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDDI)V"); 151 jobject jEvent = JNFNewObject(env, jctor_NSEvent, 152 [event type], 153 [event modifierFlags], 154 clickCount, 155 [event buttonNumber], 156 (jint)localPoint.x, (jint)localPoint.y, 157 (jint)absP.x, (jint)absP.y, 158 [event deltaY], 159 [event deltaX], 160 scrollPhase); 161 CHECK_NULL(jEvent); 162 163 static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon"); 164 static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V"); 165 JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent); 166 (*env)->DeleteLocalRef(env, jEvent); 167 } 168 169 @end //AWTTrayIcon 170 //================================================ 171 172 @implementation AWTTrayIconView 173 174 -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon { 175 self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)]; 176 177 [self setTrayIcon: theTrayIcon]; 178 isHighlighted = NO; 179 image = nil; 180 |