Changeset 3525 for trunk/src


Ignore:
Timestamp:
May 12, 2000, 8:09:42 PM (25 years ago)
Author:
sandervl
Message:

hook, syscolor & message bugfixes

Location:
trunk/src/user32
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/HOOK.CPP

    r3207 r3525  
    1 /* $Id: HOOK.CPP,v 1.13 2000-03-23 19:24:25 sandervl Exp $ */
     1/* $Id: HOOK.CPP,v 1.14 2000-05-12 18:09:39 sandervl Exp $ */
    22
    33/*
     
    333333  HOOKDATA **prevHook;
    334334  THDB     *thdb;
    335   VMutex   *hookMutex;
    336335
    337336    dprintf(("Removing hook %08x\n", data));
     
    358357                return FALSE;
    359358        }
    360         hookMutex = &threadHookMutex;
    361         hookMutex->enter();
     359        threadHookMutex.enter();
    362360        prevHook = (HOOKDATA **)&thdb->hooks[data->id - WH_MINHOOK];
    363361    }
    364362    else {
    365         hookMutex = &systemHookMutex;
    366         hookMutex->enter();
     363        systemHookMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalHookMutex);
    367364        prevHook = (HOOKDATA **)&HOOK_systemHooks[data->id - WH_MINHOOK];
    368365    }
     
    371368
    372369    if (!prevHook) {
    373         hookMutex->leave();
     370        if (data->ownerThread) {
     371                threadHookMutex.leave();
     372        }
     373        else    systemHookMutex.leave(&hGlobalHookMutex);
     374
    374375        return FALSE;
    375376    }
    376377    *prevHook = (HOOKDATA *)data->next;
    377     hookMutex->leave();
     378
     379    if (data->ownerThread) {
     380         threadHookMutex.leave();
     381    }
     382    else systemHookMutex.leave(&hGlobalHookMutex);
    378383
    379384    HeapFree(GetProcessHeap(), 0, (LPVOID)data );
  • trunk/src/user32/dc.cpp

    r3489 r3525  
    1 /* $Id: dc.cpp,v 1.56 2000-05-03 20:59:41 achimha Exp $ */
     1/* $Id: dc.cpp,v 1.57 2000-05-12 18:09:39 sandervl Exp $ */
    22
    33/*
     
    11261126   {
    11271127        //TODO: SvL: pingpong.exe doesn't have RDW_NOERASE, but doesn't want WM_ERASEBKGND msgs
    1128         if (redraw & RDW_ERASE_W)
    1129             wnd->setEraseBkgnd (TRUE);
     1128        if (redraw & RDW_ERASE_W) {
     1129             wnd->setEraseBkgnd(TRUE);
     1130        }
    11301131
    11311132        if (!pRect && !hrgn)
     
    12121213   BOOL result;
    12131214
     1215   if(pRect) {
     1216        dprintf(("InvalidateRect %x (%d,%d)(%d,%d) erase=%d", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, erase));
     1217   }
     1218   else dprintf(("InvalidateRect %x NULL erase=%d", hwnd, erase));
    12141219   result = RedrawWindow (hwnd, pRect, NULLHANDLE,
    12151220                          RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
     
    12241229   BOOL result;
    12251230
     1231   dprintf(("InvalidateRgn %x %x erase=%d", hwnd, hrgn, erase));
    12261232   result = RedrawWindow (hwnd, NULL, hrgn,
    12271233                          RDW_ALLCHILDREN_W | RDW_INVALIDATE_W |
  • trunk/src/user32/oslibmsg.cpp

    r3373 r3525  
    1 /* $Id: oslibmsg.cpp,v 1.32 2000-04-13 18:50:44 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.33 2000-05-12 18:09:40 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    9999#define MAX_MSGTRANSTAB (sizeof(MsgTransTab)/sizeof(MsgTransTab[0]))
    100100
    101 QMSG *MsgThreadPtr = 0;
    102 
    103101LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
    104102
    105 //******************************************************************************
    106 //******************************************************************************
    107 BOOL OSLibInitMsgQueue()
    108 {
    109    if(DosAllocThreadLocalMemory(sizeof(QMSG)/sizeof(ULONG), (PULONG *)&MsgThreadPtr) != 0)
    110    {
    111         dprintf(("OSLibInitMsgQueue: local thread memory alloc failed!!"));
    112         DebugInt3();
    113         return FALSE;
    114    }
    115    return TRUE;
    116 }
    117103//******************************************************************************
    118104//******************************************************************************
     
    176162  //  WinToOS2MsgTranslate(msg, &qmsg, isUnicode);
    177163
    178   if(msg->time == MsgThreadPtr->time || msg->hwnd == 0) {
    179         memcpy(&os2msg, MsgThreadPtr, sizeof(QMSG));
    180         MsgThreadPtr->time = -1;
     164  if(!memcmp(msg, &thdb->winmsg, sizeof(MSG)) || msg->hwnd == 0) {
     165        memcpy(&os2msg, &thdb->os2msg, sizeof(QMSG));
     166        thdb->os2msg.time = -1;
     167        thdb->winmsg.time = -1;
    181168        if(msg->hwnd) {
    182169                thdb->nrOfMsgs = 1;
     
    185172        }
    186173        if(os2msg.hwnd || os2msg.msg == WM_QUIT) {
    187                 memset(MsgThreadPtr, 0, sizeof(*MsgThreadPtr));
     174                memset(&thdb->os2msg, 0, sizeof(thdb->os2msg));
     175                memset(&thdb->winmsg, 0, sizeof(thdb->winmsg));
    188176                return (LONG)WinDispatchMsg(thdb->hab, &os2msg);
    189177        }
     
    235223        thdb->fTranslated = FALSE;
    236224        memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG));
    237         MsgThreadPtr->msg  = 0;
    238         MsgThreadPtr->hwnd = 0;
     225        thdb->os2msg.msg  = 0;
     226        thdb->os2msg.hwnd = 0;
    239227        return (pMsg->message != WINWM_QUIT);
    240228  }
     
    261249
    262250  OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE);
    263   memcpy(MsgThreadPtr, &os2msg, sizeof(QMSG));
     251  memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG));
     252  memcpy(&thdb->winmsg, pMsg, sizeof(MSG));
    264253
    265254  if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN)
     
    317306        if(fRemove & PM_REMOVE_W) {
    318307            thdb->fTranslated = FALSE;
    319             MsgThreadPtr->msg  = 0;
    320             MsgThreadPtr->hwnd = 0;
     308            thdb->os2msg.msg  = 0;
     309            thdb->os2msg.hwnd = 0;
    321310        }
    322311        memcpy(pMsg, &thdb->msgWCHAR, sizeof(MSG));
     
    343332  //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message
    344333  if(fRemove & PM_REMOVE_W) {
    345         memcpy(MsgThreadPtr, &os2msg, sizeof(QMSG));
     334        memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG));
     335        memcpy(&thdb->winmsg, pMsg, sizeof(MSG));
    346336  }
    347337
  • trunk/src/user32/oslibmsg.h

    r2469 r3525  
    1 /* $Id: oslibmsg.h,v 1.12 2000-01-18 20:08:11 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.13 2000-05-12 18:09:40 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    2121BOOL  OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved);
    2222void  WinToOS2MsgTranslate(MSG *winMsg, QMSG *os2Msg, BOOL isUnicode);
    23 
    24 extern QMSG *MsgThreadPtr;
    2523
    2624#endif
     
    3533
    3634ULONG OSLibWinQueryMsgTime();
    37 BOOL  OSLibInitMsgQueue();
    3835BOOL  OSLibWinWaitMessage();
    3936BOOL  OSLibWinInSendMessage();
  • trunk/src/user32/oslibmsgtranslate.cpp

    r3482 r3525  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.29 2000-05-02 20:50:49 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.30 2000-05-12 18:09:40 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    865865    //NOTE: These actually need to be posted so that the next message retrieved by GetMessage contains
    866866    //      the newly generated WM_CHAR message.
    867     if(!thdb->fTranslated && MsgThreadPtr->msg == WM_CHAR && !((SHORT1FROMMP(MsgThreadPtr->mp1) & KC_KEYUP) == KC_KEYUP))
     867    if(!thdb->fTranslated && thdb->os2msg.msg == WM_CHAR && !((SHORT1FROMMP(thdb->os2msg.mp1) & KC_KEYUP) == KC_KEYUP))
    868868    {//TranslatedMessage was called before DispatchMessage, so queue WM_CHAR message
    869             ULONG fl = SHORT1FROMMP(MsgThreadPtr->mp1);
     869            ULONG fl = SHORT1FROMMP(thdb->os2msg.mp1);
    870870            MSG extramsg;
    871871
    872872            memcpy(&extramsg, msg, sizeof(MSG));
    873             extramsg.wParam = SHORT1FROMMP(MsgThreadPtr->mp2);
     873            extramsg.wParam = SHORT1FROMMP(thdb->os2msg.mp2);
    874874            extramsg.lParam = 0;
    875875
     
    881881                if(msg->wParam)
    882882                        extramsg.wParam = msg->wParam;
    883                 else    extramsg.wParam = SHORT2FROMMP(MsgThreadPtr->mp2);
     883                else    extramsg.wParam = SHORT2FROMMP(thdb->os2msg.mp2);
    884884            }
    885885
  • trunk/src/user32/pmframe.cpp

    r3462 r3525  
    1 /* $Id: pmframe.cpp,v 1.52 2000-04-29 18:28:38 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.53 2000-05-12 18:09:41 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    229229    {
    230230        dprintf(("PMFRAME: WM_PAINT"));
    231         if (win32wnd->getStyle() & WS_MINIMIZE_W)
    232          goto RunDefFrameProc;
    233         if (win32wnd->IsWindowCreated())
    234           win32wnd->MsgNCPaint();
     231        if(win32wnd->getStyle() & WS_MINIMIZE_W)
     232                goto RunDefFrameProc;
     233        if(win32wnd->IsWindowCreated())
     234                win32wnd->MsgNCPaint();
     235
    235236        goto RunDefWndProc;
    236237    }
     
    444445
    445446    case WM_ERASEBACKGROUND:
    446         break;
     447    {
     448        dprintf(("PMFRAME: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
     449        RestoreOS2TIB();
     450        return (MRESULT)FALSE;
     451    }
    447452
    448453    case WM_CALCVALIDRECTS:
  • trunk/src/user32/pmwindow.cpp

    r3388 r3525  
    1 /* $Id: pmwindow.cpp,v 1.89 2000-04-15 15:11:13 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.90 2000-05-12 18:09:41 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    140140
    141141   dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight));
    142    return OSLibInitMsgQueue();
     142   return TRUE;
    143143} /* End of main */
    144144//******************************************************************************
     
    439439
    440440    case WM_PAINT:
     441    {
     442//     RECTL rectl;
     443
    441444        dprintf(("OS2: WM_PAINT"));
    442445        win32wnd->DispatchMsgA(pWinMsg);
    443         goto RunDefWndProc;
     446        //SvL: Not calling the default window procedure causes all sorts of
     447        //     strange problems (redraw & hanging app)
     448//      WinQueryUpdateRect(hwnd, &rectl);
     449//        if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) {
     450//              RestoreOS2TIB();
     451//              return (MRESULT)FALSE;
     452//      }
     453//      dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message));
     454        goto RunDefWndProc;
     455    }
    444456
    445457    case WM_CONTEXTMENU:
  • trunk/src/user32/syscolor.cpp

    r2873 r3525  
    1 /* $Id: syscolor.cpp,v 1.20 2000-02-23 17:05:16 cbratschi Exp $ */
     1/* $Id: syscolor.cpp,v 1.21 2000-05-12 18:09:41 sandervl Exp $ */
    22
    33/*
     
    229229    }
    230230
    231     return SetSysColors(nChanges, lpSysColor, lpColorValues);
     231//SvL: ???
     232////////    return SetSysColors(nChanges, lpSysColor, lpColorValues);
    232233
    233234    /* Send WM_SYSCOLORCHANGE message to all windows */
  • trunk/src/user32/win32wbase.cpp

    r3513 r3525  
    1 /* $Id: win32wbase.cpp,v 1.186 2000-05-10 13:14:43 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.187 2000-05-12 18:09:42 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    10561056    RECT client = rectClient;
    10571057
    1058 ////    mapWin32Rect(getParent() ? getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,OS2HwndFrame,&client);
    10591058        if ((rect.left >= client.left) && (rect.left < client.right) &&
    10601059           (rect.right >= client.left) && (rect.right < client.right) &&
Note: See TracChangeset for help on using the changeset viewer.