Changeset 4866 for trunk/src/user32/win32wndhandle.cpp
- Timestamp:
- Jan 2, 2001, 7:14:59 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wndhandle.cpp
r3207 r4866 1 /* $Id: win32wndhandle.cpp,v 1. 7 2000-03-23 19:24:26sandervl Exp $ */1 /* $Id: win32wndhandle.cpp,v 1.8 2001-01-02 18:14:59 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Handle Management Code for OS/2 … … 34 34 ULONG WindowHandleTable[MAX_WINDOW_HANDLES] = {0}; 35 35 VMutex tableMutex(VMUTEX_SHARED, &hGlobalTableMutex); 36 ULONG l owestFreeIndex = 0;36 ULONG lastIndex = 0; 37 37 #pragma data_seg() 38 38 … … 42 42 { 43 43 tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex); 44 if(lowestFreeIndex == -1) { 44 45 //find next free handle 46 if(lastIndex >= MAX_WINDOW_HANDLES-1) { 47 lastIndex = 0; 48 } 49 for(int i=lastIndex;i<MAX_WINDOW_HANDLES;i++) { 50 if(WindowHandleTable[i] == 0) { 51 lastIndex = i; 52 break; 53 } 54 } 55 if(i == MAX_WINDOW_HANDLES) { 45 56 //oops, out of handles 46 dprintf(("USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!"));47 57 tableMutex.leave(&hGlobalTableMutex); 58 dprintf(("ERROR: USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!")); 48 59 DebugInt3(); 49 60 return FALSE; 50 61 } 51 *hwnd = lowestFreeIndex;52 *hwnd 53 WindowHandleTable[l owestFreeIndex] = dwUserData;62 *hwnd = lastIndex; 63 *hwnd |= WNDHANDLE_MAGIC_HIGHWORD; 64 WindowHandleTable[lastIndex] = dwUserData; 54 65 55 lowestFreeIndex = -1;56 57 //find next free handle58 for(int i=0;i<MAX_WINDOW_HANDLES;i++) {59 if(WindowHandleTable[i] == 0) {60 lowestFreeIndex = i;61 break;62 }63 }64 66 tableMutex.leave(&hGlobalTableMutex); 65 67 return TRUE; … … 73 75 tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex); 74 76 WindowHandleTable[hwnd] = 0; 75 if(lowestFreeIndex == -1 || hwnd < lowestFreeIndex)76 lowestFreeIndex = hwnd;77 78 77 tableMutex.leave(&hGlobalTableMutex); 79 78 }
Note:
See TracChangeset
for help on using the changeset viewer.