Ignore:
Timestamp:
Jan 2, 2001, 7:14:59 PM (25 years ago)
Author:
sandervl
Message:

more logging, rewrote window handle management, don't export odin external functions by name

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:26 sandervl Exp $ */
     1/* $Id: win32wndhandle.cpp,v 1.8 2001-01-02 18:14:59 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    3434ULONG  WindowHandleTable[MAX_WINDOW_HANDLES] = {0};
    3535VMutex tableMutex(VMUTEX_SHARED, &hGlobalTableMutex);
    36 ULONG  lowestFreeIndex = 0;
     36ULONG  lastIndex = 0;
    3737#pragma data_seg()
    3838
     
    4242{
    4343  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) {
    4556        //oops, out of handles
    46         dprintf(("USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!"));
    4757        tableMutex.leave(&hGlobalTableMutex);
     58        dprintf(("ERROR: USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!"));
    4859        DebugInt3();
    4960        return FALSE;
    5061  }
    51   *hwnd           = lowestFreeIndex;
    52   *hwnd          |= WNDHANDLE_MAGIC_HIGHWORD;
    53   WindowHandleTable[lowestFreeIndex] = dwUserData;
     62  *hwnd  = lastIndex;
     63  *hwnd |= WNDHANDLE_MAGIC_HIGHWORD;
     64  WindowHandleTable[lastIndex] = dwUserData;
    5465
    55   lowestFreeIndex = -1;
    56 
    57   //find next free handle
    58   for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
    59         if(WindowHandleTable[i] == 0) {
    60                 lowestFreeIndex = i;
    61                 break;
    62         }
    63   }
    6466  tableMutex.leave(&hGlobalTableMutex);
    6567  return TRUE;
     
    7375        tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex);
    7476        WindowHandleTable[hwnd] = 0;
    75         if(lowestFreeIndex == -1 || hwnd < lowestFreeIndex)
    76                 lowestFreeIndex = hwnd;
    77 
    7877        tableMutex.leave(&hGlobalTableMutex);
    7978  }
Note: See TracChangeset for help on using the changeset viewer.