Changeset 170
- Timestamp:
- Apr 10, 2007, 11:12:37 PM (18 years ago)
- Location:
- trunk/src/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qapplication_pm.cpp
r169 r170 2980 2980 // don't have KC_CHAR set) because processing Alt+Letter shortcuts 2981 2981 // for non-ASCII letters in widgets (e.g. QPushButton) depends on that. 2982 if ( !(chm.fs & KC_KEYUP) && (chm.chr & 0xFF) && (chm.chr & 0xFF00) && 2983 qt_os2UconvFirstByteTable()[ (chm.chr & 0xFF) ] == 2 ) { 2984 // We assime we get a DBCS char if both hi and lo bytes of chr are 2985 // non-zero. Note that this check is performed only for key press 2986 // events, because key release events (at least for SBCS) often 2987 // contain a scancode in the hi byte of chr, which is of course 2988 // doesn't mean DBCS. We also perform a DBCS lead byte check to 2989 // ensure keys like ESC (that always gives chm=0x011B) are not 2990 // mistakenly recognized as DBCS. 2982 if ( (chm.fs & (KC_VIRTUALKEY | KC_CHAR)) == KC_CHAR && (chm.chr & 0xFF00) ) { 2983 // We assime we get a DBCS char if the above condition is met. 2984 // DBCS chars seem to have KC_CHAR set but not KC_VIRTUALKEY; we 2985 // use this to prevent keys like ESC (chm=0x011B) with the non-zero 2986 // high byte to be mistakenly recognized as DBCS. 2991 2987 text = QString::fromLocal8Bit( (char *) &chm.chr, 2 ); 2992 2988 } … … 3012 3008 { 3013 3009 KeyRec *result = 0; 3010 if( scan == 0 ) // DBCS chars or user-injected keys 3011 return result; 3012 3014 3013 for (int i=0; i<nrecs; i++) { 3015 3014 if (key_rec[i].scan == scan) { … … 3035 3034 { 3036 3035 KeyRec *result = 0; 3036 if( code == 0 ) // DBCS chars or user-injected keys 3037 return result; 3038 3037 3039 for (int i=0; i<nrecs; i++) { 3038 3040 if (key_rec[i].code == code) { … … 3058 3060 const QString& text ) 3059 3061 { 3062 if( scan == 0 && code == 0 ) // DBCS chars or user-injected keys 3063 return; 3064 3060 3065 if ( nrecs == maxrecs ) { 3061 3066 #if defined(QT_CHECK_RANGE) … … 3086 3091 translateKeyCode( chm, code, ascii, state, text ); 3087 3092 3088 // code will be zero for all non-ASCII letters, but I'm not sure when 3089 // scancode is oficially allowed to be zero and what it means. Anyway, 3090 // ignore key events when both are zero, because it will not make sense 3091 // (we will not be able to properly report key releases for such events 3092 // since all of them will be indexed by the same zero number in key_rec). 3093 if ( !code && !chm.scancode ) return FALSE; 3093 // Note: code and/or chm.scancode may be zero here. We cannot ignore such 3094 // events because, for example, all non-ASCII letters have zero virtual 3095 // codes, and DBCS characters entered via IME have both zero virtual codes 3096 // and zero scancodes. However, if both code and chm.scancode are zero 3097 // (as for DBCS), store_key_rec()/find_key_rec() will do nothing which 3098 // means that: 3099 // 1) QKeyEvents will not have the auto-repeat flag set when a key is 3100 // being auto-repeated by the system; 3101 // 2) there will be no QEvent::KeyRelease event corresponding to the 3102 // QEvent::KeyPress event. 3094 3103 3095 3104 // Invert state logic -
trunk/src/kernel/qfontengine_pm.cpp
r169 r170 232 232 int realLen = 0; 233 233 for( int i = 0; i < slen; i++ ) { 234 bool isDBCSLeadByte = uconvFirstByteTable[ s[ i ] ] == 2;234 bool isDBCSLeadByte = uconvFirstByteTable[ (uchar) s[ i ] ] == 2; 235 235 if ( realLen < givenLen ) { 236 236 // enough space, store the glyph
Note:
See TracChangeset
for help on using the changeset viewer.