Changeset 650 for trunk/src


Ignore:
Timestamp:
Aug 23, 1999, 5:34:47 PM (26 years ago)
Author:
dengert
Message:

WM_ERASEBKGND sent from BeginPaint now

Location:
trunk/src/user32/new
Files:
5 edited

Legend:

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

    r614 r650  
    1 /* $Id: pmwindow.cpp,v 1.19 1999-08-22 08:30:52 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.20 1999-08-23 15:34:46 dengert Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    1313#define INCL_GPI
    1414
    15 #include <os2.h>                        /* PM header file               */
     15#include <os2.h>                        /* PM header file               */
    1616#include <os2wrap.h>
    1717#include <stdlib.h>
     
    2727#include "oslibmsg.h"
    2828
    29 HMQ  hmq = 0;                             /* Message queue handle         */
     29HMQ  hmq = 0;                             /* Message queue handle         */
    3030HAB  hab = 0;
    3131
     
    4545  if(!hab || !hmq)
    4646  {
    47         UINT error;
    48         //CB: only fail on real error
    49         error = WinGetLastError(hab) & 0xFFFF; //error code
    50         if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
    51         {
    52             dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
    53             dprintf((" Error = %x",error));
    54             return(FALSE);
    55         }
     47        UINT error;
     48        //CB: only fail on real error
     49        error = WinGetLastError(hab) & 0xFFFF; //error code
     50        if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
     51        {
     52            dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
     53            dprintf((" Error = %x",error));
     54            return(FALSE);
     55        }
    5656    else
    57         {
    58         if(!hab) {
    59                 hab = WinQueryAnchorBlock(HWND_DESKTOP);
    60             dprintf(("WinQueryAnchorBlock returned %x", hab));
    61         }
    62         if(!hmq) {
    63             hmq = HMQ_CURRENT;
    64         }
    65         }
     57        {
     58        if(!hab) {
     59                hab = WinQueryAnchorBlock(HWND_DESKTOP);
     60            dprintf(("WinQueryAnchorBlock returned %x", hab));
     61        }
     62        if(!hmq) {
     63            hmq = HMQ_CURRENT;
     64        }
     65        }
    6666  }
    6767  SetThreadHAB(hab);
     
    6969  SetThreadMessageQueue(hmq);
    7070
    71   if(!WinRegisterClass(                 /* Register window class        */
    72      hab,                               /* Anchor block handle          */
    73      (PSZ)WIN32_STDCLASS,               /* Window class name            */
    74      (PFNWP)Win32WindowProc,            /* Address of window procedure  */
     71  if(!WinRegisterClass(                 /* Register window class        */
     72     hab,                               /* Anchor block handle          */
     73     (PSZ)WIN32_STDCLASS,               /* Window class name            */
     74     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
    7575     CS_SIZEREDRAW | CS_HITTEST,
    7676     8)) {
    77         dprintf(("WinRegisterClass Win32Window failed"));
    78         return(FALSE);
     77        dprintf(("WinRegisterClass Win32Window failed"));
     78        return(FALSE);
    7979   }
    8080
     
    8989{
    9090 POSTMSG_PACKET *postmsg;
    91  OSLIBPOINT      point, ClientPoint;
    92  Win32Window    *win32wnd;
    93  APIRET         rc;
     91 OSLIBPOINT      point, ClientPoint;
     92 Win32Window    *win32wnd;
     93 APIRET         rc;
    9494
    9595  //Restore our FS selector
     
    9999
    100100  if(msg != WM_CREATE && win32wnd == NULL) {
    101         dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
    102         goto RunDefWndProc;
     101        dprintf(("Invalid win32wnd pointer for window %x!!", hwnd));
     102        goto RunDefWndProc;
    103103  }
    104104  switch( msg )
     
    106106    //internal messages
    107107    case WM_WIN32_POSTMESSAGEA:
    108         postmsg = (POSTMSG_PACKET *)mp1;
    109         if(postmsg == NULL) {
    110             dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
    111             break;
    112         }
    113         win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
    114         free(postmsg);
    115         break;
     108        postmsg = (POSTMSG_PACKET *)mp1;
     109        if(postmsg == NULL) {
     110            dprintf(("WM_WIN32_POSTMESSAGEA, postmsg NULL!!"));
     111            break;
     112        }
     113        win32wnd->SendMessageA(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     114        free(postmsg);
     115        break;
    116116
    117117    case WM_WIN32_POSTMESSAGEW:
    118         postmsg = (POSTMSG_PACKET *)mp1;
    119         if(postmsg == NULL) {
    120             dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
    121             break;
    122         }
    123         win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
    124         free(postmsg);
    125         break;
     118        postmsg = (POSTMSG_PACKET *)mp1;
     119        if(postmsg == NULL) {
     120            dprintf(("WM_WIN32_POSTMESSAGEW, postmsg NULL!!"));
     121            break;
     122        }
     123        win32wnd->SendMessageW(postmsg->Msg, postmsg->wParam, postmsg->lParam);
     124        free(postmsg);
     125        break;
    126126
    127127    //OS/2 msgs
    128128    case WM_CREATE:
    129         //Processing is done in after WinCreateWindow returns
    130         dprintf(("OS2: WM_CREATE %x", hwnd));
    131         RestoreOS2TIB();
    132         return (MRESULT)FALSE;
     129        //Processing is done in after WinCreateWindow returns
     130        dprintf(("OS2: WM_CREATE %x", hwnd));
     131        RestoreOS2TIB();
     132        return (MRESULT)FALSE;
    133133
    134134    case WM_QUIT:
    135         dprintf(("OS2: WM_QUIT %x", hwnd));
    136         if(win32wnd->MsgQuit()) {
    137                 goto RunDefWndProc;
    138         }
    139         break;
     135        dprintf(("OS2: WM_QUIT %x", hwnd));
     136        if(win32wnd->MsgQuit()) {
     137                goto RunDefWndProc;
     138        }
     139        break;
    140140
    141141    case WM_CLOSE:
    142         dprintf(("OS2: WM_CLOSE %x", hwnd));
    143         if(win32wnd->MsgClose()) {
    144                 goto RunDefWndProc;
    145         }
    146         break;
     142        dprintf(("OS2: WM_CLOSE %x", hwnd));
     143        if(win32wnd->MsgClose()) {
     144                goto RunDefWndProc;
     145        }
     146        break;
    147147
    148148    case WM_DESTROY:
    149         dprintf(("OS2: WM_DESTROY %x", hwnd));
    150         if(win32wnd->MsgDestroy()) {
    151                 goto RunDefWndProc;
    152         }
    153         break;
     149        dprintf(("OS2: WM_DESTROY %x", hwnd));
     150        if(win32wnd->MsgDestroy()) {
     151                goto RunDefWndProc;
     152        }
     153        break;
    154154
    155155    case WM_ENABLE:
    156         dprintf(("OS2: WM_ENABLE %x", hwnd));
    157         if(win32wnd->MsgEnable((ULONG)mp1)) {
    158                 goto RunDefWndProc;
    159         }
    160         break;
     156        dprintf(("OS2: WM_ENABLE %x", hwnd));
     157        if(win32wnd->MsgEnable((ULONG)mp1)) {
     158                goto RunDefWndProc;
     159        }
     160        break;
    161161
    162162    case WM_SHOW:
    163         dprintf(("OS2: WM_SHOW %x", hwnd));
    164         if(win32wnd->MsgShow((ULONG)mp1)) {
    165                 goto RunDefWndProc;
    166         }
    167         break;
     163        dprintf(("OS2: WM_SHOW %x", hwnd));
     164        if(win32wnd->MsgShow((ULONG)mp1)) {
     165                goto RunDefWndProc;
     166        }
     167        break;
    168168
    169169    case WM_ADJUSTWINDOWPOS:
     
    172172      PSWP     pswp = (PSWP)mp1;
    173173
    174         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
    175 
    176         if(pswp->fl & SWP_MOVE) {
    177             if(win32wnd->isChild()) {
    178                 x = pswp->x;
    179                 y = pswp->cy - y - 1;
    180             }
    181             else {
    182                 OSLIBPOINT point;
    183 
    184                 point.x = pswp->x;
    185                 point.y = pswp->y;
    186 
    187                 MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    188                 x = point.x;
    189                 y = point.y;
    190             }
    191             if(win32wnd->MsgMove(x, y)) {
    192                 goto RunDefWndProc;
    193             }
    194             break;
    195         }
    196         goto RunDefWndProc;
     174        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
     175
     176        if(pswp->fl & SWP_MOVE) {
     177            if(win32wnd->isChild()) {
     178                x = pswp->x;
     179                y = pswp->cy - y - 1;
     180            }
     181            else {
     182                OSLIBPOINT point;
     183
     184                point.x = pswp->x;
     185                point.y = pswp->y;
     186
     187                MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     188                x = point.x;
     189                y = point.y;
     190            }
     191            if(win32wnd->MsgMove(x, y)) {
     192                goto RunDefWndProc;
     193            }
     194            break;
     195        }
     196        goto RunDefWndProc;
    197197    }
    198198
     
    201201     PSWP pswp = (PSWP)mp1;
    202202
    203         dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    204         goto RunDefWndProc;
     203        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     204        goto RunDefWndProc;
    205205    }
    206206
    207207    case WM_ERASEBACKGROUND:
    208208    {
    209      HPS hps;
    210 
    211         dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
    212         if(!win32wnd->MsgEraseBackGround())
    213         {
    214                 /*
    215                  * Return TRUE to request PM to paint the window background
    216                  * in SYSCLR_WINDOW.
    217                  */
    218                 return (MRESULT)( TRUE );
    219         }
    220         return (MRESULT) FALSE;
     209        return (MRESULT) FALSE;
    221210    }
    222211    case WM_SIZE:
     
    224213     SWP swp;
    225214
    226         rc = WinQueryWindowPos(hwnd, &swp);
    227         if(rc == FALSE) {
    228                 dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
    229                 break;
    230         }
    231         dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)));
    232         if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
    233                                 (swp.fl & SWP_MINIMIZE) != 0,
    234                                 (swp.fl & SWP_MAXIMIZE) != 0))
    235         {
    236                 goto RunDefWndProc;
    237         }
    238         break;
     215        rc = WinQueryWindowPos(hwnd, &swp);
     216        if(rc == FALSE) {
     217                dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
     218                break;
     219        }
     220        dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)));
     221        if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
     222                                (swp.fl & SWP_MINIMIZE) != 0,
     223                                (swp.fl & SWP_MAXIMIZE) != 0))
     224        {
     225                goto RunDefWndProc;
     226        }
     227        break;
    239228    }
    240229
     
    243232      HWND hwndActivate = (HWND)mp1;
    244233
    245         dprintf(("OS2: WM_ACTIVATE %x", hwnd));
    246         if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    247                 //another (non-win32) application's window
    248                 //set to NULL (allowed according to win32 SDK) to avoid problems
    249                 hwndActivate = NULL;
    250         }
    251         if(win32wnd->MsgActivate(1, hwndActivate)) {
    252                 goto RunDefWndProc;
    253         }
    254         break;
     234        dprintf(("OS2: WM_ACTIVATE %x", hwnd));
     235        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
     236                //another (non-win32) application's window
     237                //set to NULL (allowed according to win32 SDK) to avoid problems
     238                hwndActivate = NULL;
     239        }
     240        if(win32wnd->MsgActivate(1, hwndActivate)) {
     241                goto RunDefWndProc;
     242        }
     243        break;
    255244    }
    256245    case WM_FOCUSCHANGE:
    257         dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
    258         goto RunDefWndProc;
     246        dprintf(("OS2: WM_FOCUSCHANGE %x", hwnd));
     247        goto RunDefWndProc;
    259248
    260249    case WM_SETFOCUS:
     
    262251      HWND hwndFocus = (HWND)mp1;
    263252
    264         dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
    265         if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    266                 //another (non-win32) application's window
    267                 //set to NULL (allowed according to win32 SDK) to avoid problems
    268                 hwndFocus = NULL;
    269         }
    270         if((ULONG)mp2 == TRUE) {
    271                 rc = win32wnd->MsgSetFocus(hwndFocus);
    272         }
    273         else    rc = win32wnd->MsgKillFocus(hwndFocus);
    274         if(rc) {
    275                 goto RunDefWndProc;
    276         }
    277         break;
     253        dprintf(("OS2: WM_SETFOCUS %x %d", hwnd, mp2));
     254        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
     255                //another (non-win32) application's window
     256                //set to NULL (allowed according to win32 SDK) to avoid problems
     257                hwndFocus = NULL;
     258        }
     259        if((ULONG)mp2 == TRUE) {
     260                rc = win32wnd->MsgSetFocus(hwndFocus);
     261        }
     262        else    rc = win32wnd->MsgKillFocus(hwndFocus);
     263        if(rc) {
     264                goto RunDefWndProc;
     265        }
     266        break;
    278267    }
    279268    //**************************************************************************
     
    281270    //**************************************************************************
    282271    case WM_BUTTON1DOWN:
    283         dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
    284         point.x = (*(POINTS *)&mp1).x;
    285         point.y = (*(POINTS *)&mp1).y;
    286         ClientPoint.x = point.x;
    287         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    288         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    289         if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    290                 goto RunDefWndProc;
    291         }
    292         break;
     272        dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
     273        point.x = (*(POINTS *)&mp1).x;
     274        point.y = (*(POINTS *)&mp1).y;
     275        ClientPoint.x = point.x;
     276        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     277        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     278        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     279                goto RunDefWndProc;
     280        }
     281        break;
    293282
    294283    case WM_BUTTON1UP:
    295         dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
    296         point.x = (*(POINTS *)&mp1).x;
    297         point.y = (*(POINTS *)&mp1).y;
    298         ClientPoint.x = point.x;
    299         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    300         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    301         if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    302                 goto RunDefWndProc;
    303         }
    304         break;
     284        dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
     285        point.x = (*(POINTS *)&mp1).x;
     286        point.y = (*(POINTS *)&mp1).y;
     287        ClientPoint.x = point.x;
     288        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     289        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     290        if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     291                goto RunDefWndProc;
     292        }
     293        break;
    305294    case WM_BUTTON1DBLCLK:
    306         point.x = (*(POINTS *)&mp1).x;
    307         point.y = (*(POINTS *)&mp1).y;
    308         ClientPoint.x = point.x;
    309         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    310         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    311         if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    312                 goto RunDefWndProc;
    313         }
    314         break;
     295        point.x = (*(POINTS *)&mp1).x;
     296        point.y = (*(POINTS *)&mp1).y;
     297        ClientPoint.x = point.x;
     298        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     299        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     300        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     301                goto RunDefWndProc;
     302        }
     303        break;
    315304    case WM_BUTTON2DOWN:
    316         point.x = (*(POINTS *)&mp1).x;
    317         point.y = (*(POINTS *)&mp1).y;
    318         ClientPoint.x = point.x;
    319         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    320         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    321         if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    322                 goto RunDefWndProc;
    323         }
    324         break;
     305        point.x = (*(POINTS *)&mp1).x;
     306        point.y = (*(POINTS *)&mp1).y;
     307        ClientPoint.x = point.x;
     308        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     309        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     310        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     311                goto RunDefWndProc;
     312        }
     313        break;
    325314    case WM_BUTTON2UP:
    326         point.x = (*(POINTS *)&mp1).x;
    327         point.y = (*(POINTS *)&mp1).y;
    328         ClientPoint.x = point.x;
    329         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    330         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    331         if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    332                 goto RunDefWndProc;
    333         }
    334         break;
     315        point.x = (*(POINTS *)&mp1).x;
     316        point.y = (*(POINTS *)&mp1).y;
     317        ClientPoint.x = point.x;
     318        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     319        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     320        if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     321                goto RunDefWndProc;
     322        }
     323        break;
    335324    case WM_BUTTON2DBLCLK:
    336         point.x = (*(POINTS *)&mp1).x;
    337         point.y = (*(POINTS *)&mp1).y;
    338         ClientPoint.x = point.x;
    339         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    340         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    341         if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    342                 goto RunDefWndProc;
    343         }
    344         break;
     325        point.x = (*(POINTS *)&mp1).x;
     326        point.y = (*(POINTS *)&mp1).y;
     327        ClientPoint.x = point.x;
     328        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     329        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     330        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     331                goto RunDefWndProc;
     332        }
     333        break;
    345334    case WM_BUTTON3DOWN:
    346         point.x = (*(POINTS *)&mp1).x;
    347         point.y = (*(POINTS *)&mp1).y;
    348         ClientPoint.x = point.x;
    349         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    350         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    351         if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    352                 goto RunDefWndProc;
    353         }
    354         break;
     335        point.x = (*(POINTS *)&mp1).x;
     336        point.y = (*(POINTS *)&mp1).y;
     337        ClientPoint.x = point.x;
     338        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     339        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     340        if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     341                goto RunDefWndProc;
     342        }
     343        break;
    355344    case WM_BUTTON3UP:
    356         point.x = (*(POINTS *)&mp1).x;
    357         point.y = (*(POINTS *)&mp1).y;
    358         ClientPoint.x = point.x;
    359         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    360         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    361         if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    362                 goto RunDefWndProc;
    363         }
    364         break;
     345        point.x = (*(POINTS *)&mp1).x;
     346        point.y = (*(POINTS *)&mp1).y;
     347        ClientPoint.x = point.x;
     348        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     349        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     350        if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     351                goto RunDefWndProc;
     352        }
     353        break;
    365354    case WM_BUTTON3DBLCLK:
    366         point.x = (*(POINTS *)&mp1).x;
    367         point.y = (*(POINTS *)&mp1).y;
    368         ClientPoint.x = point.x;
    369         ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
    370         MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
    371         if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
    372                 goto RunDefWndProc;
    373         }
    374         break;
     355        point.x = (*(POINTS *)&mp1).x;
     356        point.y = (*(POINTS *)&mp1).y;
     357        ClientPoint.x = point.x;
     358        ClientPoint.y = MapOS2ToWin32Y(hwnd, 1, point.y);
     359        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     360        if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y, ClientPoint.x, ClientPoint.y)) {
     361                goto RunDefWndProc;
     362        }
     363        break;
    375364
    376365    case WM_BUTTON2MOTIONSTART:
     
    383372    case WM_BUTTON3MOTIONEND:
    384373    case WM_BUTTON3CLICK:
    385         goto RunDefWndProc;
     374        goto RunDefWndProc;
    386375
    387376    case WM_MOUSEMOVE:
    388377    {
    389         ULONG keystate = 0;
    390         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
    391             keystate |= WMMOVE_LBUTTON;
    392         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
    393             keystate |= WMMOVE_MBUTTON;
    394         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
    395             keystate |= WMMOVE_RBUTTON;
    396         if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
    397             keystate |= WMMOVE_SHIFT;
    398         if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
    399             keystate |= WMMOVE_CTRL;
    400 
    401         //OS/2 Window coordinates -> Win32 Window coordinates
    402         //TODO: What do windows apps that handle this messages return?
    403         if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
    404                 goto RunDefWndProc;
    405         }
    406         break;
     378        ULONG keystate = 0;
     379        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1))
     380            keystate |= WMMOVE_LBUTTON;
     381        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
     382            keystate |= WMMOVE_MBUTTON;
     383        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3))
     384            keystate |= WMMOVE_RBUTTON;
     385        if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT))
     386            keystate |= WMMOVE_SHIFT;
     387        if(WinGetKeyState(HWND_DESKTOP, VK_CTRL))
     388            keystate |= WMMOVE_CTRL;
     389
     390        //OS/2 Window coordinates -> Win32 Window coordinates
     391        //TODO: What do windows apps that handle this messages return?
     392        if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
     393                goto RunDefWndProc;
     394        }
     395        break;
    407396    }
    408397
     
    416405
    417406    case WM_COMMAND:
    418         if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
    419             win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
    420         }
    421         if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
    422             win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
    423         }
    424         //todo controls + accelerators
    425         break;
     407        if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
     408            win32wnd->MsgCommand(CMD_MENU, SHORT1FROMMP(mp1), 0);
     409        }
     410        if(SHORT1FROMMP(mp2) == CMDSRC_ACCELERATOR) {
     411            win32wnd->MsgCommand(CMD_ACCELERATOR, SHORT1FROMMP(mp1), 0);
     412        }
     413        //todo controls + accelerators
     414        break;
    426415
    427416    case WM_SYSCOMMAND:
     
    430419      ULONG win32sc;
    431420
    432         if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
    433             POINTL pointl;
    434             WinQueryPointerPos(HWND_DESKTOP, &pointl);
    435             x = pointl.x;
    436             y = desktopRectl.yTop - y;
    437         }
    438         switch(SHORT1FROMMP(mp1)) {
    439         case SC_MOVE:
    440             win32sc = WIN32SC_MOVE;
    441             break;
    442         case SC_CLOSE:
    443             win32sc = WIN32SC_CLOSE;
    444             break;
    445         case SC_MAXIMIZE:
    446             win32sc = WIN32SC_MAXIMIZE;
    447             break;
    448         case SC_MINIMIZE:
    449             win32sc = WIN32SC_MINIMIZE;
    450             break;
    451         case SC_NEXTFRAME:
    452         case SC_NEXTWINDOW:
    453             win32sc = WIN32SC_NEXTWINDOW;
    454             break;
    455         case SC_RESTORE:
    456             win32sc = WIN32SC_RESTORE;
    457             break;
    458         case SC_TASKMANAGER:
    459             win32sc = WIN32SC_TASKLIST;
    460             break;
    461         default:
    462             goto RunDefWndProc;
    463         }
    464         dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
    465         if(win32wnd->MsgSysCommand(win32sc, x, y)) {
    466             goto RunDefWndProc;
    467         }
    468         break;
     421        if(SHORT2FROMMP(mp2) == TRUE) {//syscommand caused by mouse action
     422            POINTL pointl;
     423            WinQueryPointerPos(HWND_DESKTOP, &pointl);
     424            x = pointl.x;
     425            y = desktopRectl.yTop - y;
     426        }
     427        switch(SHORT1FROMMP(mp1)) {
     428        case SC_MOVE:
     429            win32sc = WIN32SC_MOVE;
     430            break;
     431        case SC_CLOSE:
     432            win32sc = WIN32SC_CLOSE;
     433            break;
     434        case SC_MAXIMIZE:
     435            win32sc = WIN32SC_MAXIMIZE;
     436            break;
     437        case SC_MINIMIZE:
     438            win32sc = WIN32SC_MINIMIZE;
     439            break;
     440        case SC_NEXTFRAME:
     441        case SC_NEXTWINDOW:
     442            win32sc = WIN32SC_NEXTWINDOW;
     443            break;
     444        case SC_RESTORE:
     445            win32sc = WIN32SC_RESTORE;
     446            break;
     447        case SC_TASKMANAGER:
     448            win32sc = WIN32SC_TASKLIST;
     449            break;
     450        default:
     451            goto RunDefWndProc;
     452        }
     453        dprintf(("WM_SYSCOMMAND %x %x (%d,%d)", hwnd, win32sc, x, y));
     454        if(win32wnd->MsgSysCommand(win32sc, x, y)) {
     455            goto RunDefWndProc;
     456        }
     457        break;
    469458    }
    470459    case WM_CHAR:
     
    473462     ULONG fl = SHORT1FROMMP(mp1);
    474463
    475         if(!(fl & KC_CHAR)) {
    476             dprintf(("WM_CHAR: no valid character code"));
    477             goto RunDefWndProc;
    478         }
    479         if(fl & KC_VIRTUALKEY) {
    480             vkey = SHORT2FROMMP(mp2);
    481         }
    482         if(fl & KC_KEYUP) {
    483             keyflags |= KEY_UP;
    484         }
    485         if(fl & KC_ALT) {
    486             keyflags |= KEY_ALTDOWN;
    487         }
    488         if(fl & KC_PREVDOWN) {
    489             keyflags |= KEY_PREVDOWN;
    490         }
    491         if(fl & KC_DEADKEY) {
    492             keyflags |= KEY_DEADKEY;
    493         }
    494         if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
    495             goto RunDefWndProc;
    496         }
    497         break;
     464        if(!(fl & KC_CHAR)) {
     465            dprintf(("WM_CHAR: no valid character code"));
     466            goto RunDefWndProc;
     467        }
     468        if(fl & KC_VIRTUALKEY) {
     469            vkey = SHORT2FROMMP(mp2);
     470        }
     471        if(fl & KC_KEYUP) {
     472            keyflags |= KEY_UP;
     473        }
     474        if(fl & KC_ALT) {
     475            keyflags |= KEY_ALTDOWN;
     476        }
     477        if(fl & KC_PREVDOWN) {
     478            keyflags |= KEY_PREVDOWN;
     479        }
     480        if(fl & KC_DEADKEY) {
     481            keyflags |= KEY_DEADKEY;
     482        }
     483        if(win32wnd->MsgChar(SHORT1FROMMP(mp2), CHAR3FROMMP(mp1), CHAR4FROMMP(mp1), vkey, keyflags)) {
     484            goto RunDefWndProc;
     485        }
     486        break;
    498487    }
    499488    case WM_INITMENU:
     
    503492
    504493    case WM_TIMER:
    505         goto RunDefWndProc;
     494        goto RunDefWndProc;
    506495
    507496    case WM_SETWINDOWPARAMS:
     
    509498      WNDPARAMS *wndParams = (WNDPARAMS *)mp1;
    510499
    511         dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
    512         if(wndParams->fsStatus & WPM_TEXT) {
    513             if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
    514                     goto RunDefWndProc;
    515             }
    516         }
    517         goto RunDefWndProc;
     500        dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
     501        if(wndParams->fsStatus & WPM_TEXT) {
     502            if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
     503                    goto RunDefWndProc;
     504            }
     505        }
     506        goto RunDefWndProc;
    518507    }
    519508
     
    524513     PSZ   wintext;
    525514
    526         if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
    527             if(wndpars->fsStatus & WPM_CCHTEXT)
    528                 wndpars->cchText = win32wnd->MsgGetTextLength();
    529             if(wndpars->fsStatus & WPM_TEXT)
    530                 wndpars->pszText = win32wnd->MsgGetText();
    531             return (MRESULT)TRUE;
    532         }
    533         goto RunDefWndProc;
     515        if(wndpars->fsStatus & (WPM_CCHTEXT | WPM_TEXT)) {
     516            if(wndpars->fsStatus & WPM_CCHTEXT)
     517                wndpars->cchText = win32wnd->MsgGetTextLength();
     518            if(wndpars->fsStatus & WPM_TEXT)
     519                wndpars->pszText = win32wnd->MsgGetText();
     520            return (MRESULT)TRUE;
     521        }
     522        goto RunDefWndProc;
    534523    }
    535524
    536525    case WM_PAINT:
    537         dprintf(("OS2: WM_PAINT %x", hwnd));
    538         if(win32wnd->MsgPaint(0, 0)) {
    539                 goto RunDefWndProc;
    540         }
    541         break;
     526        dprintf(("OS2: WM_PAINT %x", hwnd));
     527        if(win32wnd->MsgPaint(0, 0)) {
     528                goto RunDefWndProc;
     529        }
     530        break;
    542531
    543532    case WM_HITTEST:
    544         if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
    545                 goto RunDefWndProc;
    546         }
    547         break;
     533        if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
     534                goto RunDefWndProc;
     535        }
     536        break;
    548537
    549538    case WM_SYSCOLORCHANGE:
     
    569558    case WM_SEMANTICEVENT:
    570559    default:
    571 //        dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
    572         RestoreOS2TIB();
    573         return WinDefWindowProc( hwnd, msg, mp1, mp2 );
     560//        dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
     561        RestoreOS2TIB();
     562        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
    574563  }
    575564  RestoreOS2TIB();
  • trunk/src/user32/new/spy.cpp

    r374 r650  
    1 /* $Id: spy.cpp,v 1.2 1999-07-23 17:52:16 sandervl Exp $ */
     1/* $Id: spy.cpp,v 1.3 1999-08-23 15:34:46 dengert Exp $ */
    22
    33/*
     
    2626
    2727
    28 #define  Q_BUFFER_SIZE  4096
    29 #define  MAX_MESSAGES   (Q_BUFFER_SIZE/sizeof(Q_SPYMSG))
     28#define  Q_BUFFER_SIZE  4096
     29#define  MAX_MESSAGES   (Q_BUFFER_SIZE/sizeof(Q_SPYMSG))
    3030
    31 PID       pidServer  = 0;
    32 HQUEUE    hqQueue    = 0;
     31PID       pidServer  = 0;
     32HQUEUE    hqQueue    = 0;
    3333Q_SPYMSG *pvdQMemory = 0;
    34 int       msgIndex   = 0;
     34int       msgIndex   = 0;
    3535
    3636BOOL InitSpyQueue()
     
    3838 APIRET rc;
    3939
    40    if (rc = DosOpenQueue(&pidServer, &hqQueue, "\\queues\\"Q_NAME))
     40   if ((rc = DosOpenQueue(&pidServer, &hqQueue, "\\queues\\"Q_NAME)) != 0)
    4141   {
    4242        dprintf(("InitSpyQueue: couldn't open spy queue rc=%d!", rc));
    4343        return FALSE;
    4444   }
    45    if (rc = DosAllocSharedMem((VOID **)&pvdQMemory,
    46                         NULL,
    47                         Q_BUFFER_SIZE,
    48                          fALLOCSHR))
     45   if ((rc = DosAllocSharedMem((VOID **)&pvdQMemory,
     46                        NULL,
     47                        Q_BUFFER_SIZE,
     48                         fALLOCSHR)) != 0)
    4949   {
    5050        dprintf(("InitSpyQueue: DosAllocSharedMem failed rc=%d", rc));
     
    7070   if(hqQueue) {
    7171        if(pvdQMemory) {
    72                 rc = DosWriteQueue(hqQueue, Q_SPYMSG_KILLSERVER, 0, 0, 0);
     72                rc = DosWriteQueue(hqQueue, Q_SPYMSG_KILLSERVER, 0, 0, 0);
    7373                if(rc) {
    7474                        dprintf(("CloseSpyQueue: DosWriteQueue returned %d", rc));
    7575                }
    7676        }
    77         DosCloseQueue(hqQueue);
     77        DosCloseQueue(hqQueue);
    7878   }
    7979   if(pvdQMemory)
    80         DosFreeMem(pvdQMemory);
     80        DosFreeMem(pvdQMemory);
    8181}
    8282
     
    8888   if (hqQueue == 0)
    8989        return FALSE;
    90    
     90
    9191   pvdQMemory[msgIndex].hwnd   = hwnd;
    9292   pvdQMemory[msgIndex].Msg    = Msg;
     
    9494   pvdQMemory[msgIndex].lParam = lParam;
    9595
    96    if (rc = DosWriteQueue(hqQueue,
    97                      Q_SPYMSG_WNDMSG,
    98                      sizeof(Q_SPYMSG),
    99                      &pvdQMemory[msgIndex],
    100                      0))
     96   if ((rc = DosWriteQueue(hqQueue,
     97                     Q_SPYMSG_WNDMSG,
     98                     sizeof(Q_SPYMSG),
     99                     &pvdQMemory[msgIndex],
     100                     0)) != 0)
    101101   {
    102102        hqQueue = 0; //give up, server probably died
     
    104104        return FALSE;
    105105   }
    106    if(++msgIndex >= MAX_MESSAGES) 
     106   if(++msgIndex >= MAX_MESSAGES)
    107107   {
    108108        msgIndex = 0;
  • trunk/src/user32/new/win32wnd.cpp

    r628 r650  
    1 /* $Id: win32wnd.cpp,v 1.28 1999-08-22 18:29:38 dengert Exp $ */
     1/* $Id: win32wnd.cpp,v 1.29 1999-08-23 15:34:47 dengert Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    927927//      (or are we simply erasing too much here)
    928928//******************************************************************************
    929 ULONG Win32Window::MsgEraseBackGround()
     929ULONG Win32Window::MsgEraseBackGround(HDC hdc)
    930930{
    931931    if(isIcon) {
    932             return SendInternalMessageA(WM_ICONERASEBKGND, GetDC(getWindowHandle()), 0);
    933     }
    934     else    return SendInternalMessageA(WM_ERASEBKGND, GetDC(getWindowHandle()), 0);
     932            return SendInternalMessageA(WM_ICONERASEBKGND, hdc, 0);
     933    }
     934    else    return SendInternalMessageA(WM_ERASEBKGND, hdc, 0);
    935935}
    936936//******************************************************************************
  • trunk/src/user32/new/win32wnd.h

    r614 r650  
    1 /* $Id: win32wnd.h,v 1.23 1999-08-22 08:30:53 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.24 1999-08-23 15:34:47 dengert Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    2323class Win32Window;
    2424
    25 #define OFFSET_WIN32WNDPTR      0
    26 #define OFFSET_WIN32PM_MAGIC    4
    27 
    28 #define WIN32PM_MAGIC           0x12345678
    29 #define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
     25#define OFFSET_WIN32WNDPTR      0
     26#define OFFSET_WIN32PM_MAGIC    4
     27
     28#define WIN32PM_MAGIC           0x12345678
     29#define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
    3030
    3131typedef struct {
    32         USHORT          cb;
    33         Win32Window    *win32wnd;
    34         ULONG           win32CreateStruct;      //or dialog create dword
     32        USHORT          cb;
     33        Win32Window    *win32wnd;
     34        ULONG           win32CreateStruct;      //or dialog create dword
    3535} CUSTOMWNDDATA;
    3636
    3737typedef struct
    3838{
    39         ULONG           Msg;
    40         ULONG           wParam;
    41         ULONG           lParam;
     39        ULONG           Msg;
     40        ULONG           wParam;
     41        ULONG           lParam;
    4242} POSTMSG_PACKET;
    4343
    44 #define WM_WIN32_POSTMESSAGEA   0x4000
    45 #define WM_WIN32_POSTMESSAGEW   0x4001
    46 
    47 #define MAX_WINDOW_NAMELENGTH   256
     44#define WM_WIN32_POSTMESSAGEA   0x4000
     45#define WM_WIN32_POSTMESSAGEW   0x4001
     46
     47#define MAX_WINDOW_NAMELENGTH   256
    4848
    4949class Win32Window : private GenericObject, private ChildWindow
    5050{
    5151public:
    52         DWORD   magic;
    53 
    54                 Win32Window(DWORD objType);
    55                 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
     52        DWORD   magic;
     53
     54                Win32Window(DWORD objType);
     55                Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    5656virtual        ~Win32Window();
    5757
    58 virtual  ULONG  MsgCreate(HWND hwndOS2, ULONG initParam);
    59          ULONG  MsgQuit();
    60          ULONG  MsgClose();
    61          ULONG  MsgDestroy();
    62          ULONG  MsgEnable(BOOL fEnable);
    63          ULONG  MsgShow(BOOL fShow);
    64          ULONG  MsgMove(ULONG x, ULONG y);
    65          ULONG  MsgHitTest(ULONG x, ULONG y);
    66          ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
    67          ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
    68          ULONG  MsgSetFocus(HWND hwnd);
    69          ULONG  MsgKillFocus(HWND hwnd);
    70          ULONG  MsgCommand(ULONG cmd, ULONG Id, HWND hwnd);
    71          ULONG  MsgSysCommand(ULONG win32sc, ULONG x, ULONG y);
    72          ULONG  MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags);
    73          ULONG  MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly);
    74          ULONG  MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
    75          ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
    76          ULONG  MsgEraseBackGround();
    77          ULONG  MsgSetText(LPSTR lpsz, LONG cch);
    78          ULONG  MsgGetTextLength();
    79         char  *MsgGetText();
    80 
    81 virtual  LONG   SetWindowLongA(int index, ULONG value);
    82 virtual  ULONG  GetWindowLongA(int index);
    83 virtual  WORD   SetWindowWord(int index, WORD value);
    84 virtual  WORD   GetWindowWord(int index);
    85 
    86          DWORD  getStyle()                      { return dwStyle; };
    87          DWORD  getExStyle()                    { return dwExStyle; };
    88          HWND   getWindowHandle()               { return Win32Hwnd; };
    89          HWND   getOS2WindowHandle()            { return OS2Hwnd; };
    90          HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
    91          BOOL   isFrameWindow()                 { return OS2Hwnd != OS2HwndFrame; };
    92    Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
    93          void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
    94        WNDPROC  getWindowProc()                 { return win32wndproc; };
    95          void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
    96         DWORD   getWindowId()                   { return windowId; };
    97          void   setWindowId(DWORD id)           { windowId = id; };
    98          ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
    99          BOOL   isChild();
    100          PRECT  getClientRect()                 { return &rectClient; };
    101          PRECT  getWindowRect()                 { return &rectWindow; };
    102 
    103          DWORD  getFlags()                      { return flags; };
    104          void   setFlags(DWORD newflags)        { flags = newflags; };
    105 
    106          HACCEL GetAccelTable()                     { return (HACCEL) acceltableResource; };
    107          BOOL   SetAccelTable(ULONG hAccel);
    108 
    109          HMENU  GetMenu()                           { return (HMENU) menuResource; };
    110          BOOL   SetMenu(ULONG hMenu);
    111 
    112          BOOL   SetIcon(HICON hIcon);
    113          HICON  GetIcon()                           { return (HICON) iconResource; };
    114 
    115          BOOL   ShowWindow(ULONG nCmdShow);
    116          BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
    117          BOOL   DestroyWindow();
    118          HWND   SetActiveWindow();
    119          HWND   GetParent();
    120          HWND   SetParent(HWND hwndNewParent);
    121          BOOL   IsChild(HWND hwndParent);
    122          HWND   GetTopWindow();
    123          BOOL   UpdateWindow();
    124          BOOL   IsIconic();
    125          HWND   GetWindow(UINT uCmd);
    126          BOOL   EnableWindow(BOOL fEnable);
    127          BOOL   CloseWindow();
    128   static HWND   GetActiveWindow();
    129          BOOL   IsWindow();
    130          BOOL   IsWindowEnabled();
    131          BOOL   IsWindowVisible();
    132          BOOL   IsUnicode()  { return isUnicode; };
    133 
    134          BOOL   GetWindowRect(PRECT pRect);
    135          int    GetWindowTextLengthA();
    136          int    GetWindowTextA(LPSTR lpsz, int cch);
    137          BOOL   SetWindowTextA(LPCSTR lpsz);
    138 
    139        LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    140        LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    141        BOOL     PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    142        BOOL     PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    143        LRESULT  DefWindowProcA(UINT msg, WPARAM wParam, LPARAM lParam);
    144        LRESULT  DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
    145 
    146          void   NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
     58virtual  ULONG  MsgCreate(HWND hwndOS2, ULONG initParam);
     59         ULONG  MsgQuit();
     60         ULONG  MsgClose();
     61         ULONG  MsgDestroy();
     62         ULONG  MsgEnable(BOOL fEnable);
     63         ULONG  MsgShow(BOOL fShow);
     64         ULONG  MsgMove(ULONG x, ULONG y);
     65         ULONG  MsgHitTest(ULONG x, ULONG y);
     66         ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
     67         ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
     68         ULONG  MsgSetFocus(HWND hwnd);
     69         ULONG  MsgKillFocus(HWND hwnd);
     70         ULONG  MsgCommand(ULONG cmd, ULONG Id, HWND hwnd);
     71         ULONG  MsgSysCommand(ULONG win32sc, ULONG x, ULONG y);
     72         ULONG  MsgChar(ULONG cmd, ULONG repeatcnt, ULONG scancode, ULONG vkey, ULONG keyflags);
     73         ULONG  MsgButton(ULONG msg, ULONG ncx, ULONG ncy, ULONG clx, ULONG cly);
     74         ULONG  MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
     75         ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
     76         ULONG  MsgEraseBackGround(HDC hdc);
     77         ULONG  MsgSetText(LPSTR lpsz, LONG cch);
     78         ULONG  MsgGetTextLength();
     79        char  *MsgGetText();
     80
     81virtual  LONG   SetWindowLongA(int index, ULONG value);
     82virtual  ULONG  GetWindowLongA(int index);
     83virtual  WORD   SetWindowWord(int index, WORD value);
     84virtual  WORD   GetWindowWord(int index);
     85
     86         DWORD  getStyle()                      { return dwStyle; };
     87         DWORD  getExStyle()                    { return dwExStyle; };
     88         HWND   getWindowHandle()               { return Win32Hwnd; };
     89         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
     90         HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
     91         BOOL   isFrameWindow()                 { return OS2Hwnd != OS2HwndFrame; };
     92   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
     93         void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
     94       WNDPROC  getWindowProc()                 { return win32wndproc; };
     95         void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
     96        DWORD   getWindowId()                   { return windowId; };
     97         void   setWindowId(DWORD id)           { windowId = id; };
     98         ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
     99         BOOL   isChild();
     100         PRECT  getClientRect()                 { return &rectClient; };
     101         PRECT  getWindowRect()                 { return &rectWindow; };
     102
     103         DWORD  getFlags()                      { return flags; };
     104         void   setFlags(DWORD newflags)        { flags = newflags; };
     105
     106         HACCEL GetAccelTable()                     { return (HACCEL) acceltableResource; };
     107         BOOL   SetAccelTable(ULONG hAccel);
     108
     109         HMENU  GetMenu()                           { return (HMENU) menuResource; };
     110         BOOL   SetMenu(ULONG hMenu);
     111
     112         BOOL   SetIcon(HICON hIcon);
     113         HICON  GetIcon()                           { return (HICON) iconResource; };
     114
     115         BOOL   ShowWindow(ULONG nCmdShow);
     116         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
     117         BOOL   DestroyWindow();
     118         HWND   SetActiveWindow();
     119         HWND   GetParent();
     120         HWND   SetParent(HWND hwndNewParent);
     121         BOOL   IsChild(HWND hwndParent);
     122         HWND   GetTopWindow();
     123         BOOL   UpdateWindow();
     124         BOOL   IsIconic();
     125         HWND   GetWindow(UINT uCmd);
     126         BOOL   EnableWindow(BOOL fEnable);
     127         BOOL   CloseWindow();
     128  static HWND   GetActiveWindow();
     129         BOOL   IsWindow();
     130         BOOL   IsWindowEnabled();
     131         BOOL   IsWindowVisible();
     132         BOOL   IsUnicode()  { return isUnicode; };
     133
     134         BOOL   GetWindowRect(PRECT pRect);
     135         int    GetWindowTextLengthA();
     136         int    GetWindowTextA(LPSTR lpsz, int cch);
     137         BOOL   SetWindowTextA(LPCSTR lpsz);
     138
     139       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     140       LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
     141       BOOL     PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     142       BOOL     PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
     143       LRESULT  DefWindowProcA(UINT msg, WPARAM wParam, LPARAM lParam);
     144       LRESULT  DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
     145
     146         void   NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
    147147
    148148Win32WndClass  *getClass()  { return windowClass; };
    149149
    150 static  HWND  Win32ToOS2Handle(HWND hwnd)
     150static  HWND  Win32ToOS2Handle(HWND hwnd)
    151151{
    152152 Win32Window *window = GetWindowFromHandle(hwnd);
    153153
    154154  if(window) {
    155         return window->getOS2WindowHandle();
     155        return window->getOS2WindowHandle();
    156156  }
    157   else  return hwnd;    //OS/2 window handle
     157  else  return hwnd;    //OS/2 window handle
    158158}
    159159
    160 static  HWND  OS2ToWin32Handle(HWND hwnd)
     160static  HWND  OS2ToWin32Handle(HWND hwnd)
    161161{
    162162 Win32Window *window = GetWindowFromOS2Handle(hwnd);
    163163
    164164  if(window) {
    165         return window->getWindowHandle();
     165        return window->getWindowHandle();
    166166  }
    167   else  return hwnd;    //OS/2 window handle
     167  else  return hwnd;    //OS/2 window handle
    168168}
    169169
     
    172172
    173173protected:
    174        LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    175        LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    176         void    Init();
    177 
    178         HWND    OS2Hwnd;
    179         HWND    OS2HwndFrame;
    180         HWND    OS2HwndMenu;
    181         HWND    Win32Hwnd;
    182         BOOL    isUnicode;
    183 
    184         int     posx, posy, width, height;
    185 
    186         // values normally contained in the standard window words
    187         ULONG   dwExStyle;              //GWL_EXSTYLE
    188         ULONG   dwStyle;                //GWL_STYLE
    189       WNDPROC   win32wndproc;           //GWL_WNDPROC
    190         ULONG   hInstance;              //GWL_HINSTANCE
     174       LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     175       LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
     176        void    Init();
     177
     178        HWND    OS2Hwnd;
     179        HWND    OS2HwndFrame;
     180        HWND    OS2HwndMenu;
     181        HWND    Win32Hwnd;
     182        BOOL    isUnicode;
     183
     184        int     posx, posy, width, height;
     185
     186        // values normally contained in the standard window words
     187        ULONG   dwExStyle;              //GWL_EXSTYLE
     188        ULONG   dwStyle;                //GWL_STYLE
     189      WNDPROC   win32wndproc;           //GWL_WNDPROC
     190        ULONG   hInstance;              //GWL_HINSTANCE
    191191//Moved in ChildWindow class
    192 /////   Win32Window *parent;                    //GWL_HWNDPARENT
    193         ULONG   windowId;               //GWL_ID
    194         ULONG   userData;               //GWL_USERDATA
    195 
    196          HWND   hwndLinkAfter;
    197         DWORD   flags;
    198         DWORD   lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
    199 
    200         BOOL    isIcon;
    201         BOOL    fCreated;
    202         BOOL    fFirstShow;
    203 
    204    Win32Window *owner;                 
     192/////   Win32Window *parent;                    //GWL_HWNDPARENT
     193        ULONG   windowId;               //GWL_ID
     194        ULONG   userData;               //GWL_USERDATA
     195
     196         HWND   hwndLinkAfter;
     197        DWORD   flags;
     198        DWORD   lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
     199
     200        BOOL    isIcon;
     201        BOOL    fCreated;
     202        BOOL    fFirstShow;
     203
     204   Win32Window *owner;
    205205
    206206 Win32Resource *acceltableResource;
     
    208208 Win32Resource *iconResource;
    209209
    210         char    windowNameA[MAX_WINDOW_NAMELENGTH];
    211         WCHAR   windowNameW[MAX_WINDOW_NAMELENGTH];
    212         ULONG   wndNameLength;
    213 
    214         ULONG  *userWindowLong;
    215         ULONG   nrUserWindowLong;
    216 
    217         RECT    rectWindow;
    218         RECT    rectClient;
     210        char    windowNameA[MAX_WINDOW_NAMELENGTH];
     211        WCHAR   windowNameW[MAX_WINDOW_NAMELENGTH];
     212        ULONG   wndNameLength;
     213
     214        ULONG  *userWindowLong;
     215        ULONG   nrUserWindowLong;
     216
     217        RECT    rectWindow;
     218        RECT    rectClient;
    219219
    220220Win32WndClass  *windowClass;
     
    224224private:
    225225#ifndef OS2_INCLUDED
    226         BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
    227 
    228         void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    229 
    230         LONG  SendNCCalcSize(BOOL calcValidRect,
    231                              RECT *newWindowRect, RECT *oldWindowRect,
    232                              RECT *oldClientRect, WINDOWPOS *winpos,
    233                              RECT *newClientRect );
     226        BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
     227
     228        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
     229
     230        LONG  SendNCCalcSize(BOOL calcValidRect,
     231                             RECT *newWindowRect, RECT *oldWindowRect,
     232                             RECT *oldClientRect, WINDOWPOS *winpos,
     233                             RECT *newClientRect );
    234234
    235235     LRESULT  SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
    236236     {
    237         if(isUnicode)
    238                 return SendInternalMessageW(msg, wParam, lParam);
    239         else    return SendInternalMessageA(msg, wParam, lParam);
     237        if(isUnicode)
     238                return SendInternalMessageW(msg, wParam, lParam);
     239        else    return SendInternalMessageA(msg, wParam, lParam);
    240240     }
    241241#endif
     
    243243
    244244
    245 #define BUTTON_LEFTDOWN         0
    246 #define BUTTON_LEFTUP           1
    247 #define BUTTON_LEFTDBLCLICK     2
    248 #define BUTTON_RIGHTUP          3
    249 #define BUTTON_RIGHTDOWN        4
    250 #define BUTTON_RIGHTDBLCLICK    5
    251 #define BUTTON_MIDDLEUP         6
    252 #define BUTTON_MIDDLEDOWN       7
    253 #define BUTTON_MIDDLEDBLCLICK   8
    254 
    255 #define WMMOVE_LBUTTON          1
    256 #define WMMOVE_MBUTTON          2
    257 #define WMMOVE_RBUTTON          4
    258 #define WMMOVE_CTRL             8
    259 #define WMMOVE_SHIFT            16
    260 
    261 
    262 #define CMD_MENU                1
    263 #define CMD_CONTROL             2
    264 #define CMD_ACCELERATOR         3
    265 
    266 #define WIN32SC_SIZE         0xf000
    267 #define WIN32SC_MOVE         0xf010
     245#define BUTTON_LEFTDOWN         0
     246#define BUTTON_LEFTUP           1
     247#define BUTTON_LEFTDBLCLICK     2
     248#define BUTTON_RIGHTUP          3
     249#define BUTTON_RIGHTDOWN        4
     250#define BUTTON_RIGHTDBLCLICK    5
     251#define BUTTON_MIDDLEUP         6
     252#define BUTTON_MIDDLEDOWN       7
     253#define BUTTON_MIDDLEDBLCLICK   8
     254
     255#define WMMOVE_LBUTTON          1
     256#define WMMOVE_MBUTTON          2
     257#define WMMOVE_RBUTTON          4
     258#define WMMOVE_CTRL             8
     259#define WMMOVE_SHIFT            16
     260
     261
     262#define CMD_MENU                1
     263#define CMD_CONTROL             2
     264#define CMD_ACCELERATOR         3
     265
     266#define WIN32SC_SIZE         0xf000
     267#define WIN32SC_MOVE         0xf010
    268268#define WIN32SC_MINIMIZE     0xf020
    269269#define WIN32SC_MAXIMIZE     0xf030
    270270#define WIN32SC_NEXTWINDOW   0xf040
    271271#define WIN32SC_PREVWINDOW   0xf050
    272 #define WIN32SC_CLOSE        0xf060
     272#define WIN32SC_CLOSE        0xf060
    273273#define WIN32SC_VSCROLL      0xf070
    274274#define WIN32SC_HSCROLL      0xf080
     
    279279#define WIN32SC_TASKLIST     0xf130
    280280#define WIN32SC_SCREENSAVE   0xf140
    281 #define WIN32SC_HOTKEY       0xf150
    282 
    283 #define KEY_ALTDOWN             1
    284 #define KEY_PREVDOWN            2
    285 #define KEY_UP                  4
    286 #define KEY_DEADKEY             8
     281#define WIN32SC_HOTKEY       0xf150
     282
     283#define KEY_ALTDOWN             1
     284#define KEY_PREVDOWN            2
     285#define KEY_UP                  4
     286#define KEY_DEADKEY             8
    287287
    288288#endif //__cplusplus
  • trunk/src/user32/new/wingdi.cpp

    r392 r650  
    1 /* $Id: wingdi.cpp,v 1.8 1999-07-25 15:51:57 sandervl Exp $ */
     1/* $Id: wingdi.cpp,v 1.9 1999-08-23 15:34:47 dengert Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    2929    window = Win32Window::GetWindowFromHandle(hwnd);
    3030    if(!window) {
    31         dprintf(("GetDC, window %x not found", hwnd));
    32         return 0;
     31        dprintf(("GetDC, window %x not found", hwnd));
     32        return 0;
    3333    }
    3434#ifdef OPEN32_GDI
     
    4040#endif
    4141    dprintf(("BeginPaint %X returned %x\n", hwnd, hdc));
     42
     43    lps->fErase = !window->MsgEraseBackGround(hdc);
    4244    return hdc;
    4345
     
    6567   window = Win32Window::GetWindowFromHandle(hwnd);
    6668   if(!window) {
    67         dprintf(("GetDC, window %x not found", hwnd));
     69        dprintf(("GetDC, window %x not found", hwnd));
    6870#ifdef OPEN32_GDI
    6971        dprintf(("GetDC %x", hwnd));
    70         return O32_GetDC(0);
     72        return O32_GetDC(0);
    7173#else
    7274        //desktop window?
Note: See TracChangeset for help on using the changeset viewer.