Changeset 10190 for trunk/src/user32/windowmsg.cpp
- Timestamp:
- Jul 31, 2003, 5:58:58 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/windowmsg.cpp
r10185 r10190 1 /* $Id: windowmsg.cpp,v 1.4 3 2003-07-28 11:27:50sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.44 2003-07-31 15:56:47 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 86 86 return 0; /* invalid winproc */ 87 87 88 return CallWindowProc A( (WNDPROC)msg->lParam, msg->hwnd,88 return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd, 89 89 msg->message, msg->wParam, GetTickCount() ); 90 90 } … … 319 319 { 320 320 case WM_GETTEXT: 321 case WM_ASKCBFORMATNAME: 321 322 { 322 323 LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, … … 330 331 case WM_SETTEXT: 331 332 case WM_WININICHANGE: 333 case WM_DEVMODECHANGE: 332 334 case CB_DIR: 333 335 case LB_DIR: … … 431 433 return 1; 432 434 433 /* kso 2003-07-03: to make password field work, I took this from latest wine code. (winproc.c) */ 435 case WM_CHARTOITEM: 436 case WM_MENUCHAR: 437 case WM_CHAR: 438 case WM_DEADCHAR: 439 case WM_SYSCHAR: 440 case WM_SYSDEADCHAR: 434 441 case EM_SETPASSWORDCHAR: 435 442 { 436 BYTEch = LOWORD(*pwparam);437 WCHAR wch = 0;438 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)&ch, 1, &wch, 1);443 char ch = LOWORD(*pwparam); 444 WCHAR wch; 445 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1); 439 446 *pwparam = MAKEWPARAM( wch, HIWORD(*pwparam) ); 440 447 } 441 448 return 0; 442 449 443 case WM_ASKCBFORMATNAME:444 case WM_DEVMODECHANGE:445 450 case WM_PAINTCLIPBOARD: 446 451 case WM_SIZECLIPBOARD: … … 463 468 { 464 469 case WM_GETTEXT: 470 case WM_ASKCBFORMATNAME: 465 471 { 466 472 LPARAM *ptr = (LPARAM *)lParam - 1; … … 495 501 case WM_SETTEXT: 496 502 case WM_WININICHANGE: 503 case WM_DEVMODECHANGE: 497 504 case CB_DIR: 498 505 case LB_DIR: … … 569 576 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed. 570 577 */ 571 INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam)578 INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam) 572 579 { switch(msg) 573 580 { 574 581 case WM_GETTEXT: 575 { 582 case WM_ASKCBFORMATNAME: 583 { 584 #ifdef __WIN32OS2__ 585 *pwparam = *pwparam * sizeof( WCHAR ); //DBCS 586 #endif 576 587 LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 577 wParam + sizeof(LPARAM) );588 *pwparam + sizeof(LPARAM) ); 578 589 if (!ptr) return -1; 579 590 *ptr++ = *plparam; /* Store previous lParam */ … … 584 595 case WM_SETTEXT: 585 596 case WM_WININICHANGE: 597 case WM_DEVMODECHANGE: 586 598 case CB_DIR: 587 599 case LB_DIR: … … 681 693 if (!ptr) return -1; 682 694 *ptr++ = *plparam; /* Store previous lParam */ 695 #ifdef __WIN32OS2__ 696 *((WORD *) ptr) = len * sizeof(WCHAR); /* Store the length */ 697 #else 683 698 *((WORD *) ptr) = len; /* Store the length */ 699 #endif 684 700 *plparam = (LPARAM)ptr; 685 701 } 686 702 return 1; 687 703 688 case WM_ASKCBFORMATNAME: 689 case WM_DEVMODECHANGE: 704 case WM_CHARTOITEM: 705 case WM_MENUCHAR: 706 case WM_CHAR: 707 case WM_DEADCHAR: 708 case WM_SYSCHAR: 709 case WM_SYSDEADCHAR: 710 case EM_SETPASSWORDCHAR: 711 { 712 WCHAR wch = LOWORD(*pwparam); 713 char ch; 714 WideCharToMultiByte( CP_ACP, 0, &wch, 1, &ch, 1, NULL, NULL ); 715 *pwparam = MAKEWPARAM( ch, HIWORD(*pwparam) ); 716 } 717 return 0; 718 690 719 case WM_PAINTCLIPBOARD: 691 720 case WM_SIZECLIPBOARD: 692 case EM_SETPASSWORDCHAR:693 721 // FIXME_(msg)("message %s (%04x) needs translation, please report\n",SPY_GetMsgName(msg),msg ); 694 722 return -1; … … 709 737 { 710 738 case WM_GETTEXT: 739 case WM_ASKCBFORMATNAME: 711 740 { 712 741 LPARAM *ptr = (LPARAM *)lParam - 1; 742 743 #ifdef __WIN32OS2__ 744 wParam = wParam / sizeof( WCHAR ); 745 #endif 713 746 lstrcpynAtoW( (LPWSTR)*ptr, (LPSTR)lParam, wParam ); 714 747 HeapFree( GetProcessHeap(), 0, ptr ); … … 718 751 case WM_SETTEXT: 719 752 case WM_WININICHANGE: 753 case WM_DEVMODECHANGE: 720 754 case CB_DIR: 721 755 case LB_DIR: … … 800 834 case EM_GETLINE: 801 835 { LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lparam */ 836 #ifdef __WIN32OS2__ 837 WORD len = *(WORD *)ptr/sizeof(WCHAR); 838 #else 802 839 WORD len = *(WORD *)ptr; 840 #endif 803 841 lstrcpynAtoW( (LPWSTR) *ptr, (LPSTR)lParam, len ); 804 842 HeapFree( GetProcessHeap(), 0, ptr ); … … 819 857 LRESULT result; 820 858 859 #ifdef __WIN32OS2__ 860 if( IsDBCSEnv() && msg == WM_CHAR ) 861 { 862 static BYTE dbcsLead = 0; 863 WCHAR charA = wParam; 864 int size = dbcsLead ? 2 : 1; 865 866 if( dbcsLead ) 867 charA = ( charA << 8 ) | dbcsLead; 868 else if( IsDBCSLeadByte( wParam )) 869 { 870 dbcsLead = wParam; 871 return 0; 872 } 873 MultiByteToWideChar( CP_ACP, 0, ( LPSTR )&charA, size, ( LPWSTR )&wParam, 1 ); 874 875 dbcsLead = 0; 876 } 877 else 878 #endif 821 879 if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0; 880 822 881 result = func( hwnd, msg, wParam, lParam ); 823 882 WINPROC_UnmapMsg32ATo32W( hwnd, msg, wParam, lParam ); 883 884 #ifdef __WIN32OS2__ 885 if(IsDBCSEnv()) 886 { 887 switch( msg ) 888 { 889 case WM_GETTEXTLENGTH : 890 { 891 LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR )); 892 result = func( hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )ustr ); 893 result = lstrlenWtoA( ustr, result ); 894 HeapFree( GetProcessHeap(), 0, ustr ); 895 break; 896 } 897 898 case LB_GETTEXTLEN : 899 { 900 LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR )); 901 result = func( hwnd, LB_GETTEXT, wParam, ( LPARAM )ustr ); 902 if( result != LB_ERR ) 903 result = lstrlenWtoA( ustr, result ); 904 905 HeapFree( GetProcessHeap(), 0, ustr ); 906 break; 907 } 908 909 910 case CB_GETLBTEXTLEN : 911 { 912 LPWSTR ustr = ( LPWSTR )HeapAlloc( GetProcessHeap(), 0, ( result + 1 ) * sizeof( WCHAR )); 913 result = func( hwnd, CB_GETLBTEXT, wParam, ( LPARAM )ustr ); 914 if( result != CB_ERR ) 915 result = lstrlenWtoA( ustr, result ); 916 917 HeapFree( GetProcessHeap(), 0, ustr ); 918 break; 919 } 920 } 921 } 922 #endif 824 923 return result; 825 924 } … … 836 935 LRESULT result; 837 936 838 if (WINPROC_MapMsg32WTo32A( hwnd, msg, wParam, &lParam ) == -1) return 0; 937 #ifdef __WIN32OS2__ 938 if( IsDBCSEnv() && msg == WM_CHAR ) 939 { 940 char charA[ 2 ]; 941 942 if( WideCharToMultiByte( CP_ACP, 0, ( LPWSTR )&wParam, 1, ( LPSTR )charA, 2, 0, 0 ) > 1 ) 943 { 944 func( hwnd, msg, ( WPARAM )charA[ 0 ], lParam ); 945 wParam = charA[ 1 ]; 946 } 947 else 948 wParam = charA[ 0 ]; 949 } 950 else 951 #endif 952 if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0; 839 953 840 954 result = func( hwnd, msg, wParam, lParam ); 841 955 WINPROC_UnmapMsg32WTo32A( hwnd, msg, wParam, lParam ); 956 957 #ifdef __WIN32OS2__ 958 if( IsDBCSEnv() ) 959 { 960 switch( msg ) 961 { 962 case WM_GETTEXTLENGTH : 963 { 964 LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 ); 965 result = func( hwnd, WM_GETTEXT, ( WPARAM )( result + 1 ), ( LPARAM )astr ); 966 result = lstrlenAtoW( astr, result ); 967 HeapFree( GetProcessHeap(), 0, astr ); 968 break; 969 } 970 971 case LB_GETTEXTLEN : 972 { 973 LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 ); 974 result = func( hwnd, LB_GETTEXT, wParam, ( LPARAM )astr ); 975 if( result != LB_ERR ) 976 result = lstrlenAtoW( astr, result ); 977 978 HeapFree( GetProcessHeap(), 0, astr ); 979 break; 980 } 981 982 983 case CB_GETLBTEXTLEN : 984 { 985 LPSTR astr = ( LPSTR )HeapAlloc( GetProcessHeap(), 0, result + 1 ); 986 result = func( hwnd, CB_GETLBTEXT, wParam, ( LPARAM )astr ); 987 if( result != CB_ERR ) 988 result = lstrlenAtoW( astr, result ); 989 990 HeapFree( GetProcessHeap(), 0, astr ); 991 break; 992 } 993 } 994 } 995 #endif 842 996 return result; 843 997 }
Note:
See TracChangeset
for help on using the changeset viewer.