Changeset 5805 for trunk/src


Ignore:
Timestamp:
May 25, 2001, 9:59:30 PM (24 years ago)
Author:
sandervl
Message:

Post(Thread)/SendMessage updates & fixes

Location:
trunk/src/user32
Files:
5 edited

Legend:

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

    r5606 r5805  
    1 /* $Id: oslibmsg.cpp,v 1.37 2001-04-27 17:36:37 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.38 2001-05-25 19:59:29 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    128128
    129129    if(msg >= WINWM_USER)
    130         return WIN32APP_POSTMSG;
     130        return msg + WIN32APP_POSTMSG;
    131131
    132132    for(int i=0;i<MAX_MSGTRANSTAB;i++)
     
    143143    }
    144144
    145     //not found, probaby WIN32APP_POSTMSG
    146     return WIN32APP_POSTMSG;
     145    //not found, get everything
     146    dprintf(("WARNING: TranslateWinMsg: message %x not found", msg));
     147    return 0;
    147148}
    148149//******************************************************************************
     
    351352
    352353  if(rc == FALSE) {
    353     return FALSE;
     354      return FALSE;
    354355  }
    355356
     
    358359     //unused PM message; dispatch immediately and grab next one
    359360     dprintf2(("OSLibWinPeekMsg: Untranslated message; dispatched immediately"));
    360      rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),
    361                      TranslateWinMsg(uMsgFilterMax, FALSE), PM_REMOVE);
     361     if(!(fRemove & PM_REMOVE_W)) {
     362         rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),
     363                         TranslateWinMsg(uMsgFilterMax, FALSE), PM_REMOVE);
     364     }
    362365     WinDispatchMsg(teb->o.odin.hab, &os2msg);
    363366     return OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax,
     
    454457 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    455458
    456     packet->Msg    = msg;
    457     packet->wParam = wParam;
    458     packet->lParam = lParam;
    459 
    460     return (ULONG)WinSendMsg(hwnd, WIN32APP_POSTMSG, (MPARAM)((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (MPARAM)packet);
     459    packet->wParam   = wParam;
     460    packet->lParam   = lParam;
     461
     462    return (ULONG)WinSendMsg(hwnd, WIN32APP_POSTMSG+msg, (MPARAM)((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (MPARAM)packet);
    461463}
    462464//******************************************************************************
     
    464466ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend)
    465467{
    466     return WinBroadcastMsg(HWND_DESKTOP, msg, (MPARAM)wParam, (MPARAM)lParam,
     468    return WinBroadcastMsg(HWND_DESKTOP, WIN32APP_POSTMSG+msg, (MPARAM)wParam, (MPARAM)lParam,
    467469                           (fSend) ? BMSG_SEND : BMSG_POST);
    468470}
     
    473475 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    474476
    475     packet->Msg = msg;
    476     packet->wParam = wParam;
    477     packet->lParam = lParam;
    478     return WinPostMsg(hwnd, WIN32APP_POSTMSG, (MPARAM)((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (MPARAM)packet);
     477    packet->wParam   = wParam;
     478    packet->lParam   = lParam;
     479    return WinPostMsg(hwnd, WIN32APP_POSTMSG+msg, (MPARAM)((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (MPARAM)packet);
    479480}
    480481//******************************************************************************
     
    509510//    }
    510511    dprintf(("PostThreadMessageA %x %x %x %x", threadid, msg, wParam, lParam));
    511     packet->Msg = msg;
    512     packet->wParam = wParam;
    513     packet->lParam = lParam;
    514     return O32_PostThreadMessage(threadid, WIN32APP_POSTMSG-OPEN32_MSGDIFF, ((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (LPARAM)packet);
    515 }
    516 //******************************************************************************
    517 //******************************************************************************
    518 
     512    packet->wParam   = wParam;
     513    packet->lParam   = lParam;
     514    return O32_PostThreadMessage(threadid, WIN32APP_POSTMSG-OPEN32_MSGDIFF+msg, ((fUnicode) ? WIN32MSG_MAGICW : WIN32MSG_MAGICA), (LPARAM)packet);
     515}
     516//******************************************************************************
     517//******************************************************************************
     518
  • trunk/src/user32/oslibmsgtranslate.cpp

    r5713 r5805  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.51 2001-05-15 14:31:38 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.52 2001-05-25 19:59:29 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    206206    //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle
    207207    //Realplayer starts a timer with hwnd 0 & proc 0; check this here
    208     if(win32wnd == 0 && (os2Msg->msg != WM_CREATE && os2Msg->msg != WM_QUIT && os2Msg->msg != WM_TIMER && os2Msg->msg != WIN32APP_POSTMSG))
     208    if(win32wnd == 0 && (os2Msg->msg != WM_CREATE && os2Msg->msg != WM_QUIT && os2Msg->msg != WM_TIMER && os2Msg->msg < WIN32APP_POSTMSG))
    209209    {
    210210        goto dummymessage; //not a win32 client window
     
    218218        winMsg->hwnd = win32wnd->getWindowHandle();
    219219
    220     switch(os2Msg->msg)
    221     {
    222     case WIN32APP_POSTMSG:
    223     {
     220    if(os2Msg->msg >= WIN32APP_POSTMSG) {
    224221        packet = (POSTMSG_PACKET *)os2Msg->mp2;
    225222        if(packet && ((ULONG)os2Msg->mp1 == WIN32MSG_MAGICA || (ULONG)os2Msg->mp1 == WIN32MSG_MAGICW)) {
    226             winMsg->message = packet->Msg;
     223            winMsg->message = os2Msg->msg - WIN32APP_POSTMSG;
    227224            winMsg->wParam  = packet->wParam;
    228225            winMsg->lParam  = packet->lParam;
    229226            if(fMsgRemoved == MSG_REMOVE) free(packet); //free the shared memory here
    230             break;
     227            return TRUE;
     228        }
     229        else {//broadcasted message (no packet present)
     230            winMsg->message = os2Msg->msg - WIN32APP_POSTMSG;
     231            winMsg->wParam  = (UINT)os2Msg->mp1;
     232            winMsg->lParam  = (DWORD)os2Msg->mp2;
     233            return TRUE;
    231234        }
    232235        goto dummymessage;
    233236    }
    234237
     238    switch(os2Msg->msg)
     239    {
    235240    //OS/2 msgs
    236241    case WM_CREATE:
  • trunk/src/user32/pmwindow.cpp

    r5777 r5805  
    1 /* $Id: pmwindow.cpp,v 1.131 2001-05-22 09:33:12 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.132 2001-05-25 19:59:29 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    167167    win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    168168
     169////    dprintf(("window %x msg %x", (win32wnd) ? win32wnd->getWindowHandle() : 0, msg));
     170
    169171    if(!teb || (msg != WM_CREATE && win32wnd == NULL)) {
    170172        dprintf(("OS2: Invalid win32wnd pointer for window %x msg %x", hwnd, msg));
     
    199201    //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END
    200202
    201     if(msg == WIN32APP_POSTMSG) {
     203    if(msg >= WIN32APP_POSTMSG) {
    202204        //probably win32 app user message
     205        dprintf2(("Posted message %x->%x", msg, msg-WIN32APP_POSTMSG));
    203206        if((ULONG)mp1 == WIN32MSG_MAGICA) {
    204207            rc = (MRESULT)win32wnd->DispatchMsgA(pWinMsg);
     
    207210        if((ULONG)mp1 == WIN32MSG_MAGICW) {
    208211            rc = (MRESULT)win32wnd->DispatchMsgW(pWinMsg);
     212        }
     213        else {//broadcasted message
     214            rc = (MRESULT)win32wnd->DispatchMsgA(pWinMsg);
    209215        }
    210216        RestoreOS2TIB();
  • trunk/src/user32/win32wbase.h

    r5685 r5805  
    1 /* $Id: win32wbase.h,v 1.116 2001-05-11 08:39:45 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.117 2001-05-25 19:59:30 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    5555//PM doesn't allow SetFocus during WM_SETFOCUS message processing; must delay
    5656//this by posting a message
    57 #define WIN32APP_SETFOCUSMSG      (0x1001+OPEN32_MSGDIFF)
     57//NOTE Must be smaller than WIN32APP_POSTMSG!
     58#define WIN32APP_SETFOCUSMSG      (WIN32APP_POSTMSG-1)
    5859
    5960#define WIN32MSG_MAGICA           0x12345678
     
    6263typedef struct
    6364{
    64         ULONG           Msg;
    6565        ULONG           wParam;
    6666        ULONG           lParam;
  • trunk/src/user32/windowmsg.cpp

    r5606 r5805  
    1 /* $Id: windowmsg.cpp,v 1.24 2001-04-27 17:36:39 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.25 2001-05-25 19:59:30 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    8585 BOOL fFoundMsg;
    8686 
    87     dprintf2(("PeekMessagA %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg));
     87    dprintf2(("PeekMessageA %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg));
    8888    fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax,
    8989                                fuRemoveMsg, FALSE);
    9090    if(fFoundMsg) {
    91         dprintf2(("PeekMessagA %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam));
     91        dprintf2(("PeekMessageA %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam));
    9292        HOOK_CallHooksA(WH_GETMESSAGE, HC_ACTION, fuRemoveMsg & PM_REMOVE, (LPARAM)msg );
    9393        if (msg->message == WM_QUIT && (fuRemoveMsg & PM_REMOVE)) {
     
    104104 BOOL fFoundMsg;
    105105
    106     dprintf2(("PeekMessagW %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg));
     106    dprintf2(("PeekMessageW %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg));
    107107    fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax,
    108108                                fuRemoveMsg, FALSE);
    109109    if(fFoundMsg) {
    110         dprintf2(("PeekMessagW %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam));
     110        dprintf2(("PeekMessageW %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam));
    111111        HOOK_CallHooksW(WH_GETMESSAGE, HC_ACTION, fuRemoveMsg & PM_REMOVE, (LPARAM)msg );
    112112        if (msg->message == WM_QUIT && (fuRemoveMsg & (PM_REMOVE))) {
     
    10511051/* Synchronization Functions */
    10521052//******************************************************************************
    1053 DWORD MsgWaitForMultipleObjects(DWORD nCount, LPHANDLE pHandles, BOOL fWaitAll,
    1054                                 DWORD dwMilliseconds, DWORD dwWakeMask)
    1055 {
    1056  DWORD curtime, endtime;
     1053DWORD WIN32API MsgWaitForMultipleObjects(DWORD nCount, LPHANDLE pHandles, BOOL fWaitAll,
     1054                                         DWORD dwMilliseconds, DWORD dwWakeMask)
     1055{
     1056 DWORD curtime, endtime, ret;
    10571057 MSG msg;
    10581058
     
    10971097  }
    10981098  //SvL: Call handlemanager function as we need to translate handles
    1099   return HMMsgWaitForMultipleObjects(nCount,pHandles,fWaitAll,dwMilliseconds,dwWakeMask);
    1100 }
     1099  //TODO: doesn't work at all if waiting for message
     1100  ret = HMMsgWaitForMultipleObjects(nCount,pHandles,fWaitAll,dwMilliseconds,dwWakeMask);
     1101  return ret;
     1102}
Note: See TracChangeset for help on using the changeset viewer.