< prev index next >

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

Print this page




 119 
 120 -(void) deliverJavaMouseEvent: (NSEvent *) event {
 121     [AWTToolkit eventCountPlusPlus];
 122 
 123     JNIEnv *env = [ThreadUtilities getJNIEnv];
 124 
 125     NSPoint eventLocation = [event locationInWindow];
 126     NSPoint localPoint = [view convertPoint: eventLocation fromView: nil];
 127     localPoint.y = [view bounds].size.height - localPoint.y;
 128 
 129     NSPoint absP = [NSEvent mouseLocation];
 130     NSEventType type = [event type];
 131 
 132     NSRect screenRect = [[NSScreen mainScreen] frame];
 133     absP.y = screenRect.size.height - absP.y;
 134     jint clickCount;
 135 
 136     clickCount = [event clickCount];
 137 
 138     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
 139     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
 140     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
 141                                   [event type],
 142                                   [event modifierFlags],
 143                                   clickCount,
 144                                   [event buttonNumber],
 145                                   (jint)localPoint.x, (jint)localPoint.y,
 146                                   (jint)absP.x, (jint)absP.y,
 147                                   [event deltaY],
 148                                   [event deltaX]);

 149     if (jEvent == nil) {
 150         // Unable to create event by some reason.
 151         return;
 152     }
 153 
 154     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
 155     static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
 156     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
 157 }
 158 
 159 @end //AWTTrayIcon
 160 //================================================
 161 
 162 @implementation AWTTrayIconView
 163 
 164 -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon {
 165     self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)];
 166 
 167     [self setTrayIcon: theTrayIcon];
 168     isHighlighted = NO;




 119 
 120 -(void) deliverJavaMouseEvent: (NSEvent *) event {
 121     [AWTToolkit eventCountPlusPlus];
 122 
 123     JNIEnv *env = [ThreadUtilities getJNIEnv];
 124 
 125     NSPoint eventLocation = [event locationInWindow];
 126     NSPoint localPoint = [view convertPoint: eventLocation fromView: nil];
 127     localPoint.y = [view bounds].size.height - localPoint.y;
 128 
 129     NSPoint absP = [NSEvent mouseLocation];
 130     NSEventType type = [event type];
 131 
 132     NSRect screenRect = [[NSScreen mainScreen] frame];
 133     absP.y = screenRect.size.height - absP.y;
 134     jint clickCount;
 135 
 136     clickCount = [event clickCount];
 137 
 138     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
 139     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDDI)V");
 140     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
 141                                   [event type],
 142                                   [event modifierFlags],
 143                                   clickCount,
 144                                   [event buttonNumber],
 145                                   (jint)localPoint.x, (jint)localPoint.y,
 146                                   (jint)absP.x, (jint)absP.y,
 147                                   [event deltaY],
 148                                   [event deltaX],
 149                                   [AWTToolkit scrollStateWithEvent: event]);
 150     if (jEvent == nil) {
 151         // Unable to create event by some reason.
 152         return;
 153     }
 154 
 155     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
 156     static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
 157     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
 158 }
 159 
 160 @end //AWTTrayIcon
 161 //================================================
 162 
 163 @implementation AWTTrayIconView
 164 
 165 -(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon {
 166     self = [super initWithFrame:NSMakeRect(0, 0, 1, 1)];
 167 
 168     [self setTrayIcon: theTrayIcon];
 169     isHighlighted = NO;


< prev index next >