Changeset 328 for trunk/src


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

* empty log message *

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

Legend:

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

    r300 r328  
    1 /* $Id: defwndproc.cpp,v 1.1 1999-07-14 08:35:34 sandervl Exp $ */
     1/* $Id: defwndproc.cpp,v 1.2 1999-07-18 14:39:34 sandervl Exp $ */
    22
    33/*
     
    2525////    WriteLog("*DWP*");
    2626#endif
    27     switch(Msg) {
    28         case WM_SETREDRAW: //Open32 does not set the visible flag
    29                 if(wParam)
    30                         SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    31                 else    SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    32 
     27    switch(Msg)
     28    {
     29    case WM_SETREDRAW: //Open32 does not set the visible flag
     30        if(wParam)
     31                SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     32        else    SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     33
     34        return 0; //TODO
     35
     36    case WM_NCCREATE:
     37        return(TRUE);
     38
     39    case WM_CTLCOLORMSGBOX:
     40    case WM_CTLCOLOREDIT:
     41    case WM_CTLCOLORLISTBOX:
     42    case WM_CTLCOLORBTN:
     43    case WM_CTLCOLORDLG:
     44    case WM_CTLCOLORSTATIC:
     45    case WM_CTLCOLORSCROLLBAR:
     46         SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     47         SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     48         return GetSysColorBrush(COLOR_BTNFACE);
     49
     50    case WM_PARENTNOTIFY:
     51        return 0;
     52
     53    case WM_MOUSEACTIVATE:
     54    {
     55        DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     56        DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     57        dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
     58        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
     59        {
     60            LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
     61            if(rc)  return rc;
     62        }
     63        return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
     64    }
     65    case WM_SETCURSOR:
     66    {
     67        DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     68        DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     69        dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
     70        if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
     71        {
     72            LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam);
     73            if(rc)  return rc;
     74        }
     75        return 1;
     76    }
     77    case WM_MOUSEMOVE:
     78        return 0;
     79       
     80    case WM_ERASEBKGND:
     81    case WM_ICONERASEBKGND:
     82        return 0;
     83       
     84    case WM_NCLBUTTONDOWN:
     85    case WM_NCLBUTTONUP:
     86    case WM_NCLBUTTONDBLCLK:
     87    case WM_NCRBUTTONUP:
     88    case WM_NCRBUTTONDOWN:
     89    case WM_NCRBUTTONDBLCLK:
     90    case WM_NCMBUTTONDOWN:
     91    case WM_NCMBUTTONUP:
     92    case WM_NCMBUTTONDBLCLK:
     93                return 0;           //TODO: Send WM_SYSCOMMAND if required
     94               
     95    case WM_NCHITTEST: //TODO:
     96        return 0;
     97       
     98    default:
     99        return 1;
     100    }
     101}
     102//******************************************************************************
     103//NOTE: Unicode msg translation!
     104//******************************************************************************
     105LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     106{
     107#ifdef DEBUG
     108////    WriteLog("*DWPW*");
     109#endif
     110    switch(Msg) {
     111        case WM_SETREDRAW: //Open32 does not set the visible flag
     112                if(wParam)
     113                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     114                else
     115                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    33116                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
    34         case WM_NCCREATE://SvL: YAFMO (yet another feature missing in Open32)
    35                 return(TRUE);
    36         case WM_CTLCOLORMSGBOX:
    37         case WM_CTLCOLOREDIT:
    38         case WM_CTLCOLORLISTBOX:
    39         case WM_CTLCOLORBTN:
    40         case WM_CTLCOLORDLG:
    41         case WM_CTLCOLORSTATIC:
    42         case WM_CTLCOLORSCROLLBAR:
    43                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    44                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    45                 return GetSysColorBrush(COLOR_BTNFACE);
    46 
    47         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    48                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    49                 return 0;
    50 
    51         case WM_MOUSEACTIVATE:
    52         {
    53                 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
    54                 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
    55                 dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
    56                 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
    57                 {
    58                         LRESULT rc = SendMessageA(GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
    59                         if(rc)  return rc;
    60                 }
    61                 return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
    62         }
    63         case WM_SETCURSOR:
    64         {
    65                 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
    66                 DWORD dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
    67                 dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", hwnd, GetMsgText(HIWORD(lParam))));
    68                 if(dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
    69                 {
    70                         LRESULT rc = SendMessageA(GetParent(hwnd), WM_SETCURSOR, wParam, lParam);
    71                         if(rc)  return rc;
    72                 }
    73                 return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
    74         }
     117        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     118                return(TRUE);
     119        case WM_CTLCOLORMSGBOX:
     120        case WM_CTLCOLOREDIT:
     121        case WM_CTLCOLORLISTBOX:
     122        case WM_CTLCOLORBTN:
     123        case WM_CTLCOLORDLG:
     124        case WM_CTLCOLORSTATIC:
     125        case WM_CTLCOLORSCROLLBAR:
     126                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     127                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     128                return GetSysColorBrush(COLOR_BTNFACE);
     129
     130    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     131        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     132        return 0;
     133
    75134        default:
    76135                return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
     
    78137}
    79138//******************************************************************************
     139//******************************************************************************
     140LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     141{
     142#ifdef DEBUG
     143////    WriteLog("*DDP*");
     144#endif
     145    switch(Msg) {
     146        case WM_SETREDRAW: //Open32 does not set the visible flag
     147                if(wParam)
     148                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     149                else
     150                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     151                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     152        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     153                return(TRUE);
     154        case WM_CTLCOLORMSGBOX:
     155        case WM_CTLCOLOREDIT:
     156        case WM_CTLCOLORLISTBOX:
     157        case WM_CTLCOLORBTN:
     158        case WM_CTLCOLORDLG:
     159        case WM_CTLCOLORSTATIC:
     160        case WM_CTLCOLORSCROLLBAR:
     161                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     162                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     163                return GetSysColorBrush(COLOR_BTNFACE);
     164
     165    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     166        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     167        return 0;
     168
     169        default:
     170                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     171    }
     172}
     173//******************************************************************************
    80174//NOTE: Unicode msg translation!
    81175//******************************************************************************
    82 LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    83 {
    84 #ifdef DEBUG
    85 ////    WriteLog("*DWPW*");
    86 #endif
    87     switch(Msg) {
    88         case WM_SETREDRAW: //Open32 does not set the visible flag
    89                 if(wParam)
    90                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    91                 else
    92                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    93                 return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
    94         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    95                 return(TRUE);
    96         case WM_CTLCOLORMSGBOX:
    97         case WM_CTLCOLOREDIT:
    98         case WM_CTLCOLORLISTBOX:
    99         case WM_CTLCOLORBTN:
    100         case WM_CTLCOLORDLG:
    101         case WM_CTLCOLORSTATIC:
    102         case WM_CTLCOLORSCROLLBAR:
    103                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    104                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    105                 return GetSysColorBrush(COLOR_BTNFACE);
    106 
    107         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    108                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    109                 return 0;
    110 
    111         default:
    112                 return O32_DefWindowProc(hwnd, Msg, wParam, lParam);
    113     }
    114 }
    115 //******************************************************************************
    116 //******************************************************************************
    117 LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    118 {
    119 #ifdef DEBUG
    120 ////    WriteLog("*DDP*");
     176LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     177{
     178#ifdef DEBUG
     179////    WriteLog("*DDPW*");
    121180#endif
    122181    switch(Msg) {
     
    140199                return GetSysColorBrush(COLOR_BTNFACE);
    141200
    142         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    143                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    144                 return 0;
    145 
    146         default:
    147                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
    148     }
    149 }
    150 //******************************************************************************
    151 //NOTE: Unicode msg translation!
    152 //******************************************************************************
    153 LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    154 {
    155 #ifdef DEBUG
    156 ////    WriteLog("*DDPW*");
    157 #endif
    158     switch(Msg) {
    159         case WM_SETREDRAW: //Open32 does not set the visible flag
    160                 if(wParam)
    161                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    162                 else
    163                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    164                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
    165         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    166                 return(TRUE);
    167         case WM_CTLCOLORMSGBOX:
    168         case WM_CTLCOLOREDIT:
    169         case WM_CTLCOLORLISTBOX:
    170         case WM_CTLCOLORBTN:
    171         case WM_CTLCOLORDLG:
    172         case WM_CTLCOLORSTATIC:
    173         case WM_CTLCOLORSCROLLBAR:
    174                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    175                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    176                 return GetSysColorBrush(COLOR_BTNFACE);
    177 
    178         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    179                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    180                 return 0;
     201    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     202        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     203        return 0;
    181204
    182205        default:
     
    211234                return GetSysColorBrush(COLOR_BTNFACE);
    212235
    213         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    214                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
    215                 return 0;
     236    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     237        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
     238        return 0;
    216239
    217240        default:
     
    247270                return GetSysColorBrush(COLOR_BTNFACE);
    248271
    249         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    250                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
    251                 return 0;
     272    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     273        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwndFrame));
     274        return 0;
    252275
    253276        default:
     
    282305                return GetSysColorBrush(COLOR_BTNFACE);
    283306
    284         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    285                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    286                 return 0;
     307    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     308        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     309        return 0;
    287310
    288311        default:
     
    318341                return GetSysColorBrush(COLOR_BTNFACE);
    319342
    320         case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    321                 dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    322                 return 0;
     343    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     344        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     345        return 0;
    323346
    324347        default:
  • trunk/src/user32/new/oslibgdi.cpp

    r325 r328  
    1 /* $Id: oslibgdi.cpp,v 1.1 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.2 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    2626 PRECTL pWinRect = (PRECTL)pRectl;
    2727 ULONG  tmp;
    28  
     28
    2929  tmp = pWinRect->yBottom;
    3030  pWinRect->yBottom = pWinRect->yTop;
     
    7474 HWND     hwndParent;
    7575 RECTLOS2 rectParent = {0};
    76    
     76
    7777   hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    7878   WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
     
    110110//
    111111// Parameters:
    112 //   hwndChild: Child window handle
     112//   hwndChild: Child window handle
    113113//   rectChild: OS/2 child window RECTL
    114114//
    115115// Returns:
    116116//   rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
    117 //   TRUE:      Success
    118 //   FALSE:     Failures
     117//   TRUE:      Success
     118//   FALSE:     Failures
    119119//******************************************************************************
    120120BOOL MapOS2ToWin32Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32)
     
    142142// Returns:
    143143//   rectChild:  Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
    144 //   TRUE:      Success
    145 //   FALSE:     Failures
     144//   TRUE:      Success
     145//   FALSE:     Failures
    146146//******************************************************************************
    147147BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32)
     
    162162//   rectChild:  OS/2  Child window RECTL  (OUT)
    163163// Returns:
    164 //   TRUE:      Success
    165 //   FALSE:     Failures
     164//   TRUE:      Success
     165//   FALSE:     Failures
    166166//******************************************************************************
    167167BOOL MapWin32ToOS2Rectl(HWND hwndChild, PRECT rectWin32, PRECTLOS2 rectChild)
     
    188188//   rectChild:  OS/2  Child window RECTL  (OUT)
    189189// Returns:
    190 //   TRUE:      Success
    191 //   FALSE:     Failures
     190//   TRUE:      Success
     191//   FALSE:     Failures
    192192//******************************************************************************
    193193BOOL MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECT rectWin32, PRECTLOS2 rectChild)
  • trunk/src/user32/new/oslibwin.cpp

    r327 r328  
    1 /* $Id: oslibwin.cpp,v 1.11 1999-07-18 13:57:47 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.12 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    256256//******************************************************************************
    257257//******************************************************************************
    258 BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect)
    259 {
    260   return WinQueryUpdateRect(hwnd, (PRECTL)pRect);
    261   //CB: caller must convert rect
     258BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect)
     259{
     260 BOOL rc;
     261 RECTLOS2 rectl;
     262
     263  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
     264  if(rc) {
     265        MapOS2ToWin32Rectl(hwnd, &rectl, pRect);
     266  }
     267  return rc;
    262268}
    263269//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r327 r328  
    1 /* $Id: oslibwin.h,v 1.10 1999-07-18 13:57:47 cbratschi Exp $ */
     1/* $Id: oslibwin.h,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    184184
    185185BOOL  OSLibWinDestroyWindow(HWND hwnd);
    186 BOOL  OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect); //must be RECTL pointer!
     186BOOL  OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect);
    187187BOOL  OSLibWinIsIconic(HWND hwnd);
    188188BOOL  OSLibWinSetActiveWindow(HWND hwnd);
  • 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 );
  • trunk/src/user32/new/win32wnd.cpp

    r327 r328  
    1 /* $Id: win32wnd.cpp,v 1.10 1999-07-18 13:57:48 cbratschi Exp $ */
     1/* $Id: win32wnd.cpp,v 1.11 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    9595  flags            = 0;
    9696  isIcon           = FALSE;
     97  lastHitTestVal   = 0;
    9798  owner            = NULL;
    9899  windowClass      = 0;
     
    128129                dprintf(("Bad parent %04x\n", cs->hwndParent ));
    129130                SetLastError(ERROR_INVALID_PARAMETER);
    130                 return FALSE;
     131        return FALSE;
    131132        }
    132133        /* Make sure parent is valid */
     
    231232  if ((cs->style & WS_CHILD) && cs->hwndParent)
    232233  {
    233         SetParent(cs->hwndParent);
     234    SetParent(cs->hwndParent);
    234235  }
    235236  else
     
    240241        else
    241242        {
    242                 owner = GetWindowFromHandle(cs->hwndParent);
     243        owner = GetWindowFromHandle(cs->hwndParent);
    243244                if(owner == NULL)
    244245                {
     
    263264    if (HOOK_IsHooked( WH_CBT ))
    264265    {
    265         CBT_CREATEWNDA cbtc;
     266    CBT_CREATEWNDA cbtc;
    266267        LRESULT ret;
    267268
    268         cbtc.lpcs = cs;
    269         cbtc.hwndInsertAfter = hwndLinkAfter;
     269    cbtc.lpcs = cs;
     270    cbtc.hwndInsertAfter = hwndLinkAfter;
    270271        ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc)
    271272                      : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc);
    272273        if (ret)
    273         {
    274             TRACE_(win)("CBT-hook returned 0\n");
    275             wndPtr->pDriver->pFinalize(wndPtr);
     274    {
     275        TRACE_(win)("CBT-hook returned 0\n");
     276        wndPtr->pDriver->pFinalize(wndPtr);
    276277            retvalue =  0;
    277278            goto end;
    278         }
     279    }
    279280    }
    280281#endif
     
    337338                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    338339                                 (owner) ? owner->getOS2WindowHandle() : 0,
    339                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     340                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    340341                                 &OS2HwndFrame);
    341342
     
    354355#if 0
    355356  if(OS2Hwnd != OS2HwndFrame) {
    356         if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    357                 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
    358                 return FALSE;
    359         }
    360         if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    361                 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
    362                 return FALSE;
    363         }
     357    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     358            dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));
     359            return FALSE;
     360    }
     361    if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     362            dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));
     363            return FALSE;
     364    }
    364365  }
    365366#endif
     
    389390        OffsetRect(&rectWindow, maxPos.x - rectWindow.left,
    390391                                          maxPos.y - rectWindow.top);
    391         dprintf(("Sending WM_CREATE"));
     392    dprintf(("Sending WM_CREATE"));
    392393        if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
    393394        {
    394395            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
    395                          rectClient.right-rectClient.left,
    396                          rectClient.bottom-rectClient.top,
    397                          SWP_NOACTIVATE);
     396             rectClient.right-rectClient.left,
     397             rectClient.bottom-rectClient.top,
     398             SWP_NOACTIVATE);
    398399
    399400            if (cs->style & WS_VISIBLE) ShowWindow( sw );
     
    405406                HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
    406407#endif
    407             return TRUE;
     408        return TRUE;
    408409        }
    409410  }
     
    429430    if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))
    430431    {
    431         if( dwStyle & WS_MINIMIZE )
    432         {
    433             if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
    434                 return (SWP_NOSIZE | SWP_NOMOVE);
    435             swpFlags |= SWP_NOCOPYBITS;
    436         }
    437         switch( cmd )
    438         {
    439             case SW_MINIMIZE:
    440                  if( dwStyle & WS_MAXIMIZE)
    441                  {
    442                      flags |= WIN_RESTORE_MAX;
    443                      dwStyle &= ~WS_MAXIMIZE;
     432    if( dwStyle & WS_MINIMIZE )
     433    {
     434        if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
     435        return (SWP_NOSIZE | SWP_NOMOVE);
     436        swpFlags |= SWP_NOCOPYBITS;
     437    }
     438    switch( cmd )
     439    {
     440        case SW_MINIMIZE:
     441         if( dwStyle & WS_MAXIMIZE)
     442         {
     443             flags |= WIN_RESTORE_MAX;
     444             dwStyle &= ~WS_MAXIMIZE;
    444445                 }
    445446                 else
    446                      flags &= ~WIN_RESTORE_MAX;
    447                  dwStyle |= WS_MINIMIZE;
     447             flags &= ~WIN_RESTORE_MAX;
     448         dwStyle |= WS_MINIMIZE;
    448449
    449450#if 0
    450                  if( flags & WIN_NATIVE )
    451                      if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
    452                          swpFlags |= MINMAX_NOSWP;
     451         if( flags & WIN_NATIVE )
     452             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
     453             swpFlags |= MINMAX_NOSWP;
    453454#endif
    454455
    455                  lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
    456 
    457                  SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
    458                          GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
    459                  swpFlags |= SWP_NOCOPYBITS;
    460                  break;
    461 
    462             case SW_MAXIMIZE:
     456         lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
     457
     458         SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
     459             GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
     460         swpFlags |= SWP_NOCOPYBITS;
     461         break;
     462
     463        case SW_MAXIMIZE:
    463464                CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    464465                WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
    465466                CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    466467
    467                  if( dwStyle & WS_MINIMIZE )
    468                  {
    469                      if( flags & WIN_NATIVE )
    470                          if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    471                              swpFlags |= MINMAX_NOSWP;
    472 
    473                      WINPOS_ShowIconTitle( wndPtr, FALSE );
    474                      dwStyle &= ~WS_MINIMIZE;
    475                  }
     468         if( dwStyle & WS_MINIMIZE )
     469         {
     470             if( flags & WIN_NATIVE )
     471             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
     472                 swpFlags |= MINMAX_NOSWP;
     473
     474             WINPOS_ShowIconTitle( wndPtr, FALSE );
     475             dwStyle &= ~WS_MINIMIZE;
     476         }
    476477                 dwStyle |= WS_MAXIMIZE;
    477478
    478                  SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
    479                                     size.x, size.y );
    480                  break;
    481 
    482             case SW_RESTORE:
    483                  if( dwStyle & WS_MINIMIZE )
    484                  {
    485                      if( flags & WIN_NATIVE )
    486                          if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    487                              swpFlags |= MINMAX_NOSWP;
    488 
    489                      dwStyle &= ~WS_MINIMIZE;
    490                      WINPOS_ShowIconTitle( wndPtr, FALSE );
    491 
    492                      if( flags & WIN_RESTORE_MAX)
    493                      {
    494                          /* Restore to maximized position */
     479         SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
     480                    size.x, size.y );
     481         break;
     482
     483        case SW_RESTORE:
     484         if( dwStyle & WS_MINIMIZE )
     485         {
     486             if( flags & WIN_NATIVE )
     487             if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
     488                 swpFlags |= MINMAX_NOSWP;
     489
     490             dwStyle &= ~WS_MINIMIZE;
     491             WINPOS_ShowIconTitle( wndPtr, FALSE );
     492
     493             if( flags & WIN_RESTORE_MAX)
     494             {
     495             /* Restore to maximized position */
    495496                         CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    496497                         WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);
    497498                         CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    498                          dwStyle |= WS_MAXIMIZE;
    499                          SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
    500                          break;
    501                      }
    502                  }
    503                  else
    504                      if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
    505                      else dwStyle &= ~WS_MAXIMIZE;
    506 
    507                  /* Restore to normal position */
    508 
    509                 *lpRect = lpPos->rectNormal;
    510                  lpRect->right -= lpRect->left;
    511                  lpRect->bottom -= lpRect->top;
    512 
    513                  break;
    514         }
     499             dwStyle |= WS_MAXIMIZE;
     500             SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
     501             break;
     502             }
     503         }
     504         else
     505             if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
     506             else dwStyle &= ~WS_MAXIMIZE;
     507
     508         /* Restore to normal position */
     509
     510        *lpRect = lpPos->rectNormal;
     511         lpRect->right -= lpRect->left;
     512         lpRect->bottom -= lpRect->top;
     513
     514         break;
     515    }
    515516    } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
    516517    return swpFlags;
     
    611612   {
    612613        winposCopy = *winpos;
    613         params.rgrc[1] = *oldWindowRect;
    614         params.rgrc[2] = *oldClientRect;
    615         params.lppos = &winposCopy;
     614    params.rgrc[1] = *oldWindowRect;
     615    params.rgrc[2] = *oldClientRect;
     616    params.lppos = &winposCopy;
    616617   }
    617618   result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect,
     
    665666//******************************************************************************
    666667ULONG Win32Window::MsgMove(ULONG xParent, ULONG yParent)
    667 {
    668   return 0;
     668{       
     669  return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)xParent, (USHORT)yParent));
     670}
     671//******************************************************************************
     672//******************************************************************************
     673ULONG Win32Window::MsgHitTest(ULONG x, ULONG y)
     674{
     675  lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y));
     676  return 1; //TODO: May need to change this
    669677}
    670678//******************************************************************************
     
    709717{
    710718 ULONG win32msg;
     719 ULONG win32ncmsg;
    711720
    712721  switch(msg) {
    713722        case BUTTON_LEFTDOWN:
    714723                win32msg = WM_LBUTTONDOWN;
     724                win32ncmsg = WM_NCLBUTTONDOWN;
    715725                break;
    716726        case BUTTON_LEFTUP:
    717727                win32msg = WM_LBUTTONUP;
     728                win32ncmsg = WM_NCLBUTTONUP;
    718729                break;
    719730        case BUTTON_LEFTDBLCLICK:
    720731                win32msg = WM_LBUTTONDBLCLK;
     732                win32ncmsg = WM_NCLBUTTONDBLCLK;
    721733                break;
    722734        case BUTTON_RIGHTUP:
    723735                win32msg = WM_RBUTTONUP;
     736                win32ncmsg = WM_NCRBUTTONUP;
    724737                break;
    725738        case BUTTON_RIGHTDOWN:
    726739                win32msg = WM_RBUTTONDOWN;
     740                win32ncmsg = WM_NCRBUTTONDOWN;
    727741                break;
    728742        case BUTTON_RIGHTDBLCLICK:
    729743                win32msg = WM_RBUTTONDBLCLK;
     744                win32ncmsg = WM_NCRBUTTONDBLCLK;
     745                break;
     746        case BUTTON_MIDDLEUP:
     747                win32msg = WM_MBUTTONUP;
     748                win32ncmsg = WM_NCMBUTTONUP;
     749                break;
     750        case BUTTON_MIDDLEDOWN:
     751                win32msg = WM_MBUTTONDOWN;
     752                win32ncmsg = WM_NCMBUTTONDOWN;
     753                break;
     754        case BUTTON_MIDDLEDBLCLICK:
     755                win32msg = WM_MBUTTONDBLCLK;
     756                win32ncmsg = WM_NCMBUTTONDBLCLK;
    730757                break;
    731758        default:
     
    733760                return 1;
    734761  }
    735   return SendInternalMessageA(win32msg, 0, MAKELONG(x, MapOS2ToWin32Y(OS2Hwnd, y)));
     762  SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(x, y)); //TODO:
     763  return SendInternalMessageA(win32msg, 0, MAKELONG(x, y));
     764}
     765//******************************************************************************
     766//******************************************************************************
     767ULONG Win32Window::MsgMouseMove(ULONG keystate, ULONG x, ULONG y)
     768{
     769ULONG winstate = 0;
     770
     771  if(keystate & WMMOVE_LBUTTON)
     772        winstate |= MK_LBUTTON;
     773  if(keystate & WMMOVE_RBUTTON)
     774        winstate |= MK_RBUTTON;
     775  if(keystate & WMMOVE_MBUTTON)
     776        winstate |= MK_MBUTTON;
     777  if(keystate & WMMOVE_SHIFT)
     778        winstate |= MK_SHIFT;
     779  if(keystate & WMMOVE_CTRL)
     780        winstate |= MK_CONTROL;
     781       
     782   return SendInternalMessageA(WM_MOUSEMOVE, keystate, MAKELONG(x, y));
    736783}
    737784//******************************************************************************
     
    745792ULONG Win32Window::MsgEraseBackGround(ULONG hps)
    746793{
    747   return SendInternalMessageA(WM_ERASEBKGND, hps, 0);
     794        if(isIcon) {
     795                        return SendInternalMessageA(WM_ICONERASEBKGND, hps, 0);
     796        }
     797        else    return SendInternalMessageA(WM_ERASEBKGND, hps, 0);
    748798}
    749799//******************************************************************************
     
    752802{
    753803  if(isUnicode) {
    754         return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
     804        return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz);
    755805  }
    756806  else  return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
     
    843893{
    844894  if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE)
    845 
    846895        dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam));
    847896
     
    929978  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
    930979  if(postmsg == NULL) {
    931         dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
    932         return 0;
     980    dprintf(("Win32Window::PostMessageA: malloc returned NULL!!"));
     981    return 0;
    933982  }
    934983  postmsg->Msg    = msg;
     
    945994  postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET));
    946995  if(postmsg == NULL) {
    947         dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
    948         return 0;
     996    dprintf(("Win32Window::PostMessageW: malloc returned NULL!!"));
     997    return 0;
    949998  }
    950999  postmsg->Msg    = msg;
     
    9871036   if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR)
    9881037   {
    989         OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
    990         if(OS2HwndMenu == 0) {
    991                 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
    992                 return FALSE;
    993         }
     1038    OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate);
     1039    if(OS2HwndMenu == 0) {
     1040        dprintf(("Win32Window::SetMenu OS2HwndMenu == 0"));
     1041        return FALSE;
     1042    }
    9941043   }
    9951044   dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu));
     
    10051054  switch(nCmdShow)
    10061055  {
    1007         case SW_SHOW:
    1008         case SW_SHOWDEFAULT: //todo
    1009                 showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
    1010                 break;
    1011         case SW_HIDE:
    1012                 showstate = SWPOS_HIDE;
    1013                 break;
    1014         case SW_RESTORE:
    1015                 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1016                 break;
    1017         case SW_MINIMIZE:
    1018                 showstate = SWPOS_MINIMIZE;
    1019                 break;
    1020         case SW_SHOWMAXIMIZED:
    1021                 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1022                 break;
    1023         case SW_SHOWMINIMIZED:
    1024                 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
    1025                 break;
    1026         case SW_SHOWMINNOACTIVE:
    1027                 showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
    1028                 break;
    1029         case SW_SHOWNA:
    1030                 showstate = SWPOS_SHOW;
    1031                 break;
    1032         case SW_SHOWNOACTIVATE:
    1033                 showstate = SWPOS_SHOW;
    1034                 break;
    1035         case SW_SHOWNORMAL:
    1036                 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
    1037                 break;
     1056    case SW_SHOW:
     1057    case SW_SHOWDEFAULT: //todo
     1058        showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
     1059        break;
     1060    case SW_HIDE:
     1061        showstate = SWPOS_HIDE;
     1062        break;
     1063    case SW_RESTORE:
     1064        showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1065        break;
     1066    case SW_MINIMIZE:
     1067        showstate = SWPOS_MINIMIZE;
     1068        break;
     1069    case SW_SHOWMAXIMIZED:
     1070        showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1071        break;
     1072    case SW_SHOWMINIMIZED:
     1073        showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
     1074        break;
     1075    case SW_SHOWMINNOACTIVE:
     1076        showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
     1077        break;
     1078    case SW_SHOWNA:
     1079        showstate = SWPOS_SHOW;
     1080        break;
     1081    case SW_SHOWNOACTIVATE:
     1082        showstate = SWPOS_SHOW;
     1083        break;
     1084    case SW_SHOWNORMAL:
     1085        showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
     1086        break;
    10381087  }
    10391088  return OSLibWinShowWindow(OS2HwndFrame, showstate);
     
    10471096
    10481097  switch(hwndInsertAfter) {
    1049         case HWND_BOTTOM:
    1050                 hwndInsertAfter = HWNDOS_BOTTOM;
    1051                 break;
    1052         case HWND_TOPMOST: //TODO:
    1053         case HWND_NOTOPMOST: //TODO:
    1054         case HWND_TOP:
    1055                 hwndInsertAfter = HWNDOS_TOP;
    1056                 break;
    1057         default:
    1058                 window = GetWindowFromHandle(hwndInsertAfter);
    1059                 if(window) {
    1060                         hwndInsertAfter = window->getOS2WindowHandle();
    1061                 }
    1062                 else {
    1063                         dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
    1064                         hwndInsertAfter = 0;
    1065                 }
    1066                 break;
     1098    case HWND_BOTTOM:
     1099        hwndInsertAfter = HWNDOS_BOTTOM;
     1100        break;
     1101    case HWND_TOPMOST: //TODO:
     1102    case HWND_NOTOPMOST: //TODO:
     1103    case HWND_TOP:
     1104        hwndInsertAfter = HWNDOS_TOP;
     1105        break;
     1106    default:
     1107        window = GetWindowFromHandle(hwndInsertAfter);
     1108        if(window) {
     1109            hwndInsertAfter = window->getOS2WindowHandle();
     1110        }
     1111        else {
     1112            dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter));
     1113            hwndInsertAfter = 0;
     1114        }
     1115        break;
    10671116
    10681117  }
    10691118  setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER;
    10701119  if(fuFlags & SWP_DRAWFRAME)
    1071         setstate |= 0; //TODO
     1120    setstate |= 0; //TODO
    10721121  if(fuFlags & SWP_FRAMECHANGED)
    1073         setstate |= 0; //TODO
     1122    setstate |= 0; //TODO
    10741123  if(fuFlags & SWP_HIDEWINDOW)
    1075         setstate &= ~SWPOS_ZORDER;
     1124    setstate &= ~SWPOS_ZORDER;
    10761125  if(fuFlags & SWP_NOACTIVATE)
    1077         setstate &= ~SWPOS_ACTIVATE;
     1126    setstate &= ~SWPOS_ACTIVATE;
    10781127  if(fuFlags & SWP_NOCOPYBITS)
    1079         setstate |= 0;          //TODO
     1128    setstate |= 0;      //TODO
    10801129  if(fuFlags & SWP_NOMOVE)
    1081         setstate &= ~SWPOS_MOVE;
     1130    setstate &= ~SWPOS_MOVE;
    10821131  if(fuFlags & SWP_NOSIZE)
    1083         setstate &= ~SWPOS_SIZE;
     1132    setstate &= ~SWPOS_SIZE;
    10841133  if(fuFlags & SWP_NOREDRAW)
    1085         setstate |= SWPOS_NOREDRAW;
     1134    setstate |= SWPOS_NOREDRAW;
    10861135  if(fuFlags & SWP_NOZORDER)
    1087         setstate &= ~SWPOS_ZORDER;
     1136    setstate &= ~SWPOS_ZORDER;
    10881137  if(fuFlags & SWP_SHOWWINDOW)
    1089         setstate |= SWPOS_SHOW;
     1138    setstate |= SWPOS_SHOW;
    10901139
    10911140  return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
     
    11031152{
    11041153  if(getParent()) {
    1105         return getParent()->getWindowHandle();
     1154    return getParent()->getWindowHandle();
    11061155  }
    11071156  else  return 0;
     
    11201169
    11211170   if(hwndNewParent == 0) {//desktop window = parent
    1122         setParent(NULL);
     1171    setParent(NULL);
    11231172        OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
    11241173        return oldhwnd;
     
    11391188{
    11401189  if(getParent()) {
    1141         return getParent()->getWindowHandle() == hwndParent;
     1190    return getParent()->getWindowHandle() == hwndParent;
    11421191  }
    11431192  else  return 0;
     
    11561205BOOL Win32Window::UpdateWindow()
    11571206{
    1158    OSRECTL rect;
     1207 RECT rect;
    11591208
    11601209  if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    11611210  {//update region not empty
    1162         SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     1211    SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
    11631212  }
    11641213  return TRUE;
     
    11831232  switch(uCmd)
    11841233  {
    1185         case GW_CHILD:
    1186                 getcmd = QWOS_TOP;
    1187                 break;
    1188         case GW_HWNDFIRST:
    1189                 if(getParent()) {
    1190                         getcmd = QWOS_TOP; //top of child windows
    1191                 }
    1192                 else    getcmd = QWOS_TOP; //TODO
    1193                 break;
    1194         case GW_HWNDLAST:
    1195                 if(getParent()) {
    1196                         getcmd = QWOS_BOTTOM; //bottom of child windows
    1197                 }
    1198                 else    getcmd = QWOS_BOTTOM; //TODO
    1199                 break;
    1200         case GW_HWNDNEXT:
    1201                 getcmd = QWOS_NEXT;
    1202                 break;
    1203         case GW_HWNDPREV:
    1204                 getcmd = QWOS_PREV;
    1205                 break;
    1206         case GW_OWNER:
    1207                 if(owner) {
    1208                         return owner->getWindowHandle();
    1209                 }
    1210                 else    return 0;
     1234    case GW_CHILD:
     1235        getcmd = QWOS_TOP;
     1236        break;
     1237    case GW_HWNDFIRST:
     1238        if(getParent()) {
     1239            getcmd = QWOS_TOP; //top of child windows
     1240        }
     1241        else    getcmd = QWOS_TOP; //TODO
     1242        break;
     1243    case GW_HWNDLAST:
     1244        if(getParent()) {
     1245            getcmd = QWOS_BOTTOM; //bottom of child windows
     1246        }
     1247        else    getcmd = QWOS_BOTTOM; //TODO
     1248        break;
     1249    case GW_HWNDNEXT:
     1250        getcmd = QWOS_NEXT;
     1251        break;
     1252    case GW_HWNDPREV:
     1253        getcmd = QWOS_PREV;
     1254        break;
     1255    case GW_OWNER:
     1256        if(owner) {
     1257            return owner->getWindowHandle();
     1258        }
     1259        else    return 0;
    12111260  }
    12121261  hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
    12131262  if(hwndRelated)
    12141263  {
    1215         win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
    1216         magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
    1217         if(CheckMagicDword(magic) && win32wnd)
    1218         {
    1219                 return win32wnd->getWindowHandle();
    1220         }
     1264    win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
     1265    magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
     1266    if(CheckMagicDword(magic) && win32wnd)
     1267    {
     1268        return win32wnd->getWindowHandle();
     1269    }
    12211270  }
    12221271  return 0;
     
    12551304  if(CheckMagicDword(magic) && win32wnd)
    12561305  {
    1257         return win32wnd->getWindowHandle();
     1306    return win32wnd->getWindowHandle();
    12581307  }
    12591308  return hwndActive;
     
    13251374                return oldval;
    13261375        case GWL_HWNDPARENT:
    1327                 return SetParent((HWND)value);
     1376        return SetParent((HWND)value);
    13281377
    13291378        case GWL_ID:
     
    14101459
    14111460   if(HIWORD(hwnd) != 0x6800) {
    1412         return NULL;
     1461    return NULL;
    14131462   }
    14141463
    14151464   if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) {
    1416         return window;
     1465    return window;
    14171466   }
    14181467   else return NULL;
     
    14201469//******************************************************************************
    14211470//******************************************************************************
    1422 Win32Window *Win32Window::GetWindowFromOS2Handle(HWND hwnd)
    1423 {
    1424    ULONG winHandle;
    1425    Win32Window *window;
    1426 
    1427    //CB: returns index, not handle!
    1428    if(HMHandleTranslateToWin(hwnd,(PULONG)&winHandle) == NO_ERROR)
    1429    {
    1430      if (HMHandleTranslateToOS2(LOWORD(winHandle),(PULONG)&window) == NO_ERROR)
    1431      {
    1432        return window;
    1433      } else return NULL;
    1434    } else return NULL;
    1435 }
    1436 //******************************************************************************
    1437 //******************************************************************************
    14381471GenericObject *Win32Window::windows  = NULL;
  • trunk/src/user32/new/win32wnd.h

    r327 r328  
    1 /* $Id: win32wnd.h,v 1.9 1999-07-18 13:57:48 cbratschi Exp $ */
     1/* $Id: win32wnd.h,v 1.10 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    2121class Win32Window;
    2222
    23 #define OFFSET_WIN32WNDPTR      0
    24 #define OFFSET_WIN32PM_MAGIC    4
    25 
    26 #define WIN32PM_MAGIC           0x12345678
    27 #define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
     23#define OFFSET_WIN32WNDPTR      0
     24#define OFFSET_WIN32PM_MAGIC    4
     25
     26#define WIN32PM_MAGIC           0x12345678
     27#define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
    2828
    2929typedef struct {
    30         USHORT          cb;
    31         Win32Window    *win32wnd;
    32         ULONG           win32CreateStruct;      //or dialog create dword
     30        USHORT          cb;
     31        Win32Window    *win32wnd;
     32        ULONG           win32CreateStruct;      //or dialog create dword
    3333} CUSTOMWNDDATA;
    3434
    3535typedef struct
    3636{
    37         ULONG           Msg;
    38         ULONG           wParam;
    39         ULONG           lParam;
     37        ULONG           Msg;
     38        ULONG           wParam;
     39        ULONG           lParam;
    4040} POSTMSG_PACKET;
    4141
    42 #define WM_WIN32_POSTMESSAGEA   0x4000
    43 #define WM_WIN32_POSTMESSAGEW   0x4001
     42#define WM_WIN32_POSTMESSAGEA   0x4000
     43#define WM_WIN32_POSTMESSAGEW   0x4001
    4444
    4545class Win32Window : private GenericObject, private ChildWindow
    4646{
    4747public:
    48         DWORD   magic;
    49 
    50                 Win32Window(DWORD objType);
    51                 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
     48        DWORD   magic;
     49
     50                Win32Window(DWORD objType);
     51                Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    5252virtual        ~Win32Window();
    5353
    5454virtual  ULONG  MsgCreate(HWND hwndOS2, ULONG initParam);
    55         ULONG  MsgQuit();
    56         ULONG  MsgClose();
     55        ULONG  MsgQuit();
     56        ULONG  MsgClose();
    5757         ULONG  MsgDestroy();
    58          ULONG  MsgEnable(BOOL fEnable);
    59          ULONG  MsgShow(BOOL fShow);
    60          ULONG  MsgMove(ULONG xParent, ULONG yParent);
    61          ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
     58         ULONG  MsgEnable(BOOL fEnable);
     59         ULONG  MsgShow(BOOL fShow);
     60         ULONG  MsgMove(ULONG x, ULONG y);
     61         ULONG  MsgHitTest(ULONG x, ULONG y);
     62         ULONG  MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
    6263         ULONG  MsgActivate(BOOL fActivate, HWND hwnd);
    63         ULONG  MsgSetFocus(HWND hwnd);
    64         ULONG  MsgKillFocus(HWND hwnd);
    65         ULONG  MsgButton(ULONG msg, ULONG x, ULONG y);
    66          ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
    67          ULONG  MsgEraseBackGround(ULONG hps);
    68          ULONG  MsgSetText(LPSTR lpsz, LONG cch);
    69 
    70 virtual  LONG   SetWindowLongA(int index, ULONG value);
    71 virtual  ULONG  GetWindowLongA(int index);
    72 virtual  WORD   SetWindowWord(int index, WORD value);
    73 virtual  WORD   GetWindowWord(int index);
    74 
    75          DWORD  getStyle()                      { return dwStyle; };
    76          DWORD  getExStyle()                    { return dwExStyle; };
    77          HWND   getWindowHandle()               { return Win32Hwnd; };
    78          HWND   getOS2WindowHandle()            { return OS2Hwnd; };
    79    Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
    80          void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
    81 
     64        ULONG  MsgSetFocus(HWND hwnd);
     65        ULONG  MsgKillFocus(HWND hwnd);
     66        ULONG  MsgButton(ULONG msg, ULONG x, ULONG y);
     67         ULONG  MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
     68         ULONG  MsgPaint(ULONG tmp1, ULONG tmp2);
     69         ULONG  MsgEraseBackGround(ULONG hps);
     70         ULONG  MsgSetText(LPSTR lpsz, LONG cch);
     71
     72virtual  LONG   SetWindowLongA(int index, ULONG value);
     73virtual  ULONG  GetWindowLongA(int index);
     74virtual  WORD   SetWindowWord(int index, WORD value);
     75virtual  WORD   GetWindowWord(int index);
     76
     77         DWORD  getStyle()                      { return dwStyle; };
     78         DWORD  getExStyle()                    { return dwExStyle; };
     79         HWND   getWindowHandle()               { return Win32Hwnd; };
     80         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
     81   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
     82         void   setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
    8283       WNDPROC  getWindowProc()                 { return win32wndproc; };
    8384         void   setWindowProc(WNDPROC newproc)  { win32wndproc = newproc; };
     
    8586         void   setWindowId(DWORD id)           { windowId = id; };
    8687
    87          DWORD  getFlags()                      { return flags; };
    88          void   setFlags(DWORD newflags)        { flags = newflags; };
    89 
    90         BOOL   SetMenu(ULONG hMenu);
    91         BOOL   ShowWindow(ULONG nCmdShow);
    92         BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
    93         BOOL   DestroyWindow();
    94         HWND   SetActiveWindow();
    95         HWND   GetParent();
    96         HWND   SetParent(HWND hwndNewParent);
    97         BOOL   IsChild(HWND hwndParent);
    98         HWND   GetTopWindow();
    99         BOOL   UpdateWindow();
    100         BOOL   IsIconic();
     88         DWORD  getFlags()                      { return flags; };
     89         void   setFlags(DWORD newflags)        { flags = newflags; };
     90
     91        BOOL   SetMenu(ULONG hMenu);
     92        BOOL   ShowWindow(ULONG nCmdShow);
     93        BOOL   SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
     94        BOOL   DestroyWindow();
     95        HWND   SetActiveWindow();
     96        HWND   GetParent();
     97        HWND   SetParent(HWND hwndNewParent);
     98        BOOL   IsChild(HWND hwndParent);
     99        HWND   GetTopWindow();
     100        BOOL   UpdateWindow();
     101        BOOL   IsIconic();
    101102         HWND   GetWindow(UINT uCmd);
    102         BOOL   EnableWindow(BOOL fEnable);
    103          BOOL   BringWindowToTop();
     103        BOOL   EnableWindow(BOOL fEnable);
     104         BOOL   BringWindowToTop();
    104105  static HWND   GetActiveWindow();
    105 
    106          BOOL   IsWindow();
    107          BOOL   IsWindowEnabled();
    108          BOOL   IsWindowVisible();
    109 
    110          BOOL   GetWindowRect(PRECT pRect);
    111          int    GetWindowTextLengthA();
    112          int    GetWindowTextA(LPSTR lpsz, int cch);
    113          BOOL   SetWindowTextA(LPCSTR lpsz);
     106         BOOL   IsWindow();
     107         BOOL   IsWindowEnabled();
     108         BOOL   IsWindowVisible();
     109
     110         BOOL   GetWindowRect(PRECT pRect);
     111         int    GetWindowTextLengthA();
     112         int    GetWindowTextA(LPSTR lpsz, int cch);
     113         BOOL   SetWindowTextA(LPCSTR lpsz);
    114114
    115115       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     
    125125
    126126static Win32Window *GetWindowFromHandle(HWND hwnd);
    127 static Win32Window *GetWindowFromOS2Handle(HWND hwnd);
    128127
    129128protected:
    130129       LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
    131130       LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
    132         void    Init();
    133 
    134         HWND    OS2Hwnd;
    135         HWND    OS2HwndFrame;
    136         HWND    OS2HwndMenu;
    137         HWND    Win32Hwnd;
    138         BOOL    isUnicode;
    139 
    140         int     posx, posy, width, height;
    141 
    142         // values normally contained in the standard window words
    143         ULONG   dwExStyle;              //GWL_EXSTYLE
    144         ULONG   dwStyle;                //GWL_STYLE
    145       WNDPROC   win32wndproc;           //GWL_WNDPROC
    146         ULONG   hInstance;              //GWL_HINSTANCE
     131        void    Init();
     132
     133        HWND    OS2Hwnd;
     134        HWND    OS2HwndFrame;
     135        HWND    OS2HwndMenu;
     136        HWND    Win32Hwnd;
     137        BOOL    isUnicode;
     138
     139        int     posx, posy, width, height;
     140
     141        // values normally contained in the standard window words
     142        ULONG   dwExStyle;              //GWL_EXSTYLE
     143        ULONG   dwStyle;                //GWL_STYLE
     144      WNDPROC   win32wndproc;           //GWL_WNDPROC
     145        ULONG   hInstance;              //GWL_HINSTANCE
    147146//Moved in ChildWindow class
    148 /////   Win32Window *parent;                    //GWL_HWNDPARENT
    149         ULONG   windowId;               //GWL_ID
    150         ULONG   userData;               //GWL_USERDATA
     147/////   Win32Window *parent;                    //GWL_HWNDPARENT
     148        ULONG   windowId;               //GWL_ID
     149        ULONG   userData;               //GWL_USERDATA
    151150
    152151         HWND   hwndLinkAfter;
    153152        DWORD   flags;
    154 
    155         BOOL    isIcon;
    156 
    157    Win32Window *owner;
    158 
    159         char   *windowName;
    160         ULONG   wndNameLength;
    161 
    162         char   *windowText;
    163         ULONG   wndTextLength;
    164 
    165         ULONG  *userWindowLong;
    166         ULONG   nrUserWindowLong;
    167 
    168         RECT    rectWindow;
    169         RECT    rectClient;
     153        DWORD   lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
     154
     155        BOOL    isIcon;
     156
     157   Win32Window *owner;                 
     158
     159        char   *windowName;
     160        ULONG   wndNameLength;
     161
     162        char   *windowText;
     163        ULONG   wndTextLength;
     164       
     165        ULONG  *userWindowLong;
     166        ULONG   nrUserWindowLong;
     167
     168        RECT    rectWindow;
     169        RECT    rectClient;
    170170
    171171Win32WndClass  *windowClass;
     
    175175private:
    176176#ifndef OS2_INCLUDED
    177         BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
    178 
    179         void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    180 
    181         LONG  SendNCCalcSize(BOOL calcValidRect,
     177        BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
     178
     179        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
     180
     181        LONG  SendNCCalcSize(BOOL calcValidRect,
    182182                             RECT *newWindowRect, RECT *oldWindowRect,
    183183                             RECT *oldClientRect, WINDOWPOS *winpos,
     
    186186     LRESULT  SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
    187187     {
    188         if(isUnicode)
    189                 return SendInternalMessageW(msg, wParam, lParam);
    190         else    return SendInternalMessageA(msg, wParam, lParam);
     188        if(isUnicode)
     189                return SendInternalMessageW(msg, wParam, lParam);
     190        else    return SendInternalMessageA(msg, wParam, lParam);
    191191     }
    192192#endif
     
    194194
    195195
    196 #define BUTTON_LEFTDOWN         0
    197 #define BUTTON_LEFTUP           1
    198 #define BUTTON_LEFTDBLCLICK     2
    199 #define BUTTON_RIGHTUP          3
    200 #define BUTTON_RIGHTDOWN        4
    201 #define BUTTON_RIGHTDBLCLICK    5
     196#define BUTTON_LEFTDOWN         0
     197#define BUTTON_LEFTUP           1
     198#define BUTTON_LEFTDBLCLICK     2
     199#define BUTTON_RIGHTUP          3
     200#define BUTTON_RIGHTDOWN        4
     201#define BUTTON_RIGHTDBLCLICK    5
     202#define BUTTON_MIDDLEUP         6
     203#define BUTTON_MIDDLEDOWN       7
     204#define BUTTON_MIDDLEDBLCLICK   8
     205
     206#define WMMOVE_LBUTTON          1
     207#define WMMOVE_MBUTTON          2
     208#define WMMOVE_RBUTTON          4
     209#define WMMOVE_CTRL             8
     210#define WMMOVE_SHIFT            16
     211
    202212
    203213#endif //__cplusplus
  • trunk/src/user32/new/wingdi.cpp

    r327 r328  
    1 /* $Id: wingdi.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */
     1/* $Id: wingdi.cpp,v 1.3 1999-07-18 14:39:35 sandervl Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    2323{
    2424  Win32Window *window;
    25   OSRECTL rect;
    2625
    2726   window = Win32Window::GetWindowFromHandle(hwnd);
    2827   if(!window) {
    29         dprintf(("GetDC, window %x not found", hwnd));
    30         return 0;
     28        dprintf(("GetDC, window %x not found", hwnd));
     29        return 0;
    3130   }
    3231   dprintf(("BeginPaint %X\n", hwnd));
    33    if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &rect) == FALSE)
     32   if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &lps->rcPaint) == FALSE)
    3433   {
    35         dprintf(("BeginPaint, NO update rectl"));
    36         return 0;
     34        dprintf(("BeginPaint, NO update rectl"));
     35        return 0;
    3736   }
    38    MapOS2ToWin32Rectl(window->getOS2WindowHandle(),(PRECTLOS2)&rect,&lps->rcPaint);
    3937   lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint);
    4038
     
    5755   window = Win32Window::GetWindowFromHandle(hwnd);
    5856   if(!window) {
    59         dprintf(("GetDC, window %x not found", hwnd));
    60         return 0;
     57        dprintf(("GetDC, window %x not found", hwnd));
     58        return 0;
    6159   }
    6260   dprintf(("GetDC %x", hwnd));
Note: See TracChangeset for help on using the changeset viewer.