Changeset 2383 for trunk/src


Ignore:
Timestamp:
Jan 9, 2000, 3:38:30 PM (26 years ago)
Author:
sandervl
Message:

Several updates/bug fixes

Location:
trunk/src/user32
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r2371 r2383  
    1 # $Id: Makefile,v 1.55 2000-01-08 14:15:05 sandervl Exp $
     1# $Id: Makefile,v 1.56 2000-01-09 14:37:08 sandervl Exp $
    22
    33#
     
    4343        win32wbasepos.obj oslibres.obj dummy.obj oslibmenu.obj dc.obj timer.obj \
    4444        caret.obj resource.obj winproc.obj text.obj oslibmsgtranslate.obj \
    45         windlgmsg.obj windlg.obj win32wdesktop.obj pmtitlebar.obj
     45        windlgmsg.obj windlg.obj win32wdesktop.obj pmtitlebar.obj win32wbasepaint.obj
    4646
    4747
     
    136136win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h controls.h winmouse.h $(PDWIN32_INCLUDE)\win\winproc.h $(PDWIN32_INCLUDE)\win\hook.h oslibmsg.h pmtitlebar.h
    137137win32wbasepos.obj: win32wbasepos.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h
     138win32wbasepaint.obj: win32wbasepaint.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h controls.h winmouse.h $(PDWIN32_INCLUDE)\win\winproc.h $(PDWIN32_INCLUDE)\win\hook.h oslibmsg.h pmtitlebar.h
    138139win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
    139140win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h oslibmsg.h controls.h $(PDWIN32_INCLUDE)\win\winproc.h
     
    167168
    168169clean:
    169         $(RM) *.obj *.lib *.dll *.map *.pch *.res *.lrf resource.asm *.lrf
     170        $(RM) *.obj *.lib *.dll *.map *.pch *.res *.lrf resource.asm
    170171        $(RM) $(PDWIN32_BIN)\$(TARGET).dll
    171172        $(RM) $(PDWIN32_LIB)\$(TARGET).lib
  • trunk/src/user32/loadres.cpp

    r2265 r2383  
    1 /* $Id: loadres.cpp,v 1.17 1999-12-30 11:20:34 sandervl Exp $ */
     1/* $Id: loadres.cpp,v 1.18 2000-01-09 14:37:09 sandervl Exp $ */
    22
    33/*
     
    390390 HBITMAP hBitmap = 0;
    391391
     392  return LoadBitmapA((hinst == 0) ? hInstanceUser32:hinst,lpszBitmap,0,0,0);
     393#if 0
    392394  if (!hinst)
    393395  {
     
    399401  } else hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
    400402  dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
    401 
     403#endif
    402404  return(hBitmap);
    403405}
     
    409411 HBITMAP hBitmap = 0;
    410412
    411   if (!hinst)
    412   {
    413     if(IsSystemBitmap((ULONG *)&lpszBitmap))
    414     {
    415       hBitmap = O32_LoadBitmap(hInstanceUser32,(LPCSTR)lpszBitmap);
    416       if (!hBitmap) hBitmap = O32_LoadBitmap(hinst,(LPCSTR)lpszBitmap);
    417     } else hBitmap = 0;
    418   } else
    419   {
    420     if(HIWORD(lpszBitmap) != 0)
    421       lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
    422 
    423     hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
    424 
    425     if(HIWORD(lpszBitmap) != 0)
    426       FreeAsciiString((LPSTR)lpszBitmap);
    427   }
     413  if(HIWORD(lpszBitmap) != 0)
     414    lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
     415
     416  hBitmap = LoadBitmapA((hinst == 0) ? hInstanceUser32:hinst, (LPSTR)lpszBitmap, 0, 0, 0);
     417
     418  if(HIWORD(lpszBitmap) != 0)
     419    FreeAsciiString((LPSTR)lpszBitmap);
    428420
    429421  dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
  • trunk/src/user32/oslibmsgtranslate.cpp

    r2378 r2383  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.10 2000-01-08 16:53:38 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.11 2000-01-09 14:37:09 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    77 * Copyright 1999      Daniela Engert (dani@ngrt.de)
    88 * Copyright 1999      Rene Pronk (R.Pronk@twi.tudelft.nl)
     9 *
     10 * NOTE: WM_NCHITTEST messages are sent whenever the mouse cursor moves or a mouse button is clicked/released
     11 *       (directly when receiving those messages)
    912 *
    1013 * Project Odin Software License can be found in LICENSE.TXT
     
    119122            fIsFrameControl = (win32wnd != 0);
    120123        }
    121         //NOTE: We only translate WM_PAINT/WM_HITTEST & mouse messages; the rest must not be seen by win32 apps
     124        //NOTE: We only translate WM_PAINT, WM_ACTIVATE & mouse messages; the rest must not be seen by win32 apps
    122125  }
    123126  //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle
     
    226229        //     this message
    227230        if(lpRect->right == thdb->wp.x+thdb->wp.cx && lpRect->bottom == thdb->wp.y+thdb->wp.cy) {
    228                 winMsg->message    = WINWM_WINDOWPOSCHANGED;
    229                 winMsg->lParam = (LPARAM)&thdb->wp;
     231                winMsg->message = WINWM_WINDOWPOSCHANGED;
     232                winMsg->lParam  = (LPARAM)&thdb->wp;
    230233        }
    231234        else {
     
    252255        }
    253256
    254         winMsg->message = WINWM_ACTIVATE;
    255         winMsg->wParam  = MAKELONG((SHORT1FROMMP(os2Msg->mp1)) ? WA_ACTIVE_W : WA_INACTIVE_W, fMinimized);
    256         winMsg->lParam  = (LPARAM)hwndActivate;
     257        if(fIsFrameControl) {
     258            fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
     259            winMsg->message = WINWM_NCACTIVATE;
     260            winMsg->wParam  = SHORT1FROMMP(os2Msg->mp1);
     261        }
     262        else
     263        {
     264            winMsg->message = WINWM_ACTIVATE;
     265            winMsg->wParam  = MAKELONG((SHORT1FROMMP(os2Msg->mp1)) ? WA_ACTIVE_W : WA_INACTIVE_W, fMinimized);
     266            winMsg->lParam  = (LPARAM)hwndActivate;
     267        }
    257268        break;
    258269    }
     
    292303    case WM_BUTTON3UP:
    293304    case WM_BUTTON3DBLCLK:
     305    {
     306     ULONG hittest;
     307
    294308        if(fIsFrameControl) {
    295309            fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
    296310        }
    297311
     312        hittest = win32wnd->MsgHitTest(winMsg->pt.x, winMsg->pt.y);
     313
    298314        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    299         if(win32wnd->lastHitTestVal != HTCLIENT_W) {
     315        if(hittest != HTCLIENT_W) {
    300316            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
    301             winMsg->wParam  = win32wnd->lastHitTestVal;
     317            winMsg->wParam  = hittest;
    302318            winMsg->lParam  = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates
    303319        }
     
    311327            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
    312328        }
    313 
    314         break;
     329        break;
     330    }
    315331
    316332    case WM_BUTTON2MOTIONSTART:
     
    327343    case WM_MOUSEMOVE:
    328344    {
    329         ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE;
     345        ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE, hittest;
    330346
    331347        if(fIsFrameControl) {
     
    344360            keystate |= MK_CONTROL_W;
    345361
     362        hittest = win32wnd->MsgHitTest(winMsg->pt.x, winMsg->pt.y);
     363
    346364        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    347         if(win32wnd->lastHitTestVal != HTCLIENT_W)
     365        if(hittest != HTCLIENT_W)
    348366        {
    349367          setcursormsg   = WINWM_NCMOUSEMOVE;
    350           winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
     368          winMsg->wParam = (WPARAM)hittest;
    351369          winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    352370        }
     
    546564
    547565        if(wndParams->fsStatus & WPM_TEXT) {
    548             win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText);
     566            winMsg->message = WINWM_SETTEXT;
     567            winMsg->lParam  = (LPARAM)wndParams->pszText;
    549568            break;
    550569        }
     
    585604        }
    586605        else    winMsg->message = WINWM_PAINT;
    587         break;
    588     }
    589 
    590     case WM_HITTEST:
    591     {
    592         OSLIBPOINT pt;
    593 
    594         fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
    595 
    596         pt.x = (*(POINTS *)&os2Msg->mp1).x;
    597         pt.y = (*(POINTS *)&os2Msg->mp1).y;
    598 
    599         mapOS2ToWin32Point(os2Msg->hwnd,OSLIB_HWND_DESKTOP,&pt);
    600         winMsg->message  = WINWM_NCHITTEST;
    601         winMsg->wParam  = 0;
    602         winMsg->lParam  = MAKELONG((USHORT)pt.x, (USHORT)pt.y);
    603606        break;
    604607    }
  • trunk/src/user32/oslibwin.cpp

    r2371 r2383  
    1 /* $Id: oslibwin.cpp,v 1.57 2000-01-08 14:15:06 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.58 2000-01-09 14:37:09 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    175175  else
    176176  {
    177     if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W)
     177    if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W) {
    178178        *OSFrameStyle |= FCF_DLGBORDER;
     179        *borderHeight = *borderWidth = 2; //TODO: Correct?
     180    }
    179181    else
    180182    {
    181         if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W)
     183        if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
    182184            *OSFrameStyle |= (FCF_TITLEBAR | FCF_BORDER);
     185            *borderHeight = *borderWidth = 1;
     186        }
    183187        else
    184         if(dwStyle & WS_BORDER_W)
     188        if(dwStyle & WS_BORDER_W) {
    185189            *OSFrameStyle |= FCF_BORDER;
     190            *borderHeight = *borderWidth = 1;
     191        }
    186192    }
    187193
     
    191197          *OSFrameStyle |= FCF_HORZSCROLL;
    192198
    193     if(dwStyle & WS_SYSMENU_W)
    194           *OSFrameStyle |= FCF_SYSMENU;
    195199    if(dwStyle & WS_THICKFRAME_W)
    196200          *OSFrameStyle |= FCF_SIZEBORDER;        //??
     
    198202    //SvL: We subclass the titlebar control when win32 look is selected
    199203    if(fOS2Look) {
     204        if(dwStyle & WS_SYSMENU_W)
     205          *OSFrameStyle |= FCF_SYSMENU;
    200206        if(dwStyle & WS_MINIMIZEBOX_W)
    201207          *OSFrameStyle |= FCF_MINBUTTON;
     
    11651171//******************************************************************************
    11661172//******************************************************************************
     1173HWND OSLibWinGetFrameControlHandle(HWND hwndFrame, int framecontrol, RECT *lpRect)
     1174{
     1175    switch(framecontrol) {
     1176    case OSLIB_FID_TITLEBAR:
     1177        framecontrol = FID_TITLEBAR;
     1178        break;
     1179    case OSLIB_FID_SYSMENU:
     1180        framecontrol = FID_SYSMENU;
     1181        break;
     1182    case OSLIB_FID_MENU:
     1183        framecontrol = FID_MENU;
     1184        break;
     1185    default:
     1186        return 0;
     1187    }
     1188    return WinWindowFromID(hwndFrame, framecontrol);
     1189}
     1190//******************************************************************************
     1191//******************************************************************************
  • trunk/src/user32/oslibwin.h

    r2371 r2383  
    1 /* $Id: oslibwin.h,v 1.32 2000-01-08 14:15:06 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.33 2000-01-09 14:37:09 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    289289
    290290HWND  OSLibWinIsFrameControl(HWND hwnd);
     291HWND  OSLibWinGetFrameControlHandle(HWND hwndFrame, int framecontrol);
    291292 
    292293#endif //__OSLIBWIN_H__
  • trunk/src/user32/pmframe.cpp

    r2371 r2383  
    1 /* $Id: pmframe.cpp,v 1.33 2000-01-08 14:15:06 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.34 2000-01-09 14:37:09 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    234234      //CB: call WM_NCCALCSIZE and set client pos
    235235      //    WM_PAINT -> WM_NCPAINT
    236       //    WM_HITTEST -> MsgHitTest()
    237236      //    mouse messages -> MsgButton()
    238237      goto RunDefFrameProc;
     
    320319        dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    321320
     321        //Signal to the children that their parent's window rect has changed
     322        //(the children don't always receive a notification -> their window
     323        // rectangle (in screen coordinates) will get out of sync)
     324        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     325                win32wnd->setWindowRectChanged();
     326        }
     327
    322328        RestoreOS2TIB();
    323329        rc = OldFrameProc(hwnd,msg,mp1,mp2);
     
    337343        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    338344
    339         win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    340         win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    341 
     345        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     346                win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
     347                win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
     348        }
    342349        if(win32wnd->CanReceiveSizeMsgs())
    343350          win32wnd->MsgPosChanged((LPARAM)&wp);
  • trunk/src/user32/pmtitlebar.cpp

    r2371 r2383  
    1 /* $Id: pmtitlebar.cpp,v 1.1 2000-01-08 14:15:38 sandervl Exp $ */
     1/* $Id: pmtitlebar.cpp,v 1.2 2000-01-09 14:37:10 sandervl Exp $ */
    22/*
    33 * Win32 Titlebar Managment Code for OS/2
     
    66 * Copyright 2000 by Christoph Bratschi (cbratschi@datacomm.ch)
    77 *
     8 *
     9 * NOTE:  When fOS2Look == TRUE, mouse message & painting is handled by us
     10 *        (not by the PM titlebar control)
    811 *
    912 * Project Odin Software License can be found in LICENSE.TXT
     
    2730#include "oslibmsg.h"
    2831#include "pmtitlebar.h"
     32#include "pmwindow.h"
    2933
    3034//******************************************************************************
     
    5054  OldTitleBarProc = (PFNWP)win32wnd->getOldTitleBarProc();
    5155
    52   if(msg == WM_MOUSEMOVE) {
    53         rc = 0;
    54   }
    5556  if((thdb->msgstate & 1) == 0)
    5657  {//message that was sent directly to our window proc handler; translate it here
     
    7980  switch(pWinMsg->message)
    8081  {
    81   case WINWM_NCHITTEST:
    82   {
    83       DWORD res;
    84 
    85       // Only send this message if the window is enabled
    86       if (!WinIsWindowEnabled(hwnd))
    87         res = HT_ERROR;
    88       else if (win32wnd->getIgnoreHitTest())
    89         res = HT_NORMAL;
    90       else
    91       {
    92         dprintf(("USER32: WM_HITTEST %x (%d,%d)",hwnd,(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y));
    93 
    94         //CB: WinWindowFromPoint: PM sends WM_HITTEST -> loop -> stack overflow
    95         win32wnd->setIgnoreHitTest(TRUE);
    96         res = win32wnd->MsgHitTest(pWinMsg);
    97         win32wnd->setIgnoreHitTest(FALSE);
    98       }
    99       RestoreOS2TIB();
    100       return (MRESULT)res;
    101   }
    10282  case WINWM_NCPAINT:
    10383        win32wnd->DispatchMsgA(pWinMsg);
    104         if(win32wnd->getDefWndProcCalled())
    105                 goto RunDefTitleBarProc;
    10684        goto RunDefWndProc;
    10785
     86  case WINWM_NCACTIVATE:
     87        win32wnd->DispatchMsgA(pWinMsg);
     88        break;
     89       
    10890  case WINWM_NCLBUTTONDOWN:
    10991  case WINWM_NCLBUTTONUP:
     
    11698  case WINWM_NCRBUTTONDBLCLK:
    11799        win32wnd->MsgButton(pWinMsg);
    118         if(win32wnd->getDefWndProcCalled())
    119                 goto RunDefTitleBarProc;
    120 
    121100        rc = TRUE;
    122101        break;
     
    124103  case WINWM_NCMOUSEMOVE:
    125104  {
    126         //OS/2 Window coordinates -> Win32 Window coordinates
    127105        win32wnd->MsgMouseMove(pWinMsg);
    128         if(win32wnd->getDefWndProcCalled())
    129                 goto RunDefTitleBarProc;
    130106        break;
    131107  }
  • trunk/src/user32/pmwindow.cpp

    r2371 r2383  
    1 /* $Id: pmwindow.cpp,v 1.75 2000-01-08 14:15:07 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.76 2000-01-09 14:37:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    9595     (PSZ)WIN32_STDCLASS,               /* Window class name            */
    9696     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
    97      CS_HITTEST,
     97     0,
    9898     NROF_WIN32WNDBYTES)) {
    9999        dprintf(("WinRegisterClass Win32BaseWindow failed"));
     
    472472        win32wnd->DispatchMsgA(pWinMsg);
    473473        goto RunDefWndProc;
    474 
    475     case WM_HITTEST:
    476     {
    477       DWORD res;
    478 
    479       // Only send this message if the window is enabled
    480       if (!WinIsWindowEnabled(hwnd))
    481         res = HT_ERROR;
    482       else if (win32wnd->getIgnoreHitTest())
    483         res = HT_NORMAL;
    484       else
    485       {
    486         dprintf(("USER32: WM_HITTEST %x (%d,%d)",hwnd,(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y));
    487 
    488         //CB: WinWindowFromPoint: PM sends WM_HITTEST -> loop -> stack overflow
    489         win32wnd->setIgnoreHitTest(TRUE);
    490         res = win32wnd->MsgHitTest(pWinMsg);
    491         win32wnd->setIgnoreHitTest(FALSE);
    492       }
    493       RestoreOS2TIB();
    494       return (MRESULT)res;
    495     }
    496474
    497475    case WM_CONTEXTMENU:
  • trunk/src/user32/win32wbase.cpp

    r2374 r2383  
    1 /* $Id: win32wbase.cpp,v 1.134 2000-01-08 14:41:27 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.135 2000-01-09 14:37:11 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    151151  fParentDC            = FALSE;
    152152  fDefWndProcCalled    = FALSE;
     153  fWindowRectChanged   = FALSE; //Set when parent window has been moved; cleared when window rect is updated
    153154
    154155  windowNameA      = NULL;
     
    193194  isIcon           = FALSE;
    194195  lastHitTestVal   = HTOS_NORMAL;
    195   fIgnoreHitTest   = FALSE;
    196196  owner            = NULL;
    197197  windowClass      = 0;
     
    645645  subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);
    646646
    647 //  FrameSubclassTitleBar(this);
     647  if(!fOS2Look)
     648    FrameSubclassTitleBar(this);
    648649
    649650  fakeWinBase.hwndThis     = OS2Hwnd;
     
    864865}
    865866//******************************************************************************
    866 //******************************************************************************
    867 ULONG Win32BaseWindow::MsgHitTest(MSG *msg)
    868 {
    869   lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)msg->pt.x, (USHORT)msg->pt.y));
    870   dprintf2(("MsgHitTest returned %x", lastHitTestVal));
    871 
    872   if (lastHitTestVal == HTERROR)
    873     return HTOS_ERROR;
    874 
    875 #if 0 //CB: problems with groupboxes, internal handling is better
    876   if (lastHitTestVal == HTTRANSPARENT)
    877     return HTOS_TRANSPARENT;
    878 #endif
    879 
    880   return HTOS_NORMAL;
     867// NOTE: WM_NCHITTEST messages are sent whenever the mouse cursor moves or a mouse button is clicked/released
     868//       (directly when receiving those messages)
     869//******************************************************************************
     870ULONG Win32BaseWindow::MsgHitTest(ULONG x, ULONG y)
     871{
     872  lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y));
     873  dprintf(("MsgHitTest (%d,%d) (%d,%d) (%d,%d) returned %x", x, y, rectWindow.left, rectWindow.right, rectWindow.top, rectWindow.bottom, lastHitTestVal));
     874  return lastHitTestVal;
    881875}
    882876//******************************************************************************
     
    12391233}
    12401234/***********************************************************************
    1241  *           NC_HandleNCLButtonDown
    1242  *
    1243  * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
    1244  */
    1245 LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
    1246 {
    1247   switch(wParam)  /* Hit test */
    1248   {
    1249     case HTCAPTION:
    1250       SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
    1251       break;
    1252 
    1253     case HTSYSMENU:
    1254       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
    1255       break;
    1256 
    1257     case HTMENU:
    1258       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
    1259       break;
    1260 
    1261     case HTHSCROLL:
    1262       SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
    1263       break;
    1264 
    1265     case HTVSCROLL:
    1266       SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
    1267       break;
    1268 
    1269     case HTLEFT:
    1270     case HTRIGHT:
    1271     case HTTOP:
    1272     case HTTOPLEFT:
    1273     case HTTOPRIGHT:
    1274     case HTBOTTOM:
    1275     case HTBOTTOMLEFT:
    1276     case HTBOTTOMRIGHT:
    1277         /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
    1278         SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
    1279         break;
    1280     case HTBORDER:
    1281         break;
    1282   }
    1283 
    1284   return 0;
    1285 }
    1286 //******************************************************************************
    1287 //******************************************************************************
    1288 LONG Win32BaseWindow::HandleNCLButtonUp(WPARAM wParam,LPARAM lParam)
    1289 {
    1290   switch(wParam)  /* Hit test */
    1291   {
    1292     case HTMINBUTTON:
    1293       SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,lParam);
    1294       break;
    1295 
    1296     case HTMAXBUTTON:
    1297       SendInternalMessageA(WM_SYSCOMMAND,SC_MAXIMIZE,lParam);
    1298       break;
    1299 
    1300     case HTCLOSE:
    1301       SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
    1302       break;
    1303   }
    1304 
    1305   return 0;
    1306 }
    1307 /***********************************************************************
    1308  *           NC_HandleNCLButtonDblClk
    1309  *
    1310  * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
    1311  */
    1312 LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
    1313 {
    1314   /*
    1315    * if this is an icon, send a restore since we are handling
    1316    * a double click
    1317    */
    1318   if (dwStyle & WS_MINIMIZE)
    1319   {
    1320     SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
    1321     return 0;
    1322   }
    1323 
    1324   switch(wParam)  /* Hit test */
    1325   {
    1326     case HTCAPTION:
    1327       /* stop processing if WS_MAXIMIZEBOX is missing */
    1328       if (dwStyle & WS_MAXIMIZEBOX)
    1329         SendInternalMessageA(WM_SYSCOMMAND,
    1330                       (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
    1331                       lParam);
    1332       break;
    1333 
    1334     case HTSYSMENU:
    1335       if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
    1336         SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
    1337       break;
    1338 
    1339     case HTHSCROLL:
    1340       SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
    1341       break;
    1342 
    1343     case HTVSCROLL:
    1344       SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
    1345       break;
    1346   }
    1347 
    1348   return 0;
    1349 }
    1350 /***********************************************************************
    13511235 *           NC_HandleSysCommand
    13521236 *
     
    16051489        setStyle(getStyle() | WS_VISIBLE);
    16061490        OSLibWinEnableWindowUpdate(OS2HwndFrame,TRUE);
    1607       } else
     1491      }
     1492      else
    16081493      {
    16091494        if (getStyle() & WS_VISIBLE)
     
    16151500      return 0;
    16161501    }
    1617 
    1618     case WM_NCPAINT:
    1619         return 0;
    1620 
    1621     case WM_NCACTIVATE:
    1622         return TRUE;
    1623 
    1624     case WM_NCCREATE:
    1625         return(TRUE);
    1626 
    1627     case WM_NCDESTROY:
    1628         return 0;
    1629 
    1630     case WM_NCCALCSIZE:
    1631         return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam);
    16321502
    16331503    case WM_CTLCOLORMSGBOX:
     
    17781648          if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon())
    17791649          {
    1780             int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
    1781             int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
     1650            int x = (getWindowRect()->right - getWindowRect()->left - GetSystemMetrics(SM_CXICON))/2;
     1651            int y = (getWindowRect()->bottom - getWindowRect()->top - GetSystemMetrics(SM_CYICON))/2;
    17821652            dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
    17831653            DrawIcon(hdc, x, y, getWindowClass()->getIcon() );
     
    17911661        return 0;
    17921662
     1663    case WM_NCPAINT:
     1664        if(!fOS2Look) {
     1665            HandleNCPaint(wParam, FALSE);
     1666        }
     1667        return 0;
     1668
     1669    case WM_NCACTIVATE:
     1670        if(!fOS2Look) {
     1671            return HandleNCActivate(wParam);
     1672        }
     1673        return TRUE;
     1674
     1675    case WM_NCCREATE:
     1676        return(TRUE);
     1677
     1678    case WM_NCDESTROY:
     1679        return 0;
     1680
     1681    case WM_NCCALCSIZE:
     1682        return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam);
     1683
    17931684    case WM_NCLBUTTONDOWN:
    1794         return HandleNCLButtonDown(wParam,lParam);
     1685        if(!fOS2Look) {
     1686            return HandleNCLButtonDown(wParam,lParam);
     1687        }
     1688        return 0;
    17951689
    17961690    case WM_NCLBUTTONUP:
    1797         return HandleNCLButtonUp(wParam,lParam);
     1691        if(!fOS2Look) {
     1692            return HandleNCLButtonUp(wParam,lParam);
     1693        }
     1694        return 0;
    17981695
    17991696    case WM_NCLBUTTONDBLCLK:
    1800         return HandleNCLButtonDblClk(wParam,lParam);
     1697        if(!fOS2Look) {
     1698            return HandleNCLButtonDblClk(wParam,lParam);
     1699        }
     1700        return 0;
    18011701
    18021702    case WM_NCRBUTTONDOWN:
     
    18181718      point.y = (SHORT)HIWORD(lParam);
    18191719
    1820       return FrameHitTest(this,point.x,point.y);
     1720      if(fOS2Look) {
     1721                return FrameHitTest(this, point.x, point.y);
     1722      }
     1723      else      return HandleNCHitTest(point);
    18211724    }
    18221725
     
    23162219}
    23172220//******************************************************************************
     2221//When our parent window is moved, we aren't notified of the change (rectWindow is in
     2222//screen coordinates, so it needs to be updated)
     2223//Set the fWindowRectChanged flag and do the same for all the children
     2224//Whenever getWindowRect is called and this flag is set, it refreshes the rectWindow structure
     2225//******************************************************************************
     2226void Win32BaseWindow::setWindowRectChanged()
     2227{
     2228 Win32BaseWindow *child;
     2229
     2230    fWindowRectChanged = TRUE;
     2231
     2232    child = (Win32BaseWindow *)getFirstChild();
     2233    while(child)
     2234    {
     2235        child->setWindowRectChanged();
     2236        child = (Win32BaseWindow *)child->getNextChild();
     2237    }
     2238}
     2239//******************************************************************************
     2240//******************************************************************************
     2241PRECT Win32BaseWindow::getWindowRect()
     2242{
     2243    if(fWindowRectChanged) {
     2244        OSLibWinQueryWindowRect(getOS2FrameWindowHandle(), &rectWindow, RELATIVE_TO_SCREEN);
     2245        fWindowRectChanged = FALSE;
     2246    }
     2247    return &rectWindow;
     2248}
     2249//******************************************************************************
     2250//******************************************************************************
     2251void Win32BaseWindow::setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
     2252{
     2253    fWindowRectChanged = FALSE;
     2254
     2255    rectWindow.left   = left;
     2256    rectWindow.top    = top;
     2257    rectWindow.right  = right;
     2258    rectWindow.bottom = bottom;
     2259}
     2260//******************************************************************************
     2261//******************************************************************************
     2262void Win32BaseWindow::setWindowRect(PRECT rect)
     2263{
     2264    fWindowRectChanged = FALSE;
     2265
     2266    rectWindow = *rect;
     2267}
     2268//******************************************************************************
    23182269//******************************************************************************
    23192270BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
     
    28822833    return OSLibWinIsWindowVisible(OS2HwndFrame);
    28832834#endif
    2884 }
    2885 //******************************************************************************
    2886 //******************************************************************************
    2887 BOOL Win32BaseWindow::GetWindowRect(PRECT pRect)
    2888 {
    2889     return OSLibWinQueryWindowRect(OS2HwndFrame, pRect, RELATIVE_TO_SCREEN);
    28902835}
    28912836//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r2371 r2383  
    1 /* $Id: win32wbase.h,v 1.67 2000-01-08 14:15:09 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.68 2000-01-09 14:37:12 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    8484         ULONG  MsgEraseBackGround(HDC hdc);
    8585         ULONG  MsgInitMenu(MSG *msg);
    86          ULONG  MsgHitTest(MSG *msg);
     86         ULONG  MsgHitTest(ULONG x, ULONG y);
    8787         ULONG  MsgNCPaint();
    8888         ULONG  DispatchMsgA(MSG *msg);
     
    110110         HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
    111111 Win32WndClass *getWindowClass()                { return windowClass; };
    112 
    113          BOOL   getIgnoreHitTest()              { return fIgnoreHitTest; }
    114          VOID   setIgnoreHitTest(BOOL ignore)   { fIgnoreHitTest = ignore; }
    115112
    116113         BOOL   getDefWndProcCalled()           { return fDefWndProcCalled; };
     
    139136         PRECT  getClientRect()                 { return &rectClient; };
    140137         void   setClientRect(PRECT rect)       { rectClient = *rect; };
    141          PRECT  getWindowRect()                 { return &rectWindow; };
    142138         void   setClientRect(LONG left, LONG top, LONG right, LONG bottom)
    143139         {
     
    145141                rectClient.right = right; rectClient.bottom = bottom;
    146142         };
    147          void   setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
    148          {
    149                 rectWindow.left  = left;  rectWindow.top    = top;
    150                 rectWindow.right = right; rectWindow.bottom = bottom;
    151          };
    152          void   setWindowRect(PRECT rect)       { rectWindow = *rect; };
     143         PRECT  getWindowRect();
     144         void   setWindowRect(LONG left, LONG top, LONG right, LONG bottom);
     145         void   setWindowRect(PRECT rect);
     146         void   setWindowRectChanged();
     147
    153148         DWORD  getFlags()                      { return flags; };
    154149         void   setFlags(DWORD newflags)        { flags = newflags; };
     
    196191         BOOL   IsWindowUnicode();
    197192
    198          BOOL   GetWindowRect(PRECT pRect);
    199193         int    GetWindowTextLength();
    200194         int    GetWindowTextA(LPSTR lpsz, int cch);
     
    304298        DWORD   contextHelpId;
    305299        LONG    lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
    306         BOOL    fIgnoreHitTest;         //Use WinWindowFromPoint during WM_HITTEST
    307 
    308         BOOL    isIcon;
    309         BOOL    fFirstShow;
    310         BOOL    fIsDialog;
    311         BOOL    fIsModalDialog;
    312         BOOL    fIsModalDialogOwner;
     300
    313301        HWND    OS2HwndModalDialog;
    314         BOOL    fInternalMsg;           //Used to distinguish between messages
    315                                         //sent by PM and those sent by apps
    316         BOOL    fNoSizeMsg;
    317         BOOL    fIsDestroyed;
    318         BOOL    fDestroyWindowCalled;   //DestroyWindow was called for this window
    319         BOOL    fCreated;
    320         BOOL    fTaskList;              //should be listed in PM tasklist or not
    321         BOOL    fParentDC;
    322 
    323         BOOL    fDefWndProcCalled;      //set when DefWndProc called; used in PM window handlers to determine what to do next
     302
     303        ULONG   isIcon               :1,
     304                fFirstShow           :1,
     305                fIsDialog            :1,
     306                fIsModalDialog       :1,
     307                fIsModalDialogOwner  :1,
     308                fInternalMsg         :1, //Used to distinguish between messages
     309                                         //sent by PM and those sent by apps
     310                fNoSizeMsg           :1,
     311                fIsDestroyed         :1,
     312                fDestroyWindowCalled :1, //DestroyWindow was called for this window
     313                fCreated             :1,
     314                fTaskList            :1, //should be listed in PM tasklist or not
     315                fParentDC            :1,
     316                fIsSubclassedOS2Wnd  :1, //subclassed OS/2 window: Netscape plug-in/scrollbar
     317                fDefWndProcCalled    :1, //set when DefWndProc called; used in PM window handlers to determine what to do next
     318                fWindowRectChanged   :1; //Set when parent window has been moved; cleared when window rect is updated
    324319
    325320        HRGN    hWindowRegion;
     
    334329
    335330        PVOID   pOldWndProc;
    336         BOOL    fIsSubclassedOS2Wnd;  //subclassed OS/2 window: Netscape plug-in/scrollbar
    337331
    338332   Win32BaseWindow *owner;
     
    365359        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    366360        LONG  HandleWindowPosChanging(WINDOWPOS *winpos);
    367         LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
    368         LONG  HandleNCLButtonUp(WPARAM wParam,LPARAM lParam);
    369         LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
    370361        LONG  HandleSysCommand(WPARAM wParam, POINT *pt32);
    371362
     
    386377friend BOOL  OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fTranslateExtraMsgs);
    387378#endif
     379
     380        //painting & non-client methods
     381        BOOL  DrawSysButton(HDC hdc,BOOL down);
     382        BOOL  DrawGrayButton(HDC hdc,int x,int y);
     383        VOID  DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed);
     384        VOID  DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed);
     385        VOID  DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed);
     386        VOID  DrawCaption(HDC hdc,RECT *rect,BOOL active);
     387        VOID  DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active);
     388
     389        VOID  GetInsideRect(RECT *rect);
     390
     391        VOID  TrackMinMaxBox(WORD wParam);
     392        VOID  TrackCloseButton(WORD wParam);
     393
     394        VOID  HandleNCPaint(HRGN clip,BOOL suppress_menupaint);
     395        LONG  HandleNCHitTest(POINT pt);
     396        LONG  HandleNCActivate(WPARAM wParam);
     397        LONG  HandleNCLButtonDown(WPARAM wParam,LPARAM lParam);
     398        LONG  HandleNCLButtonUp(WPARAM wParam,LPARAM lParam);
     399        LONG  HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam);
    388400
    389401public:
  • trunk/src/user32/win32wbasepos.cpp

    r2084 r2383  
    1 /* $Id: win32wbasepos.cpp,v 1.7 1999-12-16 00:11:47 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.8 2000-01-09 14:37:12 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    8686    LPINTERNALPOS lpPos;
    8787
    88     size.x = rectWindow.left; size.y = rectWindow.top;
    89     lpPos = WINPOS_InitInternalPos( wndPtr, size, &rectWindow );
     88    size.x = getWindowRect()->left; size.y = getWindowRect()->top;
     89    lpPos = WINPOS_InitInternalPos( wndPtr, size, getWindowRect() );
    9090
    9191    if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))
  • trunk/src/user32/window.cpp

    r2257 r2383  
    1 /* $Id: window.cpp,v 1.46 1999-12-29 22:54:04 cbratschi Exp $ */
     1/* $Id: window.cpp,v 1.47 2000-01-09 14:37:12 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    648648        return 0;
    649649    }
    650     rc = window->GetWindowRect(pRect);
     650    *pRect = *window->getWindowRect();
    651651    dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
    652     return rc;
     652    return TRUE;
    653653}
    654654//******************************************************************************
     
    10091009    DWP *pDWP;
    10101010
    1011     dprintf(("USER32:  BeginDeferWindowPos\n"));
     1011    dprintf(("USER32: BeginDeferWindowPos %x", count));
    10121012    if (count <= 0)
    10131013    {
Note: See TracChangeset for help on using the changeset viewer.