< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m

Print this page




 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 




 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, "(IIIIIIIIDDI)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                                   [AWTToolkit scrollStateWithEvent: event]);
 155     CHECK_NULL(jEvent);
 156 
 157     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
 158     static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
 159     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
 160     (*env)->DeleteLocalRef(env, jEvent);
 161 }
 162 
 163 @end //AWTTrayIcon
 164 //================================================
 165 
 166 @implementation AWTTrayIconView
 167 
 168 -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon {
 169     self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)];
 170 
 171     [self setTrayIcon: theTrayIcon];
 172     isHighlighted = NO;
 173     image = nil;
 174 


< prev index next >