Changeset 2204 for trunk/src/user32/windowmsg.cpp
- Timestamp:
- Dec 26, 1999, 6:30:20 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/windowmsg.cpp
r2200 r2204 1 /* $Id: windowmsg.cpp,v 1.1 1 1999-12-24 18:39:13 sandervlExp $ */1 /* $Id: windowmsg.cpp,v 1.12 1999-12-26 17:30:20 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 11 11 * TODO: GetQueueStatus: QS_HOTKEY (oslibmsg.cpp) & low word bits 12 12 * TODO: MsgWaitForMultipleObjects: timeout isn't handled correctly (can return too late) 13 * TODO: GetMessageExtraInfo14 13 * 15 14 * Project Odin Software License can be found in LICENSE.TXT … … 22 21 #include <heapstring.h> 23 22 #include <handlemanager.h> 23 #include "oslibutil.h" 24 24 #include "oslibwin.h" 25 25 #include "oslibmsg.h" … … 95 95 } 96 96 //****************************************************************************** 97 //TODO: 97 //TODO: 98 98 //****************************************************************************** 99 99 LONG WIN32API GetMessageExtraInfo() 100 100 { 101 dprintf(("USER32: GetMessageExtraInfo NOT SUPPORTED"));102 return 0;101 dprintf(("USER32: GetMessageExtraInfo")); 102 return GetThreadMessageExtraInfo(); 103 103 } 104 104 //****************************************************************************** … … 124 124 if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST) 125 125 { 126 127 126 Win32BaseWindow::BroadcastMessageA(BROADCAST_SEND, msg, wParam, lParam); 127 return TRUE; 128 128 } 129 129 … … 143 143 if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST) 144 144 { 145 146 145 Win32BaseWindow::BroadcastMessageW(BROADCAST_SEND, msg, wParam, lParam); 146 return TRUE; 147 147 } 148 148 … … 162 162 if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST??? 163 163 { 164 165 164 Win32BaseWindow::BroadcastMessageA(BROADCAST_POST, msg, wParam, lParam); 165 return TRUE; 166 166 } 167 167 … … 185 185 if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST??? 186 186 { 187 188 187 Win32BaseWindow::BroadcastMessageW(BROADCAST_POST, msg, wParam, lParam); 188 return TRUE; 189 189 } 190 190 … … 264 264 } 265 265 //****************************************************************************** 266 //No need to support this 266 //No need to support this (obsolete, not implemented by Win32) 267 267 //****************************************************************************** 268 268 BOOL WIN32API SetMessageQueue(int cMessagesMax) … … 320 320 { 321 321 #ifdef DEBUG 322 WriteLog("USER32: SetMessageExtraInfo , not implemented\n");322 WriteLog("USER32: SetMessageExtraInfo\n"); 323 323 #endif 324 return (0);324 return SetThreadMessageExtraInfo(lParam); 325 325 } 326 326 /***************************************************************************** … … 447 447 //****************************************************************************** 448 448 /********************************************************************** 449 * 449 * WINPROC_TestCBForStr 450 450 * 451 451 * Return TRUE if the lparam is a string … … 454 454 { 455 455 BOOL retvalue; 456 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 456 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 457 457 retvalue = ( !(LOWORD(dwStyle) & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || 458 458 (LOWORD(dwStyle) & CBS_HASSTRINGS) ); 459 459 return retvalue; 460 460 } 461 461 /********************************************************************** 462 * 462 * WINPROC_TestLBForStr 463 463 * 464 464 * Return TRUE if the lparam is a string … … 467 467 { 468 468 BOOL retvalue; 469 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 469 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 470 470 retvalue = ( !(LOWORD(dwStyle) & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || 471 471 (LOWORD(dwStyle) & LBS_HASSTRINGS) ); 472 472 return retvalue; 473 473 } 474 474 475 475 /********************************************************************** 476 * 476 * WINPROC_MapMsg32ATo32W 477 477 * 478 478 * Map a message from Ansi to Unicode. … … 484 484 * FIXME: 485 485 * WM_GETTEXT/WM_SETTEXT and static control with SS_ICON style: 486 * the first four bytes are the handle of the icon 486 * the first four bytes are the handle of the icon 487 487 * when the WM_SETTEXT message has been used to set the icon 488 488 */ … … 550 550 case LB_ADDSTRING: 551 551 case LB_INSERTSTRING: 552 552 if ( WINPROC_TestLBForStr( hwnd )) 553 553 *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); 554 554 return (*plparam ? 1 : -1); 555 555 556 case LB_GETTEXT: 556 case LB_GETTEXT: /* fixme: fixed sized buffer */ 557 557 { if ( WINPROC_TestLBForStr( hwnd )) 558 558 { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) ); 559 559 if (!ptr) return -1; 560 560 *ptr++ = *plparam; /* Store previous lParam */ 561 561 *plparam = (LPARAM)ptr; 562 562 } 563 563 } 564 564 return 1; … … 567 567 case CB_ADDSTRING: 568 568 case CB_INSERTSTRING: 569 569 if ( WINPROC_TestCBForStr( hwnd )) 570 570 *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); 571 571 return (*plparam ? 1 : -1); … … 577 577 *ptr++ = *plparam; /* Store previous lParam */ 578 578 *plparam = (LPARAM)ptr; 579 579 } 580 580 } 581 581 return 1; … … 584 584 case EM_GETLINE: 585 585 { WORD len = (WORD)*plparam; 586 586 LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) ); 587 587 if (!ptr) return -1; 588 588 *ptr++ = *plparam; /* Store previous lParam */ 589 589 *((WORD *) ptr) = len; /* Store the length */ 590 590 *plparam = (LPARAM)ptr; 591 591 } 592 592 return 1; 593 593 … … 606 606 607 607 /********************************************************************** 608 * 608 * WINPROC_UnmapMsg32ATo32W 609 609 * 610 610 * Unmap a message that was mapped from Ansi to Unicode. … … 662 662 case LB_ADDSTRING: 663 663 case LB_INSERTSTRING: 664 664 if ( WINPROC_TestLBForStr( hwnd )) 665 665 HeapFree( GetProcessHeap(), 0, (void *)lParam ); 666 666 break; … … 669 669 { if ( WINPROC_TestLBForStr( hwnd )) 670 670 { LPARAM *ptr = (LPARAM *)lParam - 1; 671 671 lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) ); 672 672 HeapFree( GetProcessHeap(), 0, ptr ); 673 673 } 674 674 } 675 675 break; … … 678 678 case CB_ADDSTRING: 679 679 case CB_INSERTSTRING: 680 680 if ( WINPROC_TestCBForStr( hwnd )) 681 681 HeapFree( GetProcessHeap(), 0, (void *)lParam ); 682 682 break; … … 684 684 case CB_GETLBTEXT: 685 685 { if ( WINPROC_TestCBForStr( hwnd )) 686 686 { LPARAM *ptr = (LPARAM *)lParam - 1; 687 687 lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) ); 688 688 HeapFree( GetProcessHeap(), 0, ptr ); 689 689 } 690 690 } 691 691 break; … … 694 694 case EM_GETLINE: 695 695 { LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lParam */ 696 696 WORD len = *(WORD *) lParam; 697 697 lstrcpynWtoA( (LPSTR)*ptr , (LPWSTR)lParam, len ); 698 698 HeapFree( GetProcessHeap(), 0, ptr ); … … 704 704 705 705 /********************************************************************** 706 * 706 * WINPROC_MapMsg32WTo32A 707 707 * 708 708 * Map a message from Unicode to Ansi. … … 772 772 case LB_ADDSTRING: 773 773 case LB_INSERTSTRING: 774 774 if ( WINPROC_TestLBForStr( hwnd )) 775 775 *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam ); 776 776 return (*plparam ? 1 : -1); 777 777 778 case LB_GETTEXT: 778 case LB_GETTEXT: /* fixme: fixed sized buffer */ 779 779 { if ( WINPROC_TestLBForStr( hwnd )) 780 780 { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) ); 781 781 if (!ptr) return -1; 782 782 *ptr++ = *plparam; /* Store previous lParam */ 783 783 *plparam = (LPARAM)ptr; 784 784 } 785 785 } 786 786 return 1; … … 789 789 case CB_ADDSTRING: 790 790 case CB_INSERTSTRING: 791 791 if ( WINPROC_TestCBForStr( hwnd )) 792 792 *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam ); 793 793 return (*plparam ? 1 : -1); 794 794 795 case CB_GETLBTEXT: 795 case CB_GETLBTEXT: /* fixme: fixed sized buffer */ 796 796 { if ( WINPROC_TestCBForStr( hwnd )) 797 797 { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) ); 798 798 if (!ptr) return -1; 799 799 *ptr++ = *plparam; /* Store previous lParam */ 800 800 *plparam = (LPARAM)ptr; 801 801 } 802 802 } 803 803 return 1; … … 806 806 case EM_GETLINE: 807 807 { WORD len = (WORD)*plparam; 808 808 LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) ); 809 809 if (!ptr) return -1; 810 810 *ptr++ = *plparam; /* Store previous lParam */ 811 811 *((WORD *) ptr) = len; /* Store the length */ 812 812 *plparam = (LPARAM)ptr; 813 813 } 814 814 return 1; 815 815 … … 828 828 829 829 /********************************************************************** 830 * 830 * WINPROC_UnmapMsg32WTo32A 831 831 * 832 832 * Unmap a message that was mapped from Unicode to Ansi. … … 884 884 case LB_ADDSTRING: 885 885 case LB_INSERTSTRING: 886 886 if ( WINPROC_TestLBForStr( hwnd )) 887 887 HeapFree( GetProcessHeap(), 0, (void *)lParam ); 888 888 break; … … 893 893 lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) ); 894 894 HeapFree(GetProcessHeap(), 0, ptr ); 895 895 } 896 896 } 897 897 break; … … 900 900 case CB_ADDSTRING: 901 901 case CB_INSERTSTRING: 902 902 if ( WINPROC_TestCBForStr( hwnd )) 903 903 HeapFree( GetProcessHeap(), 0, (void *)lParam ); 904 904 break; … … 909 909 lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) ); 910 910 HeapFree( GetProcessHeap(), 0, ptr ); 911 911 } 912 912 } 913 913 break; … … 916 916 case EM_GETLINE: 917 917 { LPARAM * ptr = (LPARAM *)lParam - 1; /* get the old lparam */ 918 918 WORD len = *(WORD *)ptr; 919 919 lstrcpynAtoW( (LPWSTR) *ptr, (LPSTR)lParam, len ); 920 920 HeapFree( GetProcessHeap(), 0, ptr ); … … 925 925 926 926 /********************************************************************** 927 * 927 * WINPROC_CallProc32ATo32W 928 928 * 929 929 * Call a window procedure, translating args from Ansi to Unicode. … … 942 942 943 943 /********************************************************************** 944 * 944 * WINPROC_CallProc32WTo32A 945 945 * 946 946 * Call a window procedure, translating args from Unicode to Ansi. … … 970 970 dprintf(("USER32: GetQueueStatus")); 971 971 queueStatus = OSLibWinQueryQueueStatus(); 972 972 973 973 queueStatus = MAKELONG(queueStatus, queueStatus); 974 974 return queueStatus & MAKELONG(flags, flags); … … 1011 1011 if (nCount == 0) 1012 1012 { 1013 1014 1015 1016 1017 1018 1013 if(dwMilliseconds == 0) { 1014 if(GetQueueStatus(dwWakeMask) == 0) { 1015 return WAIT_TIMEOUT; 1016 } 1017 return WAIT_OBJECT_0; 1018 } 1019 1019 //SvL: Check time, wait for any message, check msg type and determine if 1020 1020 // we have to return 1021 1022 1021 //TODO: Timeout isn't handled correctly (can return too late) 1022 curtime = GetCurrentTime(); 1023 1023 endtime = curtime + dwMilliseconds; 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1024 while(curtime < endtime || dwMilliseconds == INFINITE) { 1025 if(OSLibWinWaitMessage() == FALSE) { 1026 dprintf(("OSLibWinWaitMessage returned FALSE!")); 1027 return -1; 1028 } 1029 if(GetQueueStatus(dwWakeMask) != 0) { 1030 return WAIT_OBJECT_0; 1031 } 1032 curtime = GetCurrentTime(); 1033 } 1034 1034 return WAIT_TIMEOUT; 1035 1035 }
Note:
See TracChangeset
for help on using the changeset viewer.