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

hook, syscolor & message bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.