Ignore:
Timestamp:
Jan 3, 2000, 10:37:17 PM (26 years ago)
Author:
sandervl
Message:

PostThreadMessage bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/oslibmsg.cpp

    r2290 r2312  
    1 /* $Id: oslibmsg.cpp,v 1.6 2000-01-01 14:57:18 cbratschi Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.7 2000-01-03 21:37:17 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    178178            thdb->msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg
    179179            memcpy(&thdb->msg, msg, sizeof(MSG));
    180         }
    181         return (LONG)WinDispatchMsg(thdb->hab, &os2msg);
     180            return (LONG)WinDispatchMsg(thdb->hab, &os2msg);
     181        }
     182        //SvL: TODO; What to do if messages posted by PostThreadMessage are
     183        //     dispatched? Wine doesn't appear to do this.
     184        //     If we call WinDispatchMsg, every window created by the thread
     185        //     receives this message. Does this also happen in NT?
     186        return 0;
    182187  }
    183188  else {//is this allowed?
     
    193198 BOOL rc, eaten;
    194199 THDB *thdb;
     200 QMSG  os2msg;
    195201
    196202  thdb = GetThreadTHDB();
     
    223229        }
    224230        while(rc == FALSE);
     231
     232        return rc;
    225233  }
    226234  else
     
    228236    do {
    229237        eaten = FALSE;
    230         rc = WinGetMsg(thdb->hab, MsgThreadPtr, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE), 0);
    231         if (MsgThreadPtr->msg == WM_TIMER)
    232             eaten = TIMER_HandleTimer (MsgThreadPtr);
     238        rc = WinGetMsg(thdb->hab, &os2msg, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE), 0);
     239        if (os2msg.msg == WM_TIMER)
     240            eaten = TIMER_HandleTimer(&os2msg);
    233241    } while (eaten);
    234242  }
    235   OS2ToWinMsgTranslate((PVOID)thdb, MsgThreadPtr, pMsg, isUnicode, MSG_REMOVE);
     243  if(rc) {
     244        OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE);
     245        memcpy(MsgThreadPtr, &os2msg, sizeof(QMSG));
     246  }
    236247  return rc;
    237248}
     
    393404}
    394405//******************************************************************************
     406BOOL    _System _O32_PostThreadMessage( DWORD, UINT, WPARAM, LPARAM );
     407
     408inline BOOL O32_PostThreadMessage(DWORD a, UINT b, WPARAM c, LPARAM d)
     409{
     410 BOOL yyrc;
     411 USHORT sel = RestoreOS2FS();
     412
     413    yyrc = _O32_PostThreadMessage(a, b, c, d);
     414    SetFS(sel);
     415
     416    return yyrc;
     417}
    395418//******************************************************************************
    396419BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
    397420{
    398  THDB *thdb = GetTHDBFromThreadId(threadid);
     421// THDB *thdb = GetTHDBFromThreadId(threadid);
    399422 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    400423
    401     if(thdb == NULL) {
    402         dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid));
    403         return FALSE;
    404     }
     424//    if(thdb == NULL) {
     425//        dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid));
     426//        return FALSE;
     427//    }
    405428    dprintf(("PostThreadMessageA %x %x %x %x", threadid, msg, wParam, lParam));
    406429    packet->Msg = msg;
    407430    packet->wParam = wParam;
    408431    packet->lParam = lParam;
    409     return WinPostQueueMsg(thdb->hmq, WIN32APP_POSTMSG, (MPARAM)((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (MPARAM)packet);
    410 }
    411 //******************************************************************************
    412 //******************************************************************************
    413 
     432    return _O32_PostThreadMessage(threadid, WIN32APP_POSTMSG-OPEN32_MSGDIFF, ((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (LPARAM)packet);
     433}
     434//******************************************************************************
     435//******************************************************************************
     436
Note: See TracChangeset for help on using the changeset viewer.