Changeset 169 for trunk/src/kernel/qapplication_pm.cpp
- Timestamp:
- Mar 31, 2007, 6:22:28 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qapplication_pm.cpp
r154 r169 1015 1015 // some undocumented system values 1016 1016 1017 SV_WORKAREA_YTOP = 51, 1018 SV_WORKAREA_YBOTTOM = 52, 1019 SV_WORKAREA_XRIGHT = 53, 1017 SV_WORKAREA_YTOP = 51, 1018 SV_WORKAREA_YBOTTOM = 52, 1019 SV_WORKAREA_XRIGHT = 53, 1020 1020 SV_WORKAREA_XLEFT = 54, 1021 1021 }; … … 1252 1252 #if 0 1253 1253 qDebug( "WM_CHAR: [%s]", widget->name() ); 1254 #endif 1254 #endif 1255 1255 QWidget *g = QWidget::keyboardGrabber(); 1256 1256 if ( g ) … … 1276 1276 } 1277 1277 break; 1278 } 1279 1280 case WM_QUERYCONVERTPOS : 1281 { 1282 // Ooops, how to get caret pos ? 1283 /// @todo (r=dmik) we should make usage of the QIMEvent 1284 // to query widgets about IME data (see how/where this event 1285 // is used across the sources) 1286 1287 PRECTL pcp = ( PRECTL )mp1; 1288 CURSORINFO ci; 1289 1290 WinQueryCursorInfo( HWND_DESKTOP, &ci ); 1291 1292 memset( pcp, 0xFF, sizeof( RECTL )); 1293 1294 pcp->xLeft = ci.x; 1295 pcp->yBottom = ci.y; 1296 WinMapWindowPoints( ci.hwnd, hwnd, ( PPOINTL )pcp, 2 ); 1297 1298 RETURN( QCP_CONVERT ); 1278 1299 } 1279 1300 … … 1787 1808 USHORT w = r.width(); 1788 1809 USHORT h = r.height(); 1789 // flip y coordinate 1810 // flip y coordinate 1790 1811 y = QApplication::desktop()->height() - (y + h); 1791 1812 WinSetWindowUShort( hwnd, QWS_XRESTORE, x ); … … 1867 1888 // WM_MINMAXFRAME, because WM_MINMAXFRAME is a pre-process message 1868 1889 // (i.e. no actual changes have been made) We need actual changes 1869 // in order to update the frame strut and send WindowStateChange. 1890 // in order to update the frame strut and send WindowStateChange. 1870 1891 result = TRUE; 1871 1892 rc = QtOldFrameProc( hwnd, msg, mp1, mp2 ); … … 2954 2975 ascii = ch; 2955 2976 if ( ascii > 0x7F ) ascii = 0; 2956 if ( ch ) 2957 text = QString::fromLocal8Bit( (char*)&ch, 1 ); 2977 if ( ch ) { 2978 // Note: Ignore the KC_CHAR flag when generating text for a key to get 2979 // correct (non-null) text even for Alt+Letter combinations (that 2980 // don't have KC_CHAR set) because processing Alt+Letter shortcuts 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. 2991 text = QString::fromLocal8Bit( (char *) &chm.chr, 2 ); 2992 } 2993 else 2994 text = QString::fromLocal8Bit( (char*) &ch, 1 ); 2995 } 2958 2996 } 2959 2997 … … 3022 3060 if ( nrecs == maxrecs ) { 3023 3061 #if defined(QT_CHECK_RANGE) 3024 3062 qWarning( "Qt: Internal keyboard buffer overflow" ); 3025 3063 #endif 3026 3064 return; 3027 3065 } 3028 3066 … … 3044 3082 3045 3083 if ( sm_blockUserInput ) // block user interaction during session management 3046 3084 return TRUE; 3047 3085 3048 3086 translateKeyCode( chm, code, ascii, state, text ); 3049 /// @todo (dmik) currently WM_CHARs chars with zero virtual code or zero 3050 // scancode are totally ignored. -- are they? 3051 // if ( !code || !chm.scancode ) return FALSE; 3087 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; 3052 3094 3053 3095 // Invert state logic … … 3072 3114 // "Alt depressed" event, that must preceed it, will be 3073 3115 // eaten by the system) 3074 find_key_rec( Qt::Key_Alt, TRUE ); 3116 find_key_rec( Qt::Key_Alt, TRUE ); 3075 3117 /// @todo (dmik) do the same for other global keys (ALT+TAB, ALT+ESC, CTRL+ESC) 3076 3118 // by handling this situation when we obtain/loose focus) … … 3080 3122 // that find_key_rec() above should also be removed to get identical behavior for 3081 3123 // all stolen keys. This will allow to solve the problem on the Qt application 3082 // level if needed (and even in a platform-independent manner). 3124 // level if needed (and even in a platform-independent manner). 3083 3125 } 3084 3126 return TRUE; … … 3127 3169 } 3128 3170 3129 #if 0 3171 #if 0 3130 3172 qDebug("WM_CHAR: RESULT = %d", (k0 || k1)); 3131 #endif 3173 #endif 3132 3174 return k0 || k1; 3133 3175 }
Note:
See TracChangeset
for help on using the changeset viewer.