< prev index next >

open/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m

Print this page




 465         // key is an alphabetic character
 466         unichar lower;
 467         lower = tolower(ch);
 468         offset = lower - 'a';
 469         if (offset >= 0 && offset <= 25) {
 470             // some chars in letter set are NOT actually A-Z characters?!
 471             // skip them...
 472             *postsTyped = YES;
 473             // do quick conversion
 474             *keyCode = java_awt_event_KeyEvent_VK_A + offset;
 475             *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_STANDARD;
 476             return;
 477         }
 478     }
 479 
 480     if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:ch]) {
 481         // key is a digit
 482         offset = ch - '0';
 483         // make sure in range for decimal digits
 484         if (offset >= 0 && offset <= 9)    {
 485             jboolean numpad = (flags & NSNumericPadKeyMask) != 0;

 486             *postsTyped = YES;
 487             if (numpad) {
 488                 *keyCode = offset + java_awt_event_KeyEvent_VK_NUMPAD0;
 489                 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD;
 490             } else {
 491                 *keyCode = offset + java_awt_event_KeyEvent_VK_0;
 492                 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_STANDARD;
 493             }
 494             return;
 495         }
 496     }
 497 
 498     if (key < size) {
 499         *postsTyped = keyTable[key].postsTyped;
 500         *keyCode = keyTable[key].javaKeyCode;
 501         *keyLocation = keyTable[key].javaKeyLocation;
 502     } else {
 503         // Should we report this? This means we've got a keyboard
 504         // we don't know about...
 505         *postsTyped = NO;




 465         // key is an alphabetic character
 466         unichar lower;
 467         lower = tolower(ch);
 468         offset = lower - 'a';
 469         if (offset >= 0 && offset <= 25) {
 470             // some chars in letter set are NOT actually A-Z characters?!
 471             // skip them...
 472             *postsTyped = YES;
 473             // do quick conversion
 474             *keyCode = java_awt_event_KeyEvent_VK_A + offset;
 475             *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_STANDARD;
 476             return;
 477         }
 478     }
 479 
 480     if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:ch]) {
 481         // key is a digit
 482         offset = ch - '0';
 483         // make sure in range for decimal digits
 484         if (offset >= 0 && offset <= 9)    {
 485             jboolean numpad = ((flags & NSNumericPadKeyMask) &&
 486                                (key > 81 && key < 93));
 487             *postsTyped = YES;
 488             if (numpad) {
 489                 *keyCode = offset + java_awt_event_KeyEvent_VK_NUMPAD0;
 490                 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD;
 491             } else {
 492                 *keyCode = offset + java_awt_event_KeyEvent_VK_0;
 493                 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_STANDARD;
 494             }
 495             return;
 496         }
 497     }
 498 
 499     if (key < size) {
 500         *postsTyped = keyTable[key].postsTyped;
 501         *keyCode = keyTable[key].javaKeyCode;
 502         *keyLocation = keyTable[key].javaKeyLocation;
 503     } else {
 504         // Should we report this? This means we've got a keyboard
 505         // we don't know about...
 506         *postsTyped = NO;


< prev index next >