Changeset 2204 for trunk/src/user32


Ignore:
Timestamp:
Dec 26, 1999, 6:30:20 PM (26 years ago)
Author:
cbratschi
Message:

non-client fixes, DefWndProc enhancements, several other bugs fixed

Location:
trunk/src/user32
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/USER32.DEF

    r1971 r2204  
    1 ; $Id: USER32.DEF,v 1.22 1999-12-05 00:31:46 sandervl Exp $
     1; $Id: USER32.DEF,v 1.23 1999-12-26 17:30:13 cbratschi Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    633633; Wine/Odin helper function
    634634    GetSysColorPen              = _GetSysColorPen@4              @2002
    635     TrackWin32Window            = _TrackWin32Window@8            @2003
    636635
    637636    Win32ToOS2Handle__FUl      = Win32ToOS2Handle__15Win32BaseWindowFUl @2006
  • trunk/src/user32/button.cpp

    r2185 r2204  
    1 /* $Id: button.cpp,v 1.24 1999-12-21 17:03:42 cbratschi Exp $ */
     1/* $Id: button.cpp,v 1.25 1999-12-26 17:30:14 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    219219  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    220220  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    221 
     221  DWORD style = dwStyle & 0x0F;
     222
     223  if (style == BS_GROUPBOX) return 0;
    222224  SetCapture(hwnd);
    223225  SetFocus(hwnd);
     
    234236  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    235237  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     238  DWORD style = dwStyle & 0x0F;
    236239  RECT rect;
    237240  POINT pt;
    238241
     242  if (style == BS_GROUPBOX) return 0;
    239243  pt.x = LOWORD(lParam);
    240244  pt.y = HIWORD(lParam);
     
    460464static LRESULT BUTTON_SetStyle(HWND hwnd,WPARAM wParam,LPARAM lParam)
    461465{
    462   DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     466  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE),newStyle;
    463467
    464468  if ((wParam & 0x0f) >= MAX_BTN_TYPE) return 0;
    465   dwStyle = (dwStyle & 0xfffffff0) | (wParam & 0x0000000f);
    466   SetWindowLongA(hwnd,GWL_STYLE,dwStyle);
    467   PAINT_BUTTON(hwnd,dwStyle & 0x0f,ODA_DRAWENTIRE);
     469  newStyle = (dwStyle & 0xfffffff0) | (wParam & 0x0000000f);
     470
     471  if (newStyle != dwStyle)
     472  {
     473    SetWindowLongA(hwnd,GWL_STYLE,newStyle);
     474    PAINT_BUTTON(hwnd,newStyle & 0x0f,ODA_DRAWENTIRE);
     475  }
    468476
    469477  return 0;
     
    542550{
    543551  BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd);
    544   DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0f;
     552  DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & 0x0F;
    545553
    546554  if (wParam)
  • trunk/src/user32/edit.cpp

    r2185 r2204  
    1 /* $Id: edit.cpp,v 1.24 1999-12-21 17:03:43 cbratschi Exp $ */
     1/* $Id: edit.cpp,v 1.25 1999-12-26 17:30:14 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    176176static void     EDIT_MoveWordForward(HWND hwnd, EDITSTATE *es, BOOL extend);
    177177static void     EDIT_PaintLine(HWND hwnd, EDITSTATE *es, HDC hdc, INT line, BOOL rev);
    178 static INT      EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
     178static VOID     EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
    179179static void     EDIT_SetCaretPos(HWND hwnd, EDITSTATE *es, INT pos, BOOL after_wrap);
    180180static void     EDIT_SetRectNP(HWND hwnd, EDITSTATE *es, LPRECT lprc);
     
    16331633 *
    16341634 */
    1635 static INT EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
     1635static VOID EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
    16361636{
    16371637        COLORREF BkColor;
    16381638        COLORREF TextColor;
    1639         INT ret;
    16401639        INT li;
    16411640
    16421641        if (!count)
    1643                 return 0;
     1642                return;
    16441643        BkColor = GetBkColor(dc);
    16451644        TextColor = GetTextColor(dc);
     
    16521651        if (es->style & ES_MULTILINE)
    16531652        {
    1654                 ret = (INT)LOWORD(TabbedTextOutA(dc, x, y, es->text + li + col, count,
    1655                                         es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
     1653                TabbedTextOutA(dc, x, y, es->text + li + col, count,
     1654                               es->tabs_count, es->tabs, es->format_rect.left - es->x_offset);
    16561655        } else
    16571656        {
    16581657          LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
    16591658          POINT pt;
    1660           UINT oldAlign = GetTextAlign(dc);
    1661 
    1662           MoveToEx(dc,x,y,NULL);
    1663           SetTextAlign(dc,(oldAlign & ~TA_NOUPDATECP) | TA_UPDATECP);
    16641659
    16651660          TextOutA(dc,x,y,text+li+col,count);
    1666           GetCurrentPositionEx(dc,&pt);
    1667           SetTextAlign(dc,oldAlign);
    1668           ret = pt.x-x;
    16691661          if (es->style & ES_PASSWORD)
    16701662            HeapFree(es->heap, 0, text);
     
    16751667                SetTextColor(dc, TextColor);
    16761668        }
    1677         return ret;
    16781669}
    16791670
     
    17151706{
    17161707        CopyRect(&es->format_rect, rc);
    1717         if (es->style & WS_BORDER) {
    1718                 INT bw = GetSystemMetrics(SM_CXBORDER) + 1;
    1719                 es->format_rect.left += bw;
    1720                 es->format_rect.top += bw;
    1721                 es->format_rect.right -= bw;
    1722                 es->format_rect.bottom -= bw;
     1708        if (es->style & WS_BORDER)
     1709        {
     1710          INT bw = GetSystemMetrics(SM_CXBORDER)+1,bh = GetSystemMetrics(SM_CYBORDER)+1;
     1711
     1712          es->format_rect.left += bw;
     1713          es->format_rect.top += bh;
     1714          es->format_rect.right -= bw;
     1715          es->format_rect.bottom -= bh;
    17231716        }
    17241717        es->format_rect.left += es->left_margin;
     
    27452738        ORDER_UINT(start, old_start);
    27462739        ORDER_UINT(old_start, old_end);
     2740        if (start == old_start && end == old_end) return;
    27472741        if (end != old_start)
    27482742        {
  • trunk/src/user32/oslibmsgtranslate.cpp

    r2200 r2204  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.1 1999-12-24 18:42:46 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.2 1999-12-26 17:30:15 cbratschi Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    283283        if(win32wnd->lastHitTestVal != HTCLIENT_W) {
    284284            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     285            winMsg->wParam = win32wnd->lastHitTestVal;
    285286            winMsg->lParam  = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates
    286287        }
     
    324325
    325326        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    326         if(win32wnd->lastHitTestVal != HTCLIENT_W) {
    327                 setcursormsg   = WINWM_NCMOUSEMOVE;
    328                 winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
    329         }
    330         else    winMsg->wParam = (WPARAM)keystate;
     327        if(win32wnd->lastHitTestVal != HTCLIENT_W)
     328        {
     329          setcursormsg   = WINWM_NCMOUSEMOVE;
     330          winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
     331          winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     332        } else
     333        {
     334          winMsg->wParam = (WPARAM)keystate;
     335          winMsg->lParam  = MAKELONG(SHORT1FROMMP(os2Msg->mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(os2Msg->mp1)));
     336        }
    331337        //OS/2 Window coordinates -> Win32 Window coordinates
    332338        winMsg->message = setcursormsg;
    333         winMsg->lParam  = MAKELONG(SHORT1FROMMP(os2Msg->mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(os2Msg->mp1)));
    334339        break;
    335340    }
    336341
    337342    case WM_CONTROL:
     343      goto dummymessage;
     344
    338345    case WM_COMMAND:
    339346        if(SHORT1FROMMP(os2Msg->mp2) == CMDSRC_MENU) {
     
    511518          }
    512519        }
    513         goto dummymessage;
     520        goto dummymessage; //for caret blinking
    514521
    515522    case WM_SETWINDOWPARAMS:
     
    556563
    557564    case WM_HITTEST:
    558         // Only send this message if the window is enabled
    559         if (WinIsWindowEnabled(os2Msg->hwnd))
    560         {
    561             OSLIBPOINT pt;
    562             pt.x = (*(POINTS *)&os2Msg->mp1).x;
    563             pt.y = (*(POINTS *)&os2Msg->mp1).y;
    564             MapOS2ToWin32Point( OSLIB_HWND_DESKTOP, os2Msg->hwnd, &pt);
    565             winMsg->message = WINWM_NCHITTEST;
    566             winMsg->lParam  = MAKELONG((USHORT)pt.x, (USHORT)pt.y);
    567             break;
    568         }
    569         goto dummymessage;
     565    {
     566        OSLIBPOINT pt;
     567
     568        pt.x = (*(POINTS *)&os2Msg->mp1).x;
     569        pt.y = (*(POINTS *)&os2Msg->mp1).y;
     570
     571        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP,os2Msg->hwnd,&pt);
     572        winMsg->message = WINWM_NCHITTEST;
     573        winMsg->wParam  = 0;
     574        winMsg->lParam  = MAKELONG((USHORT)pt.x, (USHORT)pt.y);
     575        break;
     576    }
    570577
    571578    case WM_CONTEXTMENU:
  • trunk/src/user32/oslibutil.cpp

    r949 r2204  
    1 /* $Id: oslibutil.cpp,v 1.1 1999-09-15 23:18:54 sandervl Exp $ */
     1/* $Id: oslibutil.cpp,v 1.2 1999-12-26 17:30:15 cbratschi Exp $ */
    22/*
    33 * Window API utility functions for OS/2
     
    2424  if(thdb)
    2525  {
    26         return (HAB)thdb->hab;
     26        return (HAB)thdb->hab;
    2727  }
    2828
     
    3939  if(thdb)
    4040  {
    41         thdb->hab = (ULONG)hab;
     41        thdb->hab = (ULONG)hab;
    4242  }
    43   else  dprintf(("SetThreadHAB: thdb == NULL!!"));
     43  else  dprintf(("SetThreadHAB: thdb == NULL!!"));
    4444}
    4545//******************************************************************************
     
    5252  if(thdb)
    5353  {
    54         return (HMQ)thdb->hmq;
     54        return (HMQ)thdb->hmq;
    5555  }
    5656
     
    6767  if(thdb)
    6868  {
    69         thdb->hmq = (ULONG)hmq;
     69        thdb->hmq = (ULONG)hmq;
    7070  }
    71   else  dprintf(("SetThreadMessageQueue: thdb == NULL!!"));
     71  else  dprintf(("SetThreadMessageQueue: thdb == NULL!!"));
    7272}
    7373//******************************************************************************
    7474//******************************************************************************
     75DWORD GetThreadMessageExtraInfo()
     76{
     77 THDB *thdb;
     78
     79  thdb = GetThreadTHDB();
     80  if(thdb)
     81  {
     82        return thdb->lParam;
     83  }
     84
     85  dprintf(("GetThreadMessageExtraInfo: thdb == NULL!!"));
     86  return 0;
     87}
     88//******************************************************************************
     89//******************************************************************************
     90DWORD SetThreadMessageExtraInfo(DWORD lParam)
     91{
     92 THDB *thdb;
     93
     94  thdb = GetThreadTHDB();
     95  if(thdb)
     96  {
     97        thdb->lParam = lParam;
     98  }
     99  else  dprintf(("SetThreadMessageExtraInfo: thdb == NULL!!"));
     100  return 0;
     101}
  • trunk/src/user32/oslibutil.h

    r949 r2204  
    1 /* $Id: oslibutil.h,v 1.1 1999-09-15 23:18:54 sandervl Exp $ */
     1/* $Id: oslibutil.h,v 1.2 1999-12-26 17:30:15 cbratschi Exp $ */
    22/*
    33 * Window API utility functions for OS/2
     
    2424void  SetThreadMessageQueue(HMQ hmq);
    2525
     26DWORD GetThreadMessageExtraInfo();
     27DWORD SetThreadMessageExtraInfo(DWORD lParam);
     28
    2629#endif //__OSLIBUTIL_H__
  • trunk/src/user32/oslibwin.cpp

    r2201 r2204  
    1 /* $Id: oslibwin.cpp,v 1.51 1999-12-24 18:51:55 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.52 1999-12-26 17:30:15 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    11961196//******************************************************************************
    11971197//******************************************************************************
     1198BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable)
     1199{
     1200  return WinEnableWindowUpdate(hwnd,fEnable);
     1201}
  • trunk/src/user32/oslibwin.h

    r1983 r2204  
    1 /* $Id: oslibwin.h,v 1.27 1999-12-05 16:37:58 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.28 1999-12-26 17:30:16 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    285285BOOL  OSLibWinSetKeyboardStateTable(unsigned char * PMKeyState);
    286286
     287#define HTOS_NORMAL                   0
     288#define HTOS_TRANSPARENT              (-1)
     289#define HTOS_DISCARD                  (-2)
     290#define HTOS_ERROR                    (-3)
     291
     292BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable);
     293
    287294#endif //__OSLIBWIN_H__
  • trunk/src/user32/pmframe.cpp

    r2200 r2204  
    1 /* $Id: pmframe.cpp,v 1.29 1999-12-24 18:39:10 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.30 1999-12-26 17:30:16 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    203203//******************************************************************************
    204204//******************************************************************************
    205 void FrameTrackFrame(Win32BaseWindow *win32wnd,BOOL lefttop)
    206 {
    207   INT flags = lefttop ? (TF_LEFT | TF_TOP):(TF_RIGHT | TF_BOTTOM);
    208 
    209   WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_TRACKFRAME,(MPARAM)flags,(MPARAM)0);
    210 }
    211 //******************************************************************************
    212 // used by statusbar control
    213 //******************************************************************************
    214 VOID WINAPI TrackWin32Window(HWND hwnd,BOOL lefttop)
    215 {
    216   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    217   INT flags = lefttop ? (TF_LEFT | TF_TOP):(TF_RIGHT | TF_BOTTOM);
    218 
    219   if (!win32wnd) return;
    220 
     205VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags)
     206{
    221207  WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_TRACKFRAME,(MPARAM)flags,(MPARAM)0);
    222208}
     
    319305      WINDOWPOS wp;
    320306      HWND      hParent = NULLHANDLE;
    321       LONG      yDelta = pswp->cy - swpOld.cy;
    322       LONG      xDelta = pswp->cx - swpOld.cx;
    323       LONG      clientHeight;
    324307
    325308        dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    326 
    327         //Save height so WM_WINDOWPOSCHANGED handler in pmwindow.cpp
    328         //(for client) doesn't overwrite the client rectangle (breaks ydelta calculation)
    329         clientHeight = win32wnd->getWindowHeight();
    330309
    331310        RestoreOS2TIB();
    332311        rc = OldFrameProc(hwnd,msg,mp1,mp2);
    333312        SetWin32TIB();
    334 
    335         if (win32wnd->getParent() && win32wnd->getParent()->InMovingChildren())
    336           goto PosChangedEnd; //same Win32 pos, only OS/2 pos changed
    337313
    338314        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
     
    349325        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    350326
    351         //delta is difference between old and new client height
    352         yDelta = swpOld.cy - clientHeight;
    353 
    354327        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    355328        win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    356329
    357         wp.hwnd = win32wnd->getWindowHandle();
    358         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    359         {
    360            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    361            if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
    362         }
    363 
    364 #if 0 //CB: PM does it now for us (-> WM_CALVALIDRECTS)
    365       //    if you remove this code, delete *MovingChildren in Win32BaseWindow class
    366         if (yDelta != 0 || xDelta != 0)
    367         {
    368             HENUM henum = WinBeginEnumWindows(WinWindowFromID(hwnd,FID_CLIENT));
    369             SWP swp[10];
    370             int i = 0;
    371             HWND hwnd;
    372 
    373             win32wnd->setMovingChildren(TRUE);
    374             while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
    375             {
    376                 WinQueryWindowPos(hwnd, &(swp[i]));
    377 
    378 #ifdef DEBUG
    379                 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    380                 dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
    381                          yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
    382 #endif
    383 
    384                 //if(swp[i].y != 0) //CB: y value of 0 is valid!
    385                 {
    386                     //child window at offset <> 0 from client area -> offset now changes
    387                     swp[i].y  += yDelta;
    388                     swp[i].fl = SWP_MOVE | SWP_NOADJUST;
    389                 }
    390                 //else child window with the same start coordinates as the client area
    391                 //The app should resize it.
    392 
    393                if (i == 9)
    394                 {
    395                     WinSetMultWindowPos(GetThreadHAB(), swp, 10);
    396                     i = 0;
    397                 }
    398                 else
    399                 {
    400                     i++;
    401                 }
    402             }
    403 
    404             WinEndEnumWindows(henum);
    405 
    406             if (i)
    407                WinSetMultWindowPos(GetThreadHAB(), swp, i);
    408             win32wnd->setMovingChildren(FALSE);
    409         }
    410         if (yDelta != 0)
    411         {
    412             POINT pt;
    413             if(GetCaretPos (&pt) == TRUE)
    414             {
    415                 pt.y -= yDelta;
    416                 SetCaretPos (pt.x, pt.y);
    417             }
    418         }
    419 #endif
    420         if(!win32wnd->CanReceiveSizeMsgs())
    421             goto PosChangedEnd;
    422 
    423         win32wnd->MsgPosChanged((LPARAM)&wp);
     330        if(win32wnd->CanReceiveSizeMsgs())
     331          win32wnd->MsgPosChanged((LPARAM)&wp);
    424332
    425333PosChangedEnd:
     
    703611}
    704612
     613DWORD FrameHitTest(Win32BaseWindow *win32wnd,INT x,INT y)
     614{
     615  POINTL point;
     616  HWND hwnd = win32wnd->getOS2FrameWindowHandle(),child;
     617
     618  if (hwnd == win32wnd->getOS2WindowHandle()) return HTCLIENT_W;
     619  if (win32wnd->getOS2WindowHandle() == WinQueryCapture(HWND_DESKTOP)) return HTCLIENT_W;
     620  point.x = x;
     621  point.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-y-1;
     622  WinMapWindowPoints(HWND_DESKTOP,hwnd,&point,1);
     623  child = WinWindowFromPoint(hwnd,&point,FALSE);
     624
     625  if (child == 0) return HTERROR_W;
     626  if (child == win32wnd->getOS2FrameWindowHandle())
     627  {
     628    RECTL client,frame;
     629
     630    if (CanDrawSizeBox(win32wnd))
     631    {
     632      RECTL rect;
     633
     634      GetSizeBox(win32wnd,&rect);
     635      if (WinPtInRect(GetThreadHAB(),&rect,&point)) return HTGROWBOX_W;
     636    }
     637    //somewhere in the border
     638    INT w = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
     639    INT h = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
     640    WinQueryWindowRect(hwnd,&frame);
     641
     642    if (point.y < h)
     643    {
     644      if (point.x < w) return HTBOTTOMLEFT_W;
     645      if (point.x > frame.xRight-1-w) return HTBOTTOMRIGHT_W;
     646      return HTBOTTOM_W;
     647    }
     648    if (point.y > frame.yTop-1-h)
     649    {
     650      if (point.x < w) return HTTOPLEFT_W;
     651      if (point.x > frame.xRight-1-w) return HTTOPRIGHT_W;
     652      return HTTOP_W;
     653    }
     654    return HTBORDER_W;
     655  } else
     656  {
     657    if (child == WinWindowFromID(hwnd,FID_CLIENT)) return HTCLIENT_W;
     658    if (child == WinWindowFromID(hwnd,FID_VERTSCROLL)) return HTVSCROLL_W;
     659    if (child == WinWindowFromID(hwnd,FID_HORZSCROLL)) return HTHSCROLL_W;
     660    if (child == WinWindowFromID(hwnd,FID_SYSMENU)) return HTSYSMENU_W;
     661    if (child == WinWindowFromID(hwnd,FID_TITLEBAR)) return HTCAPTION_W;
     662    if (child == WinWindowFromID(hwnd,FID_MENU)) return HTMENU_W;
     663    if (child == WinWindowFromID(hwnd,FID_MINMAX))
     664    {
     665      //CB: close, reduce or zoom
     666      return HTZOOM_W;
     667    }
     668
     669    return HTERROR_W;
     670  }
     671}
  • trunk/src/user32/pmframe.h

    r1693 r2204  
    1 /* $Id: pmframe.h,v 1.4 1999-11-10 17:11:30 cbratschi Exp $ */
     1/* $Id: pmframe.h,v 1.5 1999-12-26 17:30:16 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    1818VOID  FrameUpdateFrame(Win32BaseWindow *win32wnd,DWORD flags);
    1919
     20#define HTERROR_W             (-2)
     21#define HTTRANSPARENT_W       (-1)
     22#define HTNOWHERE_W           0
     23#define HTCLIENT_W            1
     24#define HTCAPTION_W           2
     25#define HTSYSMENU_W           3
     26#define HTSIZE_W              4
     27#define HTMENU_W              5
     28#define HTHSCROLL_W           6
     29#define HTVSCROLL_W           7
     30#define HTMINBUTTON_W         8
     31#define HTMAXBUTTON_W         9
     32#define HTLEFT_W              10
     33#define HTRIGHT_W             11
     34#define HTTOP_W               12
     35#define HTTOPLEFT_W           13
     36#define HTTOPRIGHT_W          14
     37#define HTBOTTOM_W            15
     38#define HTBOTTOMLEFT_W        16
     39#define HTBOTTOMRIGHT_W       17
     40#define HTBORDER_W            18
     41#define HTGROWBOX_W           HTSIZE_W
     42#define HTREDUCE_W            HTMINBUTTON_W
     43#define HTZOOM_W              HTMAXBUTTON_W
     44#define HTOBJECT_W            19
     45#define HTCLOSE_W             20
     46#define HTHELP_W              21
     47#define HTSIZEFIRST_W         HTLEFT_W
     48#define HTSIZELAST_W          HTBOTTOMRIGHT_W
     49
     50DWORD FrameHitTest(Win32BaseWindow *win32wnd,INT x,INT y);
     51
     52#define TFOS_LEFT                    0x0001
     53#define TFOS_TOP                     0x0002
     54#define TFOS_RIGHT                   0x0004
     55#define TFOS_BOTTOM                  0x0008
     56/* TF_MOVE = TF_LEFT | TF_TOP | TF_RIGHT | TF_BOTTOM */
     57#define TFOS_MOVE                    0x000F
     58
     59VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags);
     60
    2061#endif
  • trunk/src/user32/pmwindow.cpp

    r2200 r2204  
    1 /* $Id: pmwindow.cpp,v 1.69 1999-12-24 18:39:10 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.70 1999-12-26 17:30:16 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    136136 Win32BaseWindow *win32wnd;
    137137 THDB            *thdb;
    138  APIRET           rc;
     138 APIRET           rc = 0;
    139139 MSG              winMsg, *pWinMsg;
    140140
     
    175175  if(msg == WIN32APP_POSTMSG && (ULONG)mp1 == WIN32PM_MAGIC) {
    176176        //win32 app user message
    177         return (MRESULT)win32wnd->PostMessage((POSTMSG_PACKET *)mp2);;
     177        return (MRESULT)win32wnd->PostMessage((POSTMSG_PACKET *)mp2);
    178178  }
    179179  switch( msg )
     
    203203    case WM_QUIT:
    204204        dprintf(("OS2: WM_QUIT %x", hwnd));
    205         if(win32wnd->MsgQuit()) {
    206                 goto RunDefWndProc;
    207         }
     205        win32wnd->MsgQuit();
    208206        break;
    209207
    210208    case WM_CLOSE:
    211209        dprintf(("OS2: WM_CLOSE %x", hwnd));
    212         if(win32wnd->MsgClose()) {
    213                 goto RunDefWndProc;
    214         }
     210        win32wnd->MsgClose();
    215211        break;
    216212
    217213    case WM_DESTROY:
    218214        dprintf(("OS2: WM_DESTROY %x", hwnd));
    219         if(win32wnd->MsgDestroy()) {
    220                 goto RunDefWndProc;
    221         }
     215        win32wnd->MsgDestroy();
    222216        break;
    223217
    224218    case WM_ENABLE:
    225219        dprintf(("OS2: WM_ENABLE %x", hwnd));
    226         if(win32wnd->MsgEnable(SHORT1FROMMP(mp1))) {
    227                 goto RunDefWndProc;
    228         }
     220        win32wnd->MsgEnable(SHORT1FROMMP(mp1));
    229221        break;
    230222
    231223    case WM_SHOW:
    232224        dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1));
    233         if(win32wnd->MsgShow((ULONG)mp1)) {
    234                 goto RunDefWndProc;
    235         }
     225        win32wnd->MsgShow((ULONG)mp1);
    236226        break;
    237227
     
    322312        }
    323313
    324         if(win32wnd->MsgActivate(SHORT1FROMMP(mp1), fMinimized, Win32BaseWindow::OS2ToWin32Handle(hwndActivate))) {
    325                 goto RunDefWndProc;
    326         }
    327         break;
     314        win32wnd->MsgActivate(SHORT1FROMMP(mp1), fMinimized, Win32BaseWindow::OS2ToWin32Handle(hwndActivate));
     315        break;
     316    }
     317
     318    case WM_SIZE:
     319    {
     320        dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2)));
     321        break;
     322    }
     323
     324    case WM_MINMAXFRAME:
     325    {
     326        dprintf(("OS2: WM_MINMAXFRAME"));
     327        break;
     328    }
     329
     330    case WM_OWNERPOSCHANGE:
     331    {
     332        dprintf(("OS2: WM_OWNERPOSCHANGE"));
     333        goto RunDefWndProc;
     334    }
     335
     336    case WM_CALCVALIDRECTS:
     337    {
     338        dprintf(("OS2: WM_CALCVALIDRECTS"));
     339        goto RunDefWndProc;
    328340    }
    329341
     
    341353                HWND hwndFocusWin32 = Win32BaseWindow::OS2ToWin32Handle(hwndFocus);
    342354                recreateCaret (hwndFocusWin32);
    343                 rc = win32wnd->MsgSetFocus(hwndFocusWin32);
    344         }
    345         else    rc = win32wnd->MsgKillFocus(Win32BaseWindow::OS2ToWin32Handle(hwndFocus));
    346         if(rc) {
    347                 goto RunDefWndProc;
    348         }
     355                win32wnd->MsgSetFocus(hwndFocusWin32);
     356        }
     357        else win32wnd->MsgKillFocus(Win32BaseWindow::OS2ToWin32Handle(hwndFocus));
    349358        break;
    350359    }
     
    362371    case WM_BUTTON3UP:
    363372    case WM_BUTTON3DBLCLK:
    364         if(win32wnd->MsgButton(pWinMsg)) {
    365                 goto RunDefWndProc;
    366         }
     373        win32wnd->MsgButton(pWinMsg);
     374        rc = TRUE;
    367375        break;
    368376
     
    386394
    387395    case WM_CONTROL:
     396        goto RunDefWndProc;
     397
    388398    case WM_COMMAND:
    389399        dprintf(("OS2: WM_COMMAND %x %x %x", hwnd, mp1, mp2));
    390400        win32wnd->DispatchMsg(pWinMsg);
    391         //todo controls + accelerators
    392401        break;
    393402
    394403    case WM_SYSCOMMAND:
    395     {
    396         if(win32wnd->DispatchMsg(pWinMsg)) {
    397             goto RunDefWndProc;
    398         }
    399         break;
    400     }
     404        win32wnd->DispatchMsg(pWinMsg);
     405        break;
     406
    401407    case WM_CHAR:
    402     {
    403408        win32wnd->DispatchMsg(pWinMsg);
    404409        break;
    405     }
    406410
    407411    case WM_INITMENU:
     
    424428        dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd));
    425429        if(wndParams->fsStatus & WPM_TEXT) {
    426             if(win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText)) {
    427                     goto RunDefWndProc;
    428             }
     430            win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText);
    429431        }
    430432        goto RunDefWndProc;
     
    458460
    459461    case WM_HITTEST:
    460         // Only send this message if the window is enabled
    461         if (WinIsWindowEnabled(hwnd))
    462         {
    463                 if(win32wnd->MsgHitTest(pWinMsg)) {
    464                     goto RunDefWndProc;
    465                 }
    466         }
    467         else    goto RunDefWndProc;
     462    {
     463      DWORD res;
     464
     465      // Only send this message if the window is enabled
     466      if (!WinIsWindowEnabled(hwnd))
     467        res = HT_ERROR;
     468      else if (win32wnd->getIgnoreHitTest())
     469        res = HT_NORMAL;
     470      else
     471      {
     472        dprintf(("USER32: WM_HITTEST %x (%d,%d)",hwnd,(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y));
     473
     474        //CB: WinWindowFromPoint: PM sends WM_HITTEST -> loop -> stack overflow
     475        win32wnd->setIgnoreHitTest(TRUE);
     476        res = win32wnd->MsgHitTest(pWinMsg);
     477        win32wnd->setIgnoreHitTest(FALSE);
     478      }
     479      RestoreOS2TIB();
     480      return (MRESULT)res;
     481    }
    468482
    469483    case WM_CONTEXTMENU:
     
    479493        dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
    480494        break;
    481     }
    482 
    483     case WM_SIZE:
    484     {
    485         dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2)));
    486         break;
    487     }
    488     case WM_MINMAXFRAME:
    489     {
    490         dprintf(("OS2: WM_MINMAXFRAME"));
    491         break;
    492     }
    493     case WM_OWNERPOSCHANGE:
    494     {
    495         dprintf(("OS2: WM_OWNERPOSCHANGE"));
    496         goto RunDefWndProc;
    497     }
    498 
    499     case WM_CALCVALIDRECTS:
    500     {
    501         dprintf(("OS2: WM_CALCVALIDRECTS"));
    502         goto RunDefWndProc;
    503495    }
    504496
     
    533525  }
    534526  RestoreOS2TIB();
    535   return (MRESULT)FALSE;
     527  return (MRESULT)rc;
    536528
    537529RunDefWndProc:
  • trunk/src/user32/scroll.cpp

    r2093 r2204  
    1 /* $Id: scroll.cpp,v 1.28 1999-12-16 16:53:57 cbratschi Exp $ */
     1/* $Id: scroll.cpp,v 1.29 1999-12-26 17:30:17 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    732732        if (!(dwStyle & SBS_SIZEGRIP)) return res;
    733733
    734         if (msg == WM_SETCURSOR)
    735         {
    736           RECT rect;
    737 
    738           SCROLL_GetSizeBox(hwnd,dwStyle,&rect);
    739           GetCursorPos(&pt);
    740           ScreenToClient(hwnd,&pt);
    741 
    742           if (PtInRect(&rect,pt))
    743           {
    744             SetCursor(LoadCursorA(0,IDC_SIZENWSEA));
    745             return TRUE;
    746           }
    747 
    748           return DefWindowProcA(hwnd,WM_SETCURSOR,wParam,lParam);
    749         } else if (msg == WM_LBUTTONDOWN)
     734        if (msg == WM_NCHITTEST)
    750735        {
    751736          if (dwStyle & SBS_SIZEGRIP)
     
    755740            pt.x = (SHORT)LOWORD(lParam);
    756741            pt.y = (SHORT)HIWORD(lParam);
     742            ScreenToClient(hwnd,&pt);
    757743            SCROLL_GetSizeBox(hwnd,dwStyle,&rect);
    758744            if (PtInRect(&rect,pt))
    759745            {
    760               HWND hwndFrame;
    761 
    762               Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    763               if (!win32wnd) return res;
    764               hwndFrame = OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_OWNER);
    765               win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndFrame);
    766               if (!win32wnd) return res;
    767               FrameTrackFrame(win32wnd,dwStyle & SBS_SIZEBOXTOPLEFTALIGN);
     746              if (dwStyle & SBS_SIZEBOXTOPLEFTALIGN)
     747                return HTTOPLEFT;
     748              else
     749                return HTBOTTOMRIGHT;
    768750            }
    769751          }
     752          return DefWindowProcA(hwnd,WM_NCHITTEST,wParam,lParam);
     753        } else if (msg == WM_LBUTTONDOWN)
     754        {
     755          return DefWindowProcA(hwnd,WM_LBUTTONDOWN,wParam,lParam);
    770756        }
    771757
     
    774760    }
    775761
    776     if (msg == WM_SETCURSOR) return DefWindowProcA(hwnd,WM_SETCURSOR,wParam,lParam);
    777     if (!SCROLL_Scrolling && msg != WM_LBUTTONDOWN) return res;
    778 
    779     vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
    780                                         &arrowSize, &thumbSize, &thumbPos );
     762    if (msg == WM_NCHITTEST) return DefWindowProcA(hwnd,WM_NCHITTEST,wParam,lParam);
     763
     764    vertical = SCROLL_GetScrollBarRect(hwnd,nBar,&rect,&arrowSize,&thumbSize,&thumbPos);
    781765    if (nBar == SB_CTL) hwndOwner = GetParent(hwnd); else
    782766    {
     
    792776    }
    793777
    794     hwndCtl   = (nBar == SB_CTL) ? hwnd : 0;
     778    hwndCtl = (nBar == SB_CTL) ? hwnd:0;
    795779
    796780    switch (msg)
     
    800784        pt.y = (SHORT)HIWORD(lParam);
    801785        SCROLL_trackVertical = vertical;
    802         SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, nBar, pt, FALSE );
     786        SCROLL_trackHitTest = hittest = SCROLL_HitTest(hwnd,nBar,pt,FALSE);
    803787        if (SCROLL_trackHitTest == SCROLL_NOWHERE)
    804788        {
     
    819803        trackThumbPos = thumbPos;
    820804        prevPt = pt;
    821         SetCapture( hwnd );
    822         if (nBar == SB_CTL) SetFocus( hwnd );
     805        if (nBar == SB_CTL) SetFocus(hwnd);
     806        SetCapture(hwnd);
    823807        break;
    824808
    825809      case WM_MOUSEMOVE:
    826         pt.x = (SHORT)LOWORD(lParam);
    827         pt.y = (SHORT)HIWORD(lParam);
    828         hittest = SCROLL_HitTest( hwnd, nBar, pt, TRUE );
    829         prevPt = pt;
     810        if (SCROLL_Scrolling)
     811        {
     812          pt.x = (SHORT)LOWORD(lParam);
     813          pt.y = (SHORT)HIWORD(lParam);
     814          hittest = SCROLL_HitTest(hwnd,nBar,pt,TRUE);
     815          prevPt = pt;
     816        } else return res;
    830817        break;
    831818
     
    11381125    case WM_LBUTTONDOWN:
    11391126    case WM_LBUTTONUP:
     1127    case WM_NCHITTEST:
    11401128    case WM_CAPTURECHANGED:
    11411129    case WM_MOUSEMOVE:
    1142     case WM_SETCURSOR:
    11431130    case WM_SYSTIMER:
    11441131    case WM_SETFOCUS:
     
    12161203    case WM_LBUTTONDOWN:
    12171204    case WM_LBUTTONUP:
     1205    case WM_NCHITTEST:
    12181206    case WM_CAPTURECHANGED:
    12191207    case WM_MOUSEMOVE:
    1220     case WM_SETCURSOR:
    12211208    case WM_SYSTIMER:
    12221209    case WM_SETFOCUS:
     
    12711258    case WM_LBUTTONDOWN:
    12721259    case WM_LBUTTONUP:
     1260    case WM_NCHITTEST:
    12731261    case WM_CAPTURECHANGED:
    12741262    case WM_MOUSEMOVE:
    1275     case WM_SETCURSOR:
    12761263    case WM_SYSTIMER:
    12771264    case WM_SETFOCUS:
  • trunk/src/user32/user32exp.def

    r1818 r2204  
    578578    GetOS2Callback__15Win32WindowProcFv       @2001
    579579    _GetSysColorPen@4                         @2002
    580     _TrackWin32Window@8                       @2003
    581580    Win32ToOS2Handle__FUl                     @2006
    582581    _MOUSE_Enable@4                           @2007
  • trunk/src/user32/win32wbase.cpp

    r2202 r2204  
    1 /* $Id: win32wbase.cpp,v 1.118 1999-12-24 21:44:04 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.119 1999-12-26 17:30:18 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    88 * Parts based on Wine Windows code (windows\win.c)
    99 *
    10  * Copyright 1993, 1994 Alexandre Julliard
     10 * Copyright 1993, 1994, 1996 Alexandre Julliard
     11 *           1995 Alex Korobka
    1112 *
    1213 * TODO: Not thread/process safe
     
    146147  fInternalMsg     = FALSE;
    147148  fNoSizeMsg       = FALSE;
    148   fMovingChildren  = FALSE;
    149149  fIsDestroyed     = FALSE;
    150150  fDestroyWindowCalled = FALSE;
     
    190190  flags            = 0;
    191191  isIcon           = FALSE;
    192   lastHitTestVal   = 0;
     192  lastHitTestVal   = HTOS_NORMAL;
     193  fIgnoreHitTest   = FALSE;
    193194  owner            = NULL;
    194195  windowClass      = 0;
     
    777778ULONG Win32BaseWindow::MsgClose()
    778779{
    779   if(SendInternalMessageA(WM_CLOSE, 0, 0) == 0) {
    780         dprintf(("Win32BaseWindow::MsgClose, app handles msg"));
    781         return 0; //app handles this message
    782   }
    783   return 1;
     780  return SendInternalMessageA(WM_CLOSE,0,0);
    784781}
    785782//******************************************************************************
     
    856853ULONG Win32BaseWindow::MsgPosChanging(LPARAM lp)
    857854{
    858     if(fNoSizeMsg || (getParent() && getParent()->InMovingChildren()))
     855    if(fNoSizeMsg)
    859856        return 1;
    860857
     
    865862ULONG Win32BaseWindow::MsgPosChanged(LPARAM lp)
    866863{
    867     if(fNoSizeMsg || (getParent() && getParent()->InMovingChildren()))
     864    if(fNoSizeMsg)
    868865        return 1;
    869866
     
    892889  lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)msg->pt.x, (USHORT)msg->pt.y));
    893890  dprintf2(("MsgHitTest returned %x", lastHitTestVal));
    894   return 1; //TODO: May need to change this
     891
     892  if (lastHitTestVal == HTERROR)
     893    return HTOS_ERROR;
     894
     895#if 0 //CB: problems with groupboxes, internal handling is better
     896  if (lastHitTestVal == HTTRANSPARENT)
     897    return HTOS_TRANSPARENT;
     898#endif
     899
     900  return HTOS_NORMAL;
    895901}
    896902//******************************************************************************
     
    967973
    968974    dprintf(("MsgButton at (%d,%d)", msg->pt.x, msg->pt.y));
    969     switch(msg->message) { //TODO: double click also?
     975    switch(msg->message) {
    970976        case WM_LBUTTONDBLCLK:
    971977        case WM_RBUTTONDBLCLK:
    972978        case WM_MBUTTONDBLCLK:
     979        case WM_NCLBUTTONDBLCLK:
     980        case WM_NCRBUTTONDBLCLK:
     981        case WM_NCMBUTTONDBLCLK:
    973982                if (!(windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS))
    974983                {
    975984                    msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
    976985                    MsgButton(msg);
     986                    msg->message++; //button-up
    977987                    return MsgButton(msg);
    978988                }
     
    981991        case WM_RBUTTONDOWN:
    982992        case WM_MBUTTONDOWN:
     993        case WM_NCLBUTTONDOWN:
     994        case WM_NCRBUTTONDOWN:
     995        case WM_NCMBUTTONDOWN:
    983996                fClick = TRUE;
    984997                break;
     
    12361249}
    12371250/***********************************************************************
     1251 *           NC_HandleNCLButtonDown
     1252 *
     1253 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
     1254 */
     1255LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
     1256{
     1257  switch(wParam)  /* Hit test */
     1258  {
     1259    case HTCAPTION:
     1260      SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
     1261      break;
     1262
     1263    case HTSYSMENU:
     1264      SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
     1265      break;
     1266
     1267    case HTMENU:
     1268      SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
     1269      break;
     1270
     1271    case HTHSCROLL:
     1272      SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
     1273      break;
     1274
     1275    case HTVSCROLL:
     1276      SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
     1277      break;
     1278
     1279    case HTLEFT:
     1280    case HTRIGHT:
     1281    case HTTOP:
     1282    case HTTOPLEFT:
     1283    case HTTOPRIGHT:
     1284    case HTBOTTOM:
     1285    case HTBOTTOMLEFT:
     1286    case HTBOTTOMRIGHT:
     1287        /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
     1288        SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
     1289        break;
     1290    case HTBORDER:
     1291        break;
     1292  }
     1293
     1294  return 0;
     1295}
     1296//******************************************************************************
     1297//******************************************************************************
     1298LONG Win32BaseWindow::HandleNCLButtonUp(WPARAM wParam,LPARAM lParam)
     1299{
     1300  switch(wParam)  /* Hit test */
     1301  {
     1302    case HTMINBUTTON:
     1303      SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,lParam);
     1304      break;
     1305
     1306    case HTMAXBUTTON:
     1307      SendInternalMessageA(WM_SYSCOMMAND,SC_MAXIMIZE,lParam);
     1308      break;
     1309
     1310    case HTCLOSE:
     1311      SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
     1312      break;
     1313  }
     1314
     1315  return 0;
     1316}
     1317/***********************************************************************
     1318 *           NC_HandleNCLButtonDblClk
     1319 *
     1320 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
     1321 */
     1322LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
     1323{
     1324  /*
     1325   * if this is an icon, send a restore since we are handling
     1326   * a double click
     1327   */
     1328  if (dwStyle & WS_MINIMIZE)
     1329  {
     1330    SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
     1331    return 0;
     1332  }
     1333
     1334  switch(wParam)  /* Hit test */
     1335  {
     1336    case HTCAPTION:
     1337      /* stop processing if WS_MAXIMIZEBOX is missing */
     1338      if (dwStyle & WS_MAXIMIZEBOX)
     1339        SendInternalMessageA(WM_SYSCOMMAND,
     1340                      (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
     1341                      lParam);
     1342      break;
     1343
     1344    case HTSYSMENU:
     1345      if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
     1346        SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
     1347      break;
     1348
     1349    case HTHSCROLL:
     1350      SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
     1351      break;
     1352
     1353    case HTVSCROLL:
     1354      SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
     1355      break;
     1356  }
     1357
     1358  return 0;
     1359}
     1360/***********************************************************************
    12381361 *           NC_HandleSysCommand
    12391362 *
     
    12511374    switch (uCommand)
    12521375    {
    1253 #if 0
     1376
    12541377    case SC_SIZE:
     1378    {
     1379      DWORD flags = 0;
     1380
     1381      switch ((wParam & 0xF)+2)
     1382      {
     1383        case HTLEFT:
     1384          flags = TFOS_LEFT;
     1385          break;
     1386
     1387        case HTRIGHT:
     1388          flags = TFOS_RIGHT;
     1389          break;
     1390
     1391        case HTTOP:
     1392          flags = TFOS_TOP;
     1393          break;
     1394
     1395        case HTTOPLEFT:
     1396          flags = TFOS_TOP | TFOS_LEFT;
     1397          break;
     1398
     1399        case HTTOPRIGHT:
     1400          flags = TFOS_TOP | TFOS_RIGHT;
     1401          break;
     1402
     1403        case HTBOTTOM:
     1404          flags = TFOS_BOTTOM;
     1405          break;
     1406
     1407        case HTBOTTOMLEFT:
     1408          flags = TFOS_BOTTOM | TFOS_LEFT;
     1409          break;
     1410
     1411        case HTBOTTOMRIGHT:
     1412          flags = TFOS_BOTTOM | TFOS_RIGHT;
     1413          break;
     1414      }
     1415      if (flags) FrameTrackFrame(this,flags);
     1416      break;
     1417    }
     1418
    12551419    case SC_MOVE:
    1256         NC_DoSizeMove( hwnd, wParam );
    1257         break;
    1258 #endif
     1420      FrameTrackFrame(this,TFOS_MOVE);
     1421      break;
    12591422
    12601423    case SC_MINIMIZE:
     
    13621525//******************************************************************************
    13631526//******************************************************************************
     1527LRESULT Win32BaseWindow::DefWndPrint(HDC hdc,ULONG uFlags)
     1528{
     1529  /*
     1530   * Visibility flag.
     1531   */
     1532  if ( (uFlags & PRF_CHECKVISIBLE) &&
     1533       !IsWindowVisible() )
     1534      return 0;
     1535
     1536  /*
     1537   * Unimplemented flags.
     1538   */
     1539  if ( (uFlags & PRF_CHILDREN) ||
     1540       (uFlags & PRF_OWNED)    ||
     1541       (uFlags & PRF_NONCLIENT) )
     1542  {
     1543    dprintf(("WM_PRINT message with unsupported flags\n"));
     1544  }
     1545
     1546  /*
     1547   * Background
     1548   */
     1549  if ( uFlags & PRF_ERASEBKGND)
     1550    SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
     1551
     1552  /*
     1553   * Client area
     1554   */
     1555  if ( uFlags & PRF_CLIENT)
     1556    SendInternalMessageA(WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
     1557
     1558
     1559  return 0;
     1560}
     1561//******************************************************************************
     1562//******************************************************************************
    13641563LRESULT Win32BaseWindow::DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam)
    13651564{
     
    14111610    case WM_SETREDRAW:
    14121611    {
    1413      DWORD oldStyle = getStyle();
    1414 
    1415         if(wParam)
    1416                 setStyle(getStyle() | WS_VISIBLE);
    1417         else    setStyle(getStyle() & ~WS_VISIBLE);
    1418 
    1419         updateWindowStyle(getExStyle(), oldStyle);
    1420 
    1421         return 0; //TODO
    1422     }
     1612      if (wParam)
     1613      {
     1614        setStyle(getStyle() | WS_VISIBLE);
     1615        OSLibWinEnableWindowUpdate(OS2HwndFrame,TRUE);
     1616      } else
     1617      {
     1618        if (getStyle() & WS_VISIBLE)
     1619        {
     1620          setStyle(getStyle() & ~WS_VISIBLE);
     1621          OSLibWinEnableWindowUpdate(OS2HwndFrame,FALSE);
     1622        }
     1623      }
     1624      return 0;
     1625    }
     1626
     1627    case WM_NCPAINT:
     1628        return 0;
     1629
     1630    case WM_NCACTIVATE:
     1631        return TRUE;
     1632
    14231633    case WM_NCCREATE:
    14241634        return(TRUE);
     1635
     1636    case WM_NCDESTROY:
     1637        return 0;
    14251638
    14261639    case WM_NCCALCSIZE:
     
    14581671        return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
    14591672    }
     1673
     1674    case WM_ACTIVATE:
     1675      //CB: todo
     1676      return 0;
     1677
    14601678    case WM_SETCURSOR:
    14611679    {
     
    14701688        if (wParam == Win32Hwnd)
    14711689        {
    1472           HCURSOR hCursor = windowClass ? windowClass->getCursor():LoadCursorA(0,IDC_ARROWA);
    1473 
    1474           if (hCursor) SetCursor(hCursor);
    1475           return 1;
     1690          HCURSOR hCursor;
     1691
     1692          switch(lastHitTestVal)
     1693          {
     1694            case HTLEFT:
     1695            case HTRIGHT:
     1696              hCursor = LoadCursorA(0,IDC_SIZEWEA);
     1697              break;
     1698
     1699            case HTTOP:
     1700            case HTBOTTOM:
     1701              hCursor = LoadCursorA(0,IDC_SIZENSA);
     1702              break;
     1703
     1704            case HTTOPLEFT:
     1705            case HTBOTTOMRIGHT:
     1706              hCursor = LoadCursorA(0,IDC_SIZENWSEA);
     1707              break;
     1708
     1709            case HTTOPRIGHT:
     1710            case HTBOTTOMLEFT:
     1711              hCursor = LoadCursorA(0,IDC_SIZENESWA);
     1712              break;
     1713
     1714            default:
     1715              hCursor = windowClass ? windowClass->getCursor():LoadCursorA(0,IDC_ARROWA);
     1716              break;
     1717          }
     1718
     1719          if (hCursor)
     1720          {
     1721            SetCursor(hCursor);
     1722            return 1;
     1723          } else return 0;
    14761724        } else return 0;
    14771725    }
     1726
    14781727    case WM_MOUSEMOVE:
    1479         return 0; //we do our own cursor handling
     1728        return 0;
    14801729
    14811730    case WM_WINDOWPOSCHANGED:
     
    15251774        return 1;
    15261775    }
     1776
     1777    case WM_PRINT:
     1778        return DefWndPrint(wParam,lParam);
     1779
    15271780    case WM_PAINTICON:
    15281781    case WM_PAINT:
     
    15481801
    15491802    case WM_NCLBUTTONDOWN:
     1803        return HandleNCLButtonDown(wParam,lParam);
     1804
    15501805    case WM_NCLBUTTONUP:
     1806        return HandleNCLButtonUp(wParam,lParam);
     1807
    15511808    case WM_NCLBUTTONDBLCLK:
    1552     case WM_NCRBUTTONUP:
     1809        return HandleNCLButtonDblClk(wParam,lParam);
     1810
    15531811    case WM_NCRBUTTONDOWN:
    15541812    case WM_NCRBUTTONDBLCLK:
    15551813    case WM_NCMBUTTONDOWN:
     1814    case WM_NCMBUTTONDBLCLK:
     1815        if (lastHitTestVal == HTERROR) MessageBeep(MB_ICONEXCLAMATION);
     1816        return 0;
     1817
     1818    case WM_NCRBUTTONUP:
    15561819    case WM_NCMBUTTONUP:
    1557     case WM_NCMBUTTONDBLCLK:
    1558         return 0;           //TODO: Send WM_SYSCOMMAND if required
    1559 
    1560     case WM_NCHITTEST: //TODO: Calculate position of
    1561         return HTCLIENT;
     1820        return 0;
     1821
     1822    case WM_NCHITTEST:
     1823    {
     1824      POINT point;
     1825
     1826      point.x = (SHORT)LOWORD(lParam);
     1827      point.y = (SHORT)HIWORD(lParam);
     1828
     1829      return FrameHitTest(this,point.x,point.y);
     1830    }
    15621831
    15631832    case WM_SYSCOMMAND:
     
    16121881        return 0;
    16131882
     1883    case WM_SHOWWINDOW:
     1884        if (!lParam) return 0; /* sent from ShowWindow */
     1885        if (!(dwStyle & WS_POPUP) || !owner) return 0;
     1886        if ((dwStyle & WS_VISIBLE) && wParam) return 0;
     1887        else if (!(dwStyle & WS_VISIBLE) && !wParam) return 0;
     1888        ShowWindow(wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
     1889        return 0;
     1890
     1891    case WM_CANCELMODE:
     1892        //if (getParent() == windowDesktop) EndMenu();
     1893        if (GetCapture() == Win32Hwnd) ReleaseCapture();
     1894        return 0;
     1895
     1896    case WM_DROPOBJECT:
     1897        return DRAG_FILE;
     1898
     1899    case WM_QUERYDROPOBJECT:
     1900        if (dwExStyle & WS_EX_ACCEPTFILES) return 1;
     1901        return 0;
     1902
     1903    case WM_QUERYDRAGICON:
     1904        {
     1905            HICON hIcon = windowClass->getCursor();
     1906            UINT len;
     1907
     1908            if(hIcon) return (LRESULT)hIcon;
     1909            for(len = 1; len < 64; len++)
     1910            {
     1911              hIcon = LoadIconA(hInstance,MAKEINTRESOURCEA(len));
     1912              if(hIcon)
     1913                return (LRESULT)hIcon;
     1914            }
     1915            return (LRESULT)LoadIconA(0,IDI_APPLICATIONA);
     1916        }
     1917
    16141918    case WM_QUERYOPEN:
    16151919    case WM_QUERYENDSESSION:
     
    16371941            return result;
    16381942    }
     1943
    16391944    case WM_NOTIFY:
    16401945        return 0; //comctl32 controls expect this
     
    16441949            return 0;
    16451950        }
    1646         return 1;
     1951        return 1; //CB: shouldn't this be 0?
    16471952    }
    16481953}
     
    27443049  if(IsWindowDestroyed()) return;
    27453050
    2746   if (dwStyle != oldStyle) OSLibSetWindowStyle(OS2HwndFrame, dwStyle, fTaskList);
     3051  //CB: todo: dwExStyle, creating new frame controls, destroy not used, WS_VISIBLE, ...
     3052  //    write test cases
     3053  if (dwStyle & 0xFFFF0000 != oldStyle & 0xFFFF0000)
     3054    OSLibSetWindowStyle(OS2HwndFrame, dwStyle, fTaskList);
    27473055}
    27483056//******************************************************************************
     
    27803088                ss.styleOld = getStyle();
    27813089                        ss.styleNew = value | (ss.styleOld & (WS_VISIBLE | WS_CHILD));
    2782                 dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), getStyle(), value));
     3090                dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), ss.styleOld, ss.styleNew));
    27833091                SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    27843092                setStyle(ss.styleNew);
  • trunk/src/user32/win32wbase.h

    r2202 r2204  
    1 /* $Id: win32wbase.h,v 1.57 1999-12-24 21:44:04 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.58 1999-12-26 17:30:19 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    103103         HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
    104104 Win32WndClass *getWindowClass()                { return windowClass; };
     105
     106         BOOL   getIgnoreHitTest()              { return fIgnoreHitTest; }
     107         VOID   setIgnoreHitTest(BOOL ignore)   { fIgnoreHitTest = ignore; }
    105108
    106109         DWORD  getWindowContextHelpId()        { return contextHelpId; };
     
    173176         HWND   getOS2HwndModalDialog()       { return OS2HwndModalDialog; };
    174177         BOOL   CanReceiveSizeMsgs()          { return !fNoSizeMsg; };
    175          BOOL   InMovingChildren()            { return fMovingChildren; };
    176          VOID   setMovingChildren(BOOL fMC)   { fMovingChildren = fMC; };
    177178         BOOL   IsWindowDestroyed()           { return fIsDestroyed; };
    178179         BOOL   IsWindowEnabled();
     
    217218
    218219       LRESULT  DefWndControlColor(UINT ctlType, HDC hdc);
     220       LRESULT  DefWndPrint(HDC hdc,ULONG uFlags);
    219221
    220222         void   NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
     
    286288        DWORD   contextHelpId;
    287289        LONG    lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
     290        BOOL    fIgnoreHitTest;         //Use WinWindowFromPoint during WM_HITTEST
    288291
    289292        BOOL    isIcon;
     
    296299                                        //sent by PM and those sent by apps
    297300        BOOL    fNoSizeMsg;
    298         BOOL    fMovingChildren;
    299301        BOOL    fIsDestroyed;
    300302        BOOL    fDestroyWindowCalled;   //DestroyWindow was called for this window
     
    343345        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    344346        LONG  HandleWindowPosChanging(WINDOWPOS *winpos);
     347        LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
     348        LONG  HandleNCLButtonUp(WPARAM wParam,LPARAM lParam);
     349        LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
    345350        LONG  HandleSysCommand(WPARAM wParam, POINT *pt32);
    346351
  • trunk/src/user32/windlgmsg.cpp

    r1205 r2204  
    1 /* $Id: windlgmsg.cpp,v 1.2 1999-10-08 21:30:52 cbratschi Exp $ */
     1/* $Id: windlgmsg.cpp,v 1.3 1999-12-26 17:30:20 cbratschi Exp $ */
    22/*
    33 * Win32 dialog message APIs for OS/2
     
    1616#include <os2win.h>
    1717#include <misc.h>
     18#include <string.h>
     19#include <ctype.h>
    1820#include "win32wbase.h"
    1921#include "win32dlg.h"
     
    5557    return 0;
    5658}
    57 //TODO
    58 #if 0
    5959/***********************************************************************
    6060 *           DIALOG_IsAccelerator
     
    6464    HWND hwndControl = hwnd;
    6565    HWND hwndNext;
    66     WND *wndPtr;
     66    Win32BaseWindow *win32wnd;
    6767    BOOL RetVal = FALSE;
    6868    INT dlgCode;
     
    8282        do
    8383        {
    84             wndPtr = WIN_FindWndPtr( hwndControl );
    85             if ( (wndPtr != NULL) &&
    86                  ((wndPtr->dwStyle & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) )
     84            win32wnd = Win32BaseWindow::GetWindowFromHandle(hwndControl);
     85            if ( (win32wnd != NULL) &&
     86                 ((win32wnd->getStyle() & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) )
    8787            {
    88                 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
    89                 if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) &&
    90                      (wndPtr->text!=NULL))
     88              dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
     89              if (dlgCode & (DLGC_BUTTON | DLGC_STATIC))
     90              {
     91                INT textLen = win32wnd->GetWindowTextLength();
     92
     93                if (textLen > 0)
    9194                {
    9295                    /* find the accelerator key */
    93                     LPSTR p = wndPtr->text - 2;
     96                    char* text;
     97                    LPSTR p;
     98
     99                    text = (char*)malloc(textLen+1);
     100                    win32wnd->GetWindowTextA(text,textLen);
     101                    p = text - 2;
    94102                    do
    95103                    {
     
    102110                    {
    103111                        if ((dlgCode & DLGC_STATIC) ||
    104                             (wndPtr->dwStyle & 0x0f) == BS_GROUPBOX )
     112                            (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX )
    105113                        {
    106114                            /* set focus to the control */
     
    115123                            /* send command message as from the control */
    116124                            SendMessageA( hwndDlg, WM_COMMAND,
    117                                 MAKEWPARAM( LOWORD(wndPtr->wIDmenu),
     125                                MAKEWPARAM( LOWORD(win32wnd->getWindowId()),
    118126                                    BN_CLICKED ),
    119127                                (LPARAM)hwndControl );
     
    126134                        }
    127135                        RetVal = TRUE;
    128             WIN_ReleaseWndPtr(wndPtr);
     136                        free(text);
    129137                        break;
    130138                    }
     139                    free(text);
    131140                }
     141              }
    132142        hwndNext = GetWindow( hwndControl, GW_CHILD );
    133143            }
     
    136146        hwndNext = 0;
    137147        }
    138             WIN_ReleaseWndPtr(wndPtr);
    139148        if (!hwndNext)
    140149        {
     
    163172    return RetVal;
    164173}
    165 #endif
    166174/***********************************************************************
    167175 *           DIALOG_IsDialogMessage
     
    251259        /* drop through */
    252260
    253 //TODO:
    254 #if 0
    255261    case WM_SYSCHAR:
    256262        if (DIALOG_IsAccelerator( hwnd, hwndDlg, wParam ))
     
    260266        }
    261267        break;
    262 #endif
    263268    }
    264269
  • trunk/src/user32/windowmsg.cpp

    r2200 r2204  
    1 /* $Id: windowmsg.cpp,v 1.11 1999-12-24 18:39:13 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.12 1999-12-26 17:30:20 cbratschi Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    1111 * TODO: GetQueueStatus: QS_HOTKEY (oslibmsg.cpp) & low word bits
    1212 * TODO: MsgWaitForMultipleObjects: timeout isn't handled correctly (can return too late)
    13  * TODO: GetMessageExtraInfo
    1413 *
    1514 * Project Odin Software License can be found in LICENSE.TXT
     
    2221#include <heapstring.h>
    2322#include <handlemanager.h>
     23#include "oslibutil.h"
    2424#include "oslibwin.h"
    2525#include "oslibmsg.h"
     
    9595}
    9696//******************************************************************************
    97 //TODO: 
     97//TODO:
    9898//******************************************************************************
    9999LONG WIN32API GetMessageExtraInfo()
    100100{
    101     dprintf(("USER32: GetMessageExtraInfo NOT SUPPORTED"));
    102     return 0;
     101    dprintf(("USER32: GetMessageExtraInfo"));
     102    return GetThreadMessageExtraInfo();
    103103}
    104104//******************************************************************************
     
    124124    if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST)
    125125    {
    126         Win32BaseWindow::BroadcastMessageA(BROADCAST_SEND, msg, wParam, lParam);
    127         return TRUE;
     126        Win32BaseWindow::BroadcastMessageA(BROADCAST_SEND, msg, wParam, lParam);
     127        return TRUE;
    128128    }
    129129
     
    143143    if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST)
    144144    {
    145         Win32BaseWindow::BroadcastMessageW(BROADCAST_SEND, msg, wParam, lParam);
    146         return TRUE;
     145        Win32BaseWindow::BroadcastMessageW(BROADCAST_SEND, msg, wParam, lParam);
     146        return TRUE;
    147147    }
    148148
     
    162162    if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST???
    163163    {
    164         Win32BaseWindow::BroadcastMessageA(BROADCAST_POST, msg, wParam, lParam);
    165         return TRUE;
     164        Win32BaseWindow::BroadcastMessageA(BROADCAST_POST, msg, wParam, lParam);
     165        return TRUE;
    166166    }
    167167
     
    185185    if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST???
    186186    {
    187         Win32BaseWindow::BroadcastMessageW(BROADCAST_POST, msg, wParam, lParam);
    188         return TRUE;
     187        Win32BaseWindow::BroadcastMessageW(BROADCAST_POST, msg, wParam, lParam);
     188        return TRUE;
    189189    }
    190190
     
    264264}
    265265//******************************************************************************
    266 //No need to support this
     266//No need to support this (obsolete, not implemented by Win32)
    267267//******************************************************************************
    268268BOOL WIN32API SetMessageQueue(int cMessagesMax)
     
    320320{
    321321#ifdef DEBUG
    322   WriteLog("USER32:  SetMessageExtraInfo, not implemented\n");
     322  WriteLog("USER32:  SetMessageExtraInfo\n");
    323323#endif
    324   return(0);
     324  return SetThreadMessageExtraInfo(lParam);
    325325}
    326326/*****************************************************************************
     
    447447//******************************************************************************
    448448/**********************************************************************
    449  *           WINPROC_TestCBForStr
     449 *           WINPROC_TestCBForStr
    450450 *
    451451 * Return TRUE if the lparam is a string
     
    454454{
    455455    BOOL retvalue;
    456     DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 
     456    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    457457    retvalue = ( !(LOWORD(dwStyle) & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) ||
    458               (LOWORD(dwStyle) & CBS_HASSTRINGS) );
     458              (LOWORD(dwStyle) & CBS_HASSTRINGS) );
    459459    return retvalue;
    460460}
    461461/**********************************************************************
    462  *           WINPROC_TestLBForStr
     462 *           WINPROC_TestLBForStr
    463463 *
    464464 * Return TRUE if the lparam is a string
     
    467467{
    468468    BOOL retvalue;
    469     DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 
     469    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    470470    retvalue = ( !(LOWORD(dwStyle) & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) ||
    471             (LOWORD(dwStyle) & LBS_HASSTRINGS) );
     471            (LOWORD(dwStyle) & LBS_HASSTRINGS) );
    472472    return retvalue;
    473473}
    474474
    475475/**********************************************************************
    476  *           WINPROC_MapMsg32ATo32W
     476 *           WINPROC_MapMsg32ATo32W
    477477 *
    478478 * Map a message from Ansi to Unicode.
     
    484484 * FIXME:
    485485 *  WM_GETTEXT/WM_SETTEXT and static control with SS_ICON style:
    486  *  the first four bytes are the handle of the icon 
     486 *  the first four bytes are the handle of the icon
    487487 *  when the WM_SETTEXT message has been used to set the icon
    488488 */
     
    550550    case LB_ADDSTRING:
    551551    case LB_INSERTSTRING:
    552         if ( WINPROC_TestLBForStr( hwnd ))
     552        if ( WINPROC_TestLBForStr( hwnd ))
    553553          *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam );
    554554        return (*plparam ? 1 : -1);
    555555
    556     case LB_GETTEXT:                /* fixme: fixed sized buffer */
     556    case LB_GETTEXT:                /* fixme: fixed sized buffer */
    557557        { if ( WINPROC_TestLBForStr( hwnd ))
    558           { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) );
     558          { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) + sizeof(LPARAM) );
    559559            if (!ptr) return -1;
    560560            *ptr++ = *plparam;  /* Store previous lParam */
    561561            *plparam = (LPARAM)ptr;
    562           }
     562          }
    563563        }
    564564        return 1;
     
    567567    case CB_ADDSTRING:
    568568    case CB_INSERTSTRING:
    569         if ( WINPROC_TestCBForStr( hwnd ))
     569        if ( WINPROC_TestCBForStr( hwnd ))
    570570          *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam );
    571571        return (*plparam ? 1 : -1);
     
    577577            *ptr++ = *plparam;  /* Store previous lParam */
    578578            *plparam = (LPARAM)ptr;
    579           }
     579          }
    580580        }
    581581        return 1;
     
    584584    case EM_GETLINE:
    585585        { WORD len = (WORD)*plparam;
    586           LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
     586          LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
    587587          if (!ptr) return -1;
    588588          *ptr++ = *plparam;  /* Store previous lParam */
    589           *((WORD *) ptr) = len;   /* Store the length */
     589          *((WORD *) ptr) = len;   /* Store the length */
    590590          *plparam = (LPARAM)ptr;
    591         }
     591        }
    592592        return 1;
    593593
     
    606606
    607607/**********************************************************************
    608  *           WINPROC_UnmapMsg32ATo32W
     608 *           WINPROC_UnmapMsg32ATo32W
    609609 *
    610610 * Unmap a message that was mapped from Ansi to Unicode.
     
    662662    case LB_ADDSTRING:
    663663    case LB_INSERTSTRING:
    664         if ( WINPROC_TestLBForStr( hwnd ))
     664        if ( WINPROC_TestLBForStr( hwnd ))
    665665          HeapFree( GetProcessHeap(), 0, (void *)lParam );
    666666        break;
     
    669669        { if ( WINPROC_TestLBForStr( hwnd ))
    670670          { LPARAM *ptr = (LPARAM *)lParam - 1;
    671             lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) );
     671            lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) );
    672672            HeapFree( GetProcessHeap(), 0, ptr );
    673           }
     673          }
    674674        }
    675675        break;
     
    678678    case CB_ADDSTRING:
    679679    case CB_INSERTSTRING:
    680         if ( WINPROC_TestCBForStr( hwnd ))
     680        if ( WINPROC_TestCBForStr( hwnd ))
    681681          HeapFree( GetProcessHeap(), 0, (void *)lParam );
    682682        break;
     
    684684    case CB_GETLBTEXT:
    685685        { if ( WINPROC_TestCBForStr( hwnd ))
    686           { LPARAM *ptr = (LPARAM *)lParam - 1;
     686          { LPARAM *ptr = (LPARAM *)lParam - 1;
    687687            lstrcpyWtoA( (LPSTR)*ptr, (LPWSTR)(lParam) );
    688688            HeapFree( GetProcessHeap(), 0, ptr );
    689           }
     689          }
    690690        }
    691691        break;
     
    694694    case EM_GETLINE:
    695695        { LPARAM * ptr = (LPARAM *)lParam - 1;  /* get the old lParam */
    696           WORD len = *(WORD *) lParam;
     696          WORD len = *(WORD *) lParam;
    697697          lstrcpynWtoA( (LPSTR)*ptr , (LPWSTR)lParam, len );
    698698          HeapFree( GetProcessHeap(), 0, ptr );
     
    704704
    705705/**********************************************************************
    706  *           WINPROC_MapMsg32WTo32A
     706 *           WINPROC_MapMsg32WTo32A
    707707 *
    708708 * Map a message from Unicode to Ansi.
     
    772772    case LB_ADDSTRING:
    773773    case LB_INSERTSTRING:
    774         if ( WINPROC_TestLBForStr( hwnd ))
     774        if ( WINPROC_TestLBForStr( hwnd ))
    775775          *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam );
    776776        return (*plparam ? 1 : -1);
    777777
    778     case LB_GETTEXT:                    /* fixme: fixed sized buffer */
     778    case LB_GETTEXT:                    /* fixme: fixed sized buffer */
    779779        { if ( WINPROC_TestLBForStr( hwnd ))
    780           { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
     780          { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
    781781            if (!ptr) return -1;
    782782            *ptr++ = *plparam;  /* Store previous lParam */
    783783            *plparam = (LPARAM)ptr;
    784           }
     784          }
    785785        }
    786786        return 1;
     
    789789    case CB_ADDSTRING:
    790790    case CB_INSERTSTRING:
    791         if ( WINPROC_TestCBForStr( hwnd ))
     791        if ( WINPROC_TestCBForStr( hwnd ))
    792792          *plparam = (LPARAM)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR)*plparam );
    793793        return (*plparam ? 1 : -1);
    794794
    795     case CB_GETLBTEXT:          /* fixme: fixed sized buffer */
     795    case CB_GETLBTEXT:          /* fixme: fixed sized buffer */
    796796        { if ( WINPROC_TestCBForStr( hwnd ))
    797           { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
     797          { LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM) );
    798798            if (!ptr) return -1;
    799799            *ptr++ = *plparam;  /* Store previous lParam */
    800800            *plparam = (LPARAM)ptr;
    801           }
     801          }
    802802        }
    803803        return 1;
     
    806806    case EM_GETLINE:
    807807        { WORD len = (WORD)*plparam;
    808           LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
     808          LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
    809809          if (!ptr) return -1;
    810810          *ptr++ = *plparam;  /* Store previous lParam */
    811           *((WORD *) ptr) = len;   /* Store the length */
     811          *((WORD *) ptr) = len;   /* Store the length */
    812812          *plparam = (LPARAM)ptr;
    813         }
     813        }
    814814        return 1;
    815815
     
    828828
    829829/**********************************************************************
    830  *           WINPROC_UnmapMsg32WTo32A
     830 *           WINPROC_UnmapMsg32WTo32A
    831831 *
    832832 * Unmap a message that was mapped from Unicode to Ansi.
     
    884884    case LB_ADDSTRING:
    885885    case LB_INSERTSTRING:
    886         if ( WINPROC_TestLBForStr( hwnd ))
     886        if ( WINPROC_TestLBForStr( hwnd ))
    887887          HeapFree( GetProcessHeap(), 0, (void *)lParam );
    888888        break;
     
    893893            lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) );
    894894            HeapFree(GetProcessHeap(), 0, ptr );
    895           }
     895          }
    896896        }
    897897        break;
     
    900900    case CB_ADDSTRING:
    901901    case CB_INSERTSTRING:
    902         if ( WINPROC_TestCBForStr( hwnd ))
     902        if ( WINPROC_TestCBForStr( hwnd ))
    903903          HeapFree( GetProcessHeap(), 0, (void *)lParam );
    904904        break;
     
    909909            lstrcpyAtoW( (LPWSTR)*ptr, (LPSTR)(lParam) );
    910910            HeapFree( GetProcessHeap(), 0, ptr );
    911           }
     911          }
    912912        }
    913913        break;
     
    916916    case EM_GETLINE:
    917917        { LPARAM * ptr = (LPARAM *)lParam - 1;  /* get the old lparam */
    918           WORD len = *(WORD *)ptr;
     918          WORD len = *(WORD *)ptr;
    919919          lstrcpynAtoW( (LPWSTR) *ptr, (LPSTR)lParam, len );
    920920          HeapFree( GetProcessHeap(), 0, ptr );
     
    925925
    926926/**********************************************************************
    927  *           WINPROC_CallProc32ATo32W
     927 *           WINPROC_CallProc32ATo32W
    928928 *
    929929 * Call a window procedure, translating args from Ansi to Unicode.
     
    942942
    943943/**********************************************************************
    944  *           WINPROC_CallProc32WTo32A
     944 *           WINPROC_CallProc32WTo32A
    945945 *
    946946 * Call a window procedure, translating args from Unicode to Ansi.
     
    970970    dprintf(("USER32:  GetQueueStatus"));
    971971    queueStatus = OSLibWinQueryQueueStatus();
    972  
     972
    973973    queueStatus = MAKELONG(queueStatus, queueStatus);
    974974    return queueStatus & MAKELONG(flags, flags);
     
    10111011  if (nCount == 0)
    10121012  {
    1013         if(dwMilliseconds == 0) {
    1014                 if(GetQueueStatus(dwWakeMask) == 0) {
    1015                         return WAIT_TIMEOUT;
    1016                 }
    1017                 return WAIT_OBJECT_0;
    1018         }
     1013        if(dwMilliseconds == 0) {
     1014                if(GetQueueStatus(dwWakeMask) == 0) {
     1015                        return WAIT_TIMEOUT;
     1016                }
     1017                return WAIT_OBJECT_0;
     1018        }
    10191019        //SvL: Check time, wait for any message, check msg type and determine if
    10201020        //     we have to return
    1021         //TODO: Timeout isn't handled correctly (can return too late)
    1022         curtime = GetCurrentTime();
     1021        //TODO: Timeout isn't handled correctly (can return too late)
     1022        curtime = GetCurrentTime();
    10231023        endtime = curtime + dwMilliseconds;
    1024         while(curtime < endtime || dwMilliseconds == INFINITE) {
    1025                 if(OSLibWinWaitMessage() == FALSE) {
    1026                         dprintf(("OSLibWinWaitMessage returned FALSE!"));
    1027                         return -1;
    1028                 }
    1029                 if(GetQueueStatus(dwWakeMask) != 0) {
    1030                         return WAIT_OBJECT_0;
    1031                 }
    1032                 curtime = GetCurrentTime();
    1033         }
     1024        while(curtime < endtime || dwMilliseconds == INFINITE) {
     1025                if(OSLibWinWaitMessage() == FALSE) {
     1026                        dprintf(("OSLibWinWaitMessage returned FALSE!"));
     1027                        return -1;
     1028                }
     1029                if(GetQueueStatus(dwWakeMask) != 0) {
     1030                        return WAIT_OBJECT_0;
     1031                }
     1032                curtime = GetCurrentTime();
     1033        }
    10341034        return WAIT_TIMEOUT;
    10351035  }
  • trunk/src/user32/wndmsg.cpp

    r1408 r2204  
    1 /* $Id: wndmsg.cpp,v 1.7 1999-10-23 10:21:45 sandervl Exp $ */
     1/* $Id: wndmsg.cpp,v 1.8 1999-12-26 17:30:20 cbratschi Exp $ */
    22/*
    33 * Win32 window message text function for OS/2
     
    338338    { "WM_INITMENUPOPUP", WM_INITMENUPOPUP,                 // 0x0117
    339339        0},
     340    { "WM_SYSTIMER", WM_SYSTIMER,                           // 0x0118
     341        0},
    340342    { "WM_MENUSELECT", WM_MENUSELECT,                       // 0x011F
    341343        0},
     
    690692                return(gaMsgs[i].pszMsg);
    691693  }
    692   sprintf(msgtxt, "%s %X ", "Unknown Message ", Msg);
     694  if (Msg >= WM_USER)
     695    sprintf(msgtxt,"User Message %X (WM_USER+%d)",Msg,Msg-WM_USER);
     696  else
     697    sprintf(msgtxt, "%s %X ","Unknown Message ", Msg);
    693698  return(msgtxt);
    694699}
Note: See TracChangeset for help on using the changeset viewer.