< prev index next >

modules/graphics/src/main/native-glass/mac/GlassViewDelegate.m

Print this page




 966     [self sendJavaMouseEvent:theEvent];
 967 }
 968 
 969 - (void)draggingEnded
 970 {
 971     GET_MAIN_JENV;
 972     (*env)->CallVoidMethod(env, self->jView, jViewNotifyDragEnd,  [GlassDragSource getMask]);
 973     GLASS_CHECK_EXCEPTION(env);
 974 
 975     // RT-36038: OS X won't send mouseUp after DnD is complete, so we synthesize them
 976     if (self->mouseDownMask & 1 << 0) [self synthesizeMouseUp:NSLeftMouseUp];
 977     if (self->mouseDownMask & 1 << 1) [self synthesizeMouseUp:NSRightMouseUp];
 978     if (self->mouseDownMask & 1 << 2) [self synthesizeMouseUp:NSOtherMouseUp];
 979 }
 980 
 981 - (BOOL)suppressMouseEnterExitOnMouseDown
 982 {
 983     return YES;
 984 }
 985 
 986 - (void)notifyInputMethod:(id) aString attr:(int)attr length:(int)length cursor:(int)cursor
 987 {
 988     if ([NSThread isMainThread] == YES)
 989     {
 990         GET_MAIN_JENV;
 991         jstring jStr = (*env)->NewStringUTF(env, [aString UTF8String]);
 992         (*env)->CallVoidMethod(env, self->jView, jViewNotifyInputMethodMac, jStr, attr, length, cursor);
 993         GLASS_CHECK_EXCEPTION(env);
 994     }
 995 }
 996 
 997 - (NSRect)getInputMethodCandidatePosRequest:(int)pos
 998 {
 999     NSRect retVal = NSMakeRect(0.0, 0.0, 0.0, 0.0);
1000     if ([NSThread isMainThread] == YES)
1001     {
1002         // TODO: For some reason result is not always converted to the screen coordinates,
1003         // and when we call this method before we set text to updated we get the 
1004         // IndexOutOfBoundsException
1005         // In this case we return an empty rectangle so suggestion window is shown at the 
1006         // bottom left corner of the main screen.
1007         GET_MAIN_JENV;
1008         jdoubleArray theArray = 
1009             (jdoubleArray) (*env)->CallObjectMethod(env, 
1010                                                     self->jView, 
1011                                                     jViewNotifyInputMethodCandidatePosRequest, 
1012                                                     pos);




 966     [self sendJavaMouseEvent:theEvent];
 967 }
 968 
 969 - (void)draggingEnded
 970 {
 971     GET_MAIN_JENV;
 972     (*env)->CallVoidMethod(env, self->jView, jViewNotifyDragEnd,  [GlassDragSource getMask]);
 973     GLASS_CHECK_EXCEPTION(env);
 974 
 975     // RT-36038: OS X won't send mouseUp after DnD is complete, so we synthesize them
 976     if (self->mouseDownMask & 1 << 0) [self synthesizeMouseUp:NSLeftMouseUp];
 977     if (self->mouseDownMask & 1 << 1) [self synthesizeMouseUp:NSRightMouseUp];
 978     if (self->mouseDownMask & 1 << 2) [self synthesizeMouseUp:NSOtherMouseUp];
 979 }
 980 
 981 - (BOOL)suppressMouseEnterExitOnMouseDown
 982 {
 983     return YES;
 984 }
 985 
 986 - (void)notifyInputMethod:(id) aString attr:(int)attr length:(int)length cursor:(int)cursor  selectedRange:(NSRange)selectionRange
 987 {
 988     if ([NSThread isMainThread] == YES)
 989     {
 990         GET_MAIN_JENV;
 991         jstring jStr = (*env)->NewStringUTF(env, [aString UTF8String]);
 992         (*env)->CallVoidMethod(env, self->jView, jViewNotifyInputMethodMac, jStr, attr, length, cursor, selectionRange.location, selectionRange.length);
 993         GLASS_CHECK_EXCEPTION(env);
 994     }
 995 }
 996 
 997 - (NSRect)getInputMethodCandidatePosRequest:(int)pos
 998 {
 999     NSRect retVal = NSMakeRect(0.0, 0.0, 0.0, 0.0);
1000     if ([NSThread isMainThread] == YES)
1001     {
1002         // TODO: For some reason result is not always converted to the screen coordinates,
1003         // and when we call this method before we set text to updated we get the 
1004         // IndexOutOfBoundsException
1005         // In this case we return an empty rectangle so suggestion window is shown at the 
1006         // bottom left corner of the main screen.
1007         GET_MAIN_JENV;
1008         jdoubleArray theArray = 
1009             (jdoubleArray) (*env)->CallObjectMethod(env, 
1010                                                     self->jView, 
1011                                                     jViewNotifyInputMethodCandidatePosRequest, 
1012                                                     pos);


< prev index next >