Ignore:
Timestamp:
Jul 18, 1999, 4:39:35 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

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

    r325 r328  
    1 /* $Id: pmwindow.cpp,v 1.8 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.9 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    3939  hmq = WinCreateMsgQueue(hab, 0);
    4040
    41   if(!hab || !hmq) 
     41  if(!hab || !hmq)
    4242  {
    4343        UINT error;
     
    4646        if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
    4747        {
    48                 dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
    49                 dprintf((" Error = %x",error));
    50                 return(FALSE);
    51         } 
    52         else
     48            dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
     49            dprintf((" Error = %x",error));
     50            return(FALSE);
     51        }
     52    else
    5353        {
    54                 if(!hab) {
    55                         hab = WinQueryAnchorBlock(HWND_DESKTOP);
    56                         dprintf(("WinQueryAnchorBlock returned %x", hab));
    57                 }
    58                 if(!hmq) {
    59                         hmq = HMQ_CURRENT;
    60                 }
     54        if(!hab) {
     55                hab = WinQueryAnchorBlock(HWND_DESKTOP);
     56            dprintf(("WinQueryAnchorBlock returned %x", hab));
     57        }
     58        if(!hmq) {
     59            hmq = HMQ_CURRENT;
     60        }
    6161        }
    6262  }
     
    6969     (PSZ)WIN32_STDCLASS,               /* Window class name            */
    7070     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
    71      CS_SIZEREDRAW,                     /* Class style                  */
     71     CS_SIZEREDRAW | CS_MOVENOTIFY | CS_HITTEST,
    7272     8)) {
    7373        dprintf(("WinRegisterClass Win32Window failed"));
     
    101101    //internal messages
    102102    case WM_WIN32_POSTMESSAGEA:
    103         postmsg = (POSTMSG_PACKET *)mp1;
    104         if(postmsg == NULL) {
    105                 dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
    106                 break;
    107         }
    108         win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
    109         free(postmsg);
    110         break;
    111 
     103        postmsg = (POSTMSG_PACKET *)mp1;
     104        if(postmsg == NULL) {
     105                dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
     106                break;
     107        }
     108        win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     109        free(postmsg);
     110                break;
     111       
    112112    case WM_WIN32_POSTMESSAGEW:
    113         postmsg = (POSTMSG_PACKET *)mp1;
    114         if(postmsg == NULL) {
    115                 dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
    116                 break;
    117         }
    118         win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
    119         free(postmsg);
    120         break;
     113        postmsg = (POSTMSG_PACKET *)mp1;
     114        if(postmsg == NULL) {
     115                dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
     116                break;
     117        }
     118        win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     119        free(postmsg);
     120        break;
    121121
    122122    //OS/2 msgs
    123123    case WM_CREATE:
    124124        //Processing is done in after WinCreateWindow returns
    125         dprintf(("OS2: WM_CREATE %x", hwnd));
    126         RestoreOS2TIB();
    127         return (MRESULT)FALSE;
     125        dprintf(("OS2: WM_CREATE %x", hwnd));
     126        RestoreOS2TIB();
     127        return (MRESULT)FALSE;
    128128
    129129    case WM_QUIT:
    130         dprintf(("OS2: WM_QUIT %x", hwnd));
     130        dprintf(("OS2: WM_QUIT %x", hwnd));
    131131        if(win32wnd->MsgQuit()) {
    132132                goto RunDefWndProc;
     
    135135
    136136    case WM_CLOSE:
    137         dprintf(("OS2: WM_CLOSE %x", hwnd));
     137        dprintf(("OS2: WM_CLOSE %x", hwnd));
    138138        if(win32wnd->MsgClose()) {
    139139                goto RunDefWndProc;
     
    142142
    143143    case WM_DESTROY:
    144         dprintf(("OS2: WM_DESTROY %x", hwnd));
     144        dprintf(("OS2: WM_DESTROY %x", hwnd));
    145145        if(win32wnd->MsgDestroy()) {
    146146                goto RunDefWndProc;
     
    149149
    150150    case WM_ENABLE:
    151         dprintf(("OS2: WM_ENABLE %x", hwnd));
     151        dprintf(("OS2: WM_ENABLE %x", hwnd));
    152152        if(win32wnd->MsgEnable((ULONG)mp1)) {
    153153                goto RunDefWndProc;
     
    156156
    157157    case WM_SHOW:
    158         dprintf(("OS2: WM_SHOW %x", hwnd));
     158        dprintf(("OS2: WM_SHOW %x", hwnd));
    159159        if(win32wnd->MsgShow((ULONG)mp1)) {
    160160                goto RunDefWndProc;
     
    165165    {
    166166      RECTLOS2 rectChild;
    167       ULONG xParent, yParent;
    168 
    169         dprintf(("OS2: WM_MOVE %x", hwnd));
    170 
    171         WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
     167      ULONG x, y;
     168
     169        dprintf(("OS2: WM_MOVE %x", hwnd));
     170
     171        WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
    172172
    173173        //Calculate position relative to parent window (real window or desktop)
    174         xParent = rectChild.xLeft;
    175         yParent = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
    176 
    177         if(win32wnd->MsgMove(xParent, yParent)) {
    178                 goto RunDefWndProc;
     174        x = rectChild.xLeft;
     175        y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
     176
     177        if(win32wnd->MsgMove(x, y)) {
     178            goto RunDefWndProc;
    179179        }
    180180        break;
     
    183183    case WM_WINDOWPOSCHANGED:
    184184    {
    185         break;
     185        dprintf(("OS2: WM_WINDOWPOSCHANGED %x", hwnd));
    186186    }
    187187
    188188    case WM_ADJUSTWINDOWPOS:
    189189    {
    190         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
    191 //              if(win32wnd->MsgWindowPosChanging(0, 0)) {
    192                 goto RunDefWndProc;
    193 //      }
     190        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
     191//          if(win32wnd->MsgWindowPosChanging(0, 0)) {
     192                goto RunDefWndProc;
     193//  }
    194194        break;
    195195    }
     
    199199     HPS hps;
    200200
    201         dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
     201        dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
    202202        hps = WinGetPS(hwnd);
    203         if(win32wnd->MsgEraseBackGround((ULONG)hps))
     203        if(!win32wnd->MsgEraseBackGround((ULONG)hps))
    204204        {
    205205                /*
     
    217217     SWP swp;
    218218
    219         dprintf(("OS2: WM_SIZE %x", hwnd));
     219        dprintf(("OS2: WM_SIZE %x", hwnd));
    220220        rc = WinQueryWindowPos(hwnd, &swp);
    221221        if(rc == FALSE) {
     
    236236      HWND hwndActivate = (HWND)mp1;
    237237
    238         dprintf(("OS2: WM_ACTIVATE %x", hwnd));
     238        dprintf(("OS2: WM_ACTIVATE %x", hwnd));
    239239        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    240240                //another (non-win32) application's window
     
    248248    }
    249249    case WM_FOCUSCHANGE:
    250         break;
     250        dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
     251        goto RunDefWndProc;
    251252
    252253    case WM_SETFOCUS:
     
    254255      HWND hwndFocus = (HWND)mp1;
    255256
    256         dprintf(("OS2: WM_SETFOCUS %x", hwnd));
     257        dprintf(("OS2: WM_SETFOCUS %x", hwnd));
    257258        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    258259                //another (non-win32) application's window
     
    273274    //**************************************************************************
    274275    case WM_BUTTON1DOWN:
    275         if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
     276        dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
     277        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    276278                goto RunDefWndProc;
    277279        }
    278280        break;
    279281    case WM_BUTTON1UP:
    280         if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
     282        dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
     283        if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    281284                goto RunDefWndProc;
    282285        }
    283286        break;
    284287    case WM_BUTTON1DBLCLK:
    285         if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
     288        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    286289                goto RunDefWndProc;
    287290        }
    288291        break;
    289292    case WM_BUTTON2DOWN:
    290         if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
     293        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    291294                goto RunDefWndProc;
    292295        }
    293296        break;
    294297    case WM_BUTTON2UP:
    295         if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
     298        if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    296299                goto RunDefWndProc;
    297300        }
    298301        break;
    299302    case WM_BUTTON2DBLCLK:
    300         if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x, (*(POINTS *)&mp1).y)) {
    301                 goto RunDefWndProc;
    302         }
    303         break;
     303        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     304                goto RunDefWndProc;
     305        }
     306        break;
     307    case WM_BUTTON3DOWN:
     308        if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     309                goto RunDefWndProc;
     310        }
     311        break;
     312    case WM_BUTTON3UP:
     313        if(win32wnd->MsgButton(BUTTON_MIDDLEUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     314                goto RunDefWndProc;
     315        }
     316        break;
     317    case WM_BUTTON3DBLCLK:
     318        if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     319                goto RunDefWndProc;
     320        }
     321        break;
     322
    304323    case WM_BUTTON2MOTIONSTART:
    305324    case WM_BUTTON2MOTIONEND:
     
    308327    case WM_BUTTON1MOTIONEND:
    309328    case WM_BUTTON1CLICK:
    310     case WM_BUTTON3DOWN:
    311     case WM_BUTTON3UP:
    312     case WM_BUTTON3DBLCLK:
    313329    case WM_BUTTON3MOTIONSTART:
    314330    case WM_BUTTON3MOTIONEND:
    315331    case WM_BUTTON3CLICK:
    316         break;
     332        goto RunDefWndProc;
    317333
    318334    case WM_MOUSEMOVE:
    319         break;
     335    {
     336                ULONG keystate = 0;
     337                if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
     338                        keystate |= WMMOVE_LBUTTON;
     339                if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
     340                        keystate |= WMMOVE_MBUTTON;
     341                if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
     342                        keystate |= WMMOVE_RBUTTON;
     343                if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
     344                        keystate |= WMMOVE_SHIFT;
     345                if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
     346                        keystate |= WMMOVE_CTRL;
     347                       
     348        if(!win32wnd->MsgMouseMove(keystate, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     349                goto RunDefWndProc;
     350        }
     351        break;
     352    }
    320353
    321354    //**************************************************************************
     
    323356    //**************************************************************************
    324357    case WM_VSCROLL:
    325         break;
    326358    case WM_HSCROLL:
    327         break;
    328359
    329360    case WM_CONTROL:
    330         break;
    331361
    332362    case WM_COMMAND:
    333363    case WM_SYSCOMMAND:
    334         break;
    335364
    336365    case WM_CHAR:
    337         break;
    338366
    339367    case WM_INITMENU:
     
    341369    case WM_MENUEND:
    342370    case WM_NEXTMENU:
    343         break;
    344371
    345372    case WM_TIMER:
    346         break;
    347 
     373        goto RunDefWndProc;
     374               
    348375    case WM_SETWINDOWPARAMS:
    349376    {
    350377      WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
    351378
    352         dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
    353         if(wndParams->fsStatus & WPM_TEXT) {
    354                 if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
    355                         goto RunDefWndProc;
    356                 }
    357         }
    358         goto RunDefWndProc;
     379        dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
     380        if(wndParams->fsStatus & WPM_TEXT) {
     381            if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
     382                    goto RunDefWndProc;
     383            }
     384        }
     385        goto RunDefWndProc;
    359386    }
    360387
    361388    case WM_PAINT:
    362         dprintf(("OS2: WM_PAINT %x", hwnd));
     389        dprintf(("OS2: WM_PAINT %x", hwnd));
    363390        if(win32wnd->MsgPaint(0, 0)) {
    364391                goto RunDefWndProc;
     
    366393        break;
    367394
     395    case WM_HITTEST:
     396        if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     397                goto RunDefWndProc;
     398        }
     399        break;
     400       
    368401    case WM_SYSCOLORCHANGE:
    369402    case WM_SYSVALUECHANGED:
    370         break;
    371 
    372403    case WM_CALCVALIDRECTS:
    373404    case WM_QUERYWINDOWPARAMS:
    374     case WM_HITTEST:
    375405    case WM_SETSELECTION:
    376406    case WM_PPAINT:
     
    391421    case WM_SAVEAPPLICATION:
    392422    case WM_SEMANTICEVENT:
    393         break;
    394423    default:
    395         dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
     424        dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
    396425        RestoreOS2TIB();
    397426        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
Note: See TracChangeset for help on using the changeset viewer.