Changeset 1333 for trunk/src


Ignore:
Timestamp:
Oct 17, 1999, 2:17:46 PM (26 years ago)
Author:
cbratschi
Message:

added WINE scrollbars to frame, fixed pmframe, WM_ENTERIDLE

Location:
trunk/src/user32
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/dc.cpp

    r1281 r1333  
    1 /* $Id: dc.cpp,v 1.13 1999-10-14 09:22:38 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.14 1999-10-17 12:17:42 cbratschi Exp $ */
    22
    33/*
     
    667667//   {
    668668//      WinSendMsg( hwnd, /* WM_DRAW */ 0x20D, (MPARAM)hps, MPVOID );
    669       selectClientArea(wnd, pHps, &rect);
     669      //CB: subclassed window haven't got a frame
     670      if (!wnd->isSubclassedOS2Wnd()) selectClientArea(wnd, pHps, &rect);
    670671//   }
    671672
  • trunk/src/user32/listbox.cpp

    r1297 r1333  
    1 /* $Id: listbox.cpp,v 1.6 1999-10-14 18:27:55 sandervl Exp $ */
     1/* $Id: listbox.cpp,v 1.7 1999-10-17 12:17:42 cbratschi Exp $ */
    22/*
    33 * Listbox controls
     
    2424 * - Unicode
    2525 * - Locale handling
    26  CB:
    27   - KillSystemTimer, SetSystemTimer
    2826 */
    2927
     
    201199    else
    202200    {
    203         info.nPos  = descr->top_item;
     201        info.nPos  = descr->top_item;
    204202
    205203        info.nPage = LISTBOX_GetCurrentPageSize( hwnd, descr );
     
    212210            info.fMask |= SIF_DISABLENOSCROLL;
    213211
    214         if(info.nMax > (INT)info.nPage) {
    215             ShowScrollBar(hwnd, SB_VERT, TRUE);
    216             EnableScrollBar(hwnd, SB_VERT, ESB_ENABLE_BOTH);           
     212        if(info.nMax > (INT)info.nPage) {
     213            ShowScrollBar(hwnd, SB_VERT, TRUE);
     214            EnableScrollBar(hwnd, SB_VERT, ESB_ENABLE_BOTH);
    217215            SetScrollInfo( hwnd, SB_VERT, &info, TRUE );
    218         }
    219         else {
    220             ShowScrollBar(hwnd, SB_VERT, FALSE);
    221             EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);           
    222         }
     216        }
     217        else {
     218            ShowScrollBar(hwnd, SB_VERT, FALSE);
     219            EnableScrollBar(hwnd, SB_VERT, ESB_DISABLE_BOTH);
     220        }
    223221
    224222        if (descr->horz_extent)
     
    19021900static LRESULT LISTBOX_HandleLButtonUp( HWND hwnd, LB_DESCR *descr )
    19031901{
    1904 /* CB: implement!
    19051902    if (LISTBOX_Timer != LB_TIMER_NONE)
    19061903        KillSystemTimer( hwnd, LB_TIMER_ID );
    1907 */
     1904
    19081905    LISTBOX_Timer = LB_TIMER_NONE;
    19091906    if (descr->captured)
     
    19631960    if (!LISTBOX_HandleTimer( hwnd, descr, descr->focus_item, LISTBOX_Timer ))
    19641961    {
    1965 /* CB: implement!
    19661962        KillSystemTimer( hwnd, LB_TIMER_ID );
    1967 */
     1963
    19681964        LISTBOX_Timer = LB_TIMER_NONE;
    19691965    }
     
    20162012    /* Start/stop the system timer */
    20172013
    2018 /* CB: implement!
    20192014    if (dir != LB_TIMER_NONE)
    20202015        SetSystemTimer( hwnd, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL);
    2021 */
    2022 /* CB: implement!
    20232016    else if (LISTBOX_Timer != LB_TIMER_NONE)
    20242017        KillSystemTimer( hwnd, LB_TIMER_ID );
    2025 */
     2018
    20262019    LISTBOX_Timer = dir;
    20272020}
     
    25662559            LISTBOX_HandleMouseMove( hwnd, descr, (INT16)LOWORD(lParam),
    25672560                                     (INT16)HIWORD(lParam) );
    2568         return 1; //SvL: Bugfix -> PMWINDOW expects non-zero return value if
     2561        return 1; //SvL: Bugfix -> PMWINDOW expects non-zero return value if
    25692562                  //               we want to restore the default mouse cursor
    25702563
     
    26782671
    26792672                   GetClientRect(hwnd, &clientRect);
    2680                    if (PtInRect( &clientRect, mousePos ))
    2681                    {
    2682                        captured = descr->captured;
    2683                        descr->captured = TRUE;                 
    2684                
    2685                        LISTBOX_HandleMouseMove( hwnd, descr,
    2686                                                     mousePos.x, mousePos.y);
     2673                   if (PtInRect( &clientRect, mousePos ))
     2674                   {
     2675                       captured = descr->captured;
     2676                       descr->captured = TRUE;
     2677
     2678                       LISTBOX_HandleMouseMove( hwnd, descr,
     2679                                                    mousePos.x, mousePos.y);
    26872680                       descr->captured = captured;
    26882681                   }
    26892682                   else
    26902683                   {
    2691                        LISTBOX_HandleMouseMove( hwnd, descr,
    2692                                                     mousePos.x, mousePos.y);
     2684                       LISTBOX_HandleMouseMove( hwnd, descr,
     2685                                                    mousePos.x, mousePos.y);
    26932686                   }
    26942687
  • trunk/src/user32/oslibwin.cpp

    r1299 r1333  
    1 /* $Id: oslibwin.cpp,v 1.29 1999-10-14 19:31:30 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.30 1999-10-17 12:17:43 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    7373
    7474        dwFrameStyle |= FCF_NOBYTEALIGN;
    75         if (hwndParent == HWND_DESKTOP && dwFrameStyle & FCF_TITLEBAR) 
    76                 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
     75        if (hwndParent == HWND_DESKTOP && dwFrameStyle & FCF_TITLEBAR)
     76                dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
    7777
    7878        dwWinStyle   &= ~WS_CLIPCHILDREN;
     
    147147      *OSFrameStyle |= FCF_SIZEBORDER;
    148148      *borderHeight = *borderWidth = 2;
    149     } 
     149    }
    150150    else
    151151    if(dwStyle & WS_BORDER_W)
     
    160160    if(dwStyle & WS_HSCROLL_W)
    161161          *OSFrameStyle |= FCF_HORZSCROLL;
    162   } 
     162  }
    163163  else
    164164  {
     
    191191  //Clear certain frame bits when the window doesn't have a titlebar
    192192  if(!(*OSFrameStyle & FCF_TITLEBAR)) {
    193         *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
     193        *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
    194194  }
    195195  return TRUE;
     
    642642         }
    643643      }
    644  
     644
    645645      if (flags & SWP_SIZE)
    646646      {
     
    654654      }
    655655      y  = parentHeight - y - cy;
    656      
     656
    657657
    658658       if ((pswpOld->x == x) && (pswpOld->y == y))
     
    678678{
    679679 BOOL rc;
    680  
     680
    681681   WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
    682682
     
    764764//******************************************************************************
    765765//******************************************************************************
    766 BOOL OSLibWinShowScrollBar(HWND hwndParent, HWND hwndScroll, int scrollBar, 
     766BOOL OSLibWinShowScrollBar(HWND hwndParent, HWND hwndScroll, int scrollBar,
    767767                           BOOL fShow, BOOL fForceChange)
    768768{
     
    956956//******************************************************************************
    957957//******************************************************************************
     958PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
     959{
     960  return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
     961}
     962//******************************************************************************
     963//******************************************************************************
     964
  • trunk/src/user32/oslibwin.h

    r1297 r1333  
    1 /* $Id: oslibwin.h,v 1.16 1999-10-14 18:27:57 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.17 1999-10-17 12:17:43 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3838
    3939HWND  OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
    40                            char *pszName, HWND Owner, ULONG fHWND_BOTTOM, 
     40                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM,
    4141                           HWND *hwndFrame, ULONG id);
    4242
     
    273273void  OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd);
    274274
     275PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc);
     276
    275277#endif //__OSLIBWIN_H__
  • trunk/src/user32/pmframe.cpp

    r1303 r1333  
    1 /* $Id: pmframe.cpp,v 1.6 1999-10-14 21:37:44 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.7 1999-10-17 12:17:44 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    183183
    184184      wndchild = Win32BaseWindow::GetWindowFromOS2FrameHandle(pswp->hwnd);
    185       if(wndchild && wndchild->isChild()) 
     185      if(wndchild && wndchild->isChild())
    186186      {
    187187#if 0
    188188       SWP swp = *pswp;
    189189
    190         MRESULT rc = OldFrameProc(hwnd, msg, mp1, mp2);
    191         pswp->x = swp.x;
    192         pswp->y = swp.y;
    193         pswp->fl = swp.fl;
     190        MRESULT rc = OldFrameProc(hwnd, msg, mp1, mp2);
     191        pswp->x = swp.x;
     192        pswp->y = swp.y;
     193        pswp->fl = swp.fl;
    194194#endif
    195         dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    196         RestoreOS2TIB();
    197         return (MRESULT)0;
     195        dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     196        RestoreOS2TIB();
     197        return (MRESULT)0;
    198198      }
    199199      goto RunDefFrameProc;
     
    272272
    273273          GetSizeBox(win32wnd,&rect);
    274           hps = WinGetPS(hwnd);
     274          hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN);
    275275          DrawSizeBox(hps,rect);
    276276          WinReleasePS(hps);
     
    289289        SetWin32TIB();
    290290
     291        WinQueryWindowRect(hwnd,&rect);
     292        rect.xRight = rect.xRight-rect.xLeft;
     293        rect.yTop = rect.yTop-rect.yBottom;
     294        rect.xLeft = rect.yBottom = 0;
    291295        hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN);
    292         WinQueryWindowRect(hwnd,&rect);
    293296        DrawFrame(hps,&rect,win32wnd);
    294         WinFillRect(hps,&rect,SYSCLR_DIALOGBACKGROUND);
    295297        WinReleasePS(hps);
    296298
     
    316318
    317319          GetSizeBox(win32wnd,&rect);
    318           hps = WinGetPS(hwnd);
     320          hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN);
    319321          DrawSizeBox(hps,rect);
    320322          WinReleasePS(hps);
     
    323325          return res;
    324326        } else goto RunDefFrameProc;
    325       }
    326 //SvL: I doubt this is necessary. Just look at winhlp32. First it draws the
    327 //     the background gray and then white.
    328 #if 0
    329       else
     327      } else
    330328      {
    331329        RECTL rect;
    332         HPS hps = WinBeginPaint(hwnd,0,&rect);
    333 
     330        HPS hps;
     331
     332        RestoreOS2TIB();
     333        OldFrameProc(hwnd,msg,mp1,mp2);
     334        SetWin32TIB();
     335
     336        WinQueryWindowRect(hwnd,&rect);
     337        rect.xRight = rect.xRight-rect.xLeft;
     338        rect.yTop = rect.yTop-rect.yBottom;
     339        rect.xLeft = rect.yBottom = 0;
     340        hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN);
    334341        DrawFrame(hps,&rect,win32wnd);
    335         WinFillRect(hps,&rect,SYSCLR_DIALOGBACKGROUND);
    336         WinEndPaint(hps);
     342        WinReleasePS(hps);
    337343
    338344        RestoreOS2TIB();
    339345        return (MRESULT)0;
    340346      }
    341 #endif
    342347
    343348    default:
  • trunk/src/user32/pmwindow.cpp

    r1324 r1333  
    1 /* $Id: pmwindow.cpp,v 1.32 1999-10-16 18:56:51 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.33 1999-10-17 12:17:44 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    257257
    258258        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    259         if (!win32wnd->CanReceiveSizeMsgs())    break;
     259        if (!win32wnd->CanReceiveSizeMsgs())    break;
    260260
    261261        WinQueryWindowPos(hwnd, &swpOld);
     
    263263        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    264264            if (win32wnd->isChild()) {
    265                 if(win32wnd->getParent()) {
    266                         hParent = win32wnd->getParent()->getOS2WindowHandle();
    267                 }
    268                 else    break;
    269             }
     265                if(win32wnd->getParent()) {
     266                        hParent = win32wnd->getParent()->getOS2WindowHandle();
     267                }
     268                else    break;
     269            }
    270270            else
    271271                hFrame = win32wnd->getOS2FrameWindowHandle();
     
    297297
    298298        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    299         if (!win32wnd->CanReceiveSizeMsgs())    break;
     299        if (!win32wnd->CanReceiveSizeMsgs())    break;
    300300
    301301        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    302302            if (win32wnd->isChild()) {
    303                 if(win32wnd->getParent()) {
    304                         hParent = win32wnd->getParent()->getOS2WindowHandle();
    305                 }
    306                 else    goto RunDefWndProc; //parent has just been destroyed
     303                if(win32wnd->getParent()) {
     304                        hParent = win32wnd->getParent()->getOS2WindowHandle();
     305                }
     306                else    goto RunDefWndProc; //parent has just been destroyed
    307307            }
    308308            else
     
    311311        OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
    312312
    313         SWP swpFrame;
     313        SWP swpFrame;
    314314        WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swpFrame);
    315315        dprintf(("WINDOWPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), win32wnd->getOS2FrameWindowHandle(),
    316316                         swpFrame.fl,swpFrame.x, swpFrame.y, swpFrame.cx, swpFrame.cy));
    317         POINTL point;
    318 
    319         point.x = swpFrame.x;
    320         point.y = swpFrame.y;
    321         if(win32wnd->getParent() != NULL)
    322         {
    323                 WinMapWindowPoints(WinQueryWindow(hwnd, QW_PARENT), HWND_DESKTOP,
    324                                    &point, 1);
    325         }
    326         point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
     317        POINTL point;
     318
     319        point.x = swpFrame.x;
     320        point.y = swpFrame.y;
     321        if(win32wnd->getParent() != NULL)
     322        {
     323                WinMapWindowPoints(WinQueryWindow(hwnd, QW_PARENT), HWND_DESKTOP,
     324                                   &point, 1);
     325        }
     326        point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
    327327        win32wnd->setWindowRect(point.x, point.y, point.x+swpFrame.cx, point.y+swpFrame.cy);
    328328        win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
     
    614614    //Slider messages
    615615    //**************************************************************************
     616/* CB: handled internally
    616617    case WM_VSCROLL:
    617618    case WM_HSCROLL:
     
    630631    break;
    631632    }
     633*/
    632634
    633635    case WM_CONTROL:
     
    845847    case WM_ERASEBACKGROUND:
    846848    {
    847         dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
     849        dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
    848850        if (!win32wnd->isSupressErase()) {
    849851            BOOL erased = sendEraseBkgnd (win32wnd);
     
    916918//******************************************************************************
    917919//******************************************************************************
     920MRESULT EXPENTRY Win32SubclassWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     921{
     922  Win32BaseWindow* win32wnd;
     923
     924  //Restore our FS selector
     925  SetWin32TIB();
     926
     927  win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
     928
     929  if (!win32wnd)
     930  {
     931    dprintf(("Invalid win32wnd pointer for subclassed window %x!!", hwnd));
     932    goto RunDefWndProc;
     933  }
     934
     935  switch (msg)
     936  {
     937    case WM_WINDOWPOSCHANGED:
     938      {
     939        PSWP      pswp  = (PSWP)mp1;
     940        PSWP      pswpo = pswp + 1;
     941        WINDOWPOS wp;
     942        HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
     943
     944        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
     945
     946        if(pswp->fl & (SWP_MOVE | SWP_SIZE))
     947          hFrame = WinQueryWindow(hwnd, QW_PARENT);
     948
     949        OSLibMapSWPtoWINDOWPOS(pswp,&wp,pswpo,hParent,hFrame);
     950        win32wnd->MsgPosChanged((LPARAM)&wp);
     951
     952        goto RunOldWndProc;
     953      }
     954
     955    default:
     956      goto RunDefHandler;
     957  }
     958
     959RunDefWndProc:
     960  RestoreOS2TIB();
     961  return WinDefWindowProc(hwnd,msg,mp1,mp2);
     962
     963RunOldWndProc:
     964  RestoreOS2TIB();
     965  return ((PFNWP)win32wnd->getOldWndProc())(hwnd,msg,mp1,mp2);
     966
     967RunDefHandler:
     968  RestoreOS2TIB();
     969  return Win32WindowProc(hwnd,msg,mp1,mp2);
     970}
     971
     972PVOID SubclassWithDefHandler(HWND hwnd)
     973{
     974  return WinSubclassWindow(hwnd,Win32SubclassWindowProc);
     975}
  • trunk/src/user32/pmwindow.h

    r949 r1333  
    1 /* $Id: pmwindow.h,v 1.1 1999-09-15 23:18:55 sandervl Exp $ */
     1/* $Id: pmwindow.h,v 1.2 1999-10-17 12:17:44 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    99#define __PMWINDOW_H__
    1010
    11 #define WIN32_STDCLASS  "Win32WindowClass"
     11#define WIN32_STDCLASS  "Win32WindowClass"
    1212
    1313BOOL InitPM();
     14
     15PVOID SubclassWithDefHandler(HWND hwnd);
    1416
    1517void RegisterSystemClasses(ULONG hModule);
  • trunk/src/user32/scroll.cpp

    r1306 r1333  
    1 /* $Id: scroll.cpp,v 1.8 1999-10-15 09:26:23 sandervl Exp $ */
     1/* $Id: scroll.cpp,v 1.9 1999-10-17 12:17:44 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
    44 *
    5  * Copyright 1999 Christoph Bratschi (ported from WINE)
     5 * Copyright 1999 Christoph Bratschi
    66 *
    77 * Copyright 1993 Martin Ayotte
     
    1010 * WINE version: 990923
    1111 */
    12 
    13 /* CB:
    14   - exported API removed, this functions are already implemented by Open32,
    15     code perhaps useful for new user32
    16   - only control, default scroll bars for windows need more work
    17   - SystemTimer not implemented
    18 */
    1912
    2013#include <stdlib.h>
     
    2417#include "win32wbase.h"
    2518#include "oslibwin.h"
     19
     20static BOOL bitmapsLoaded = FALSE;
    2621
    2722static HBITMAP hUpArrow = 0;
     
    112107{
    113108    HINSTANCE hinst;
     109
     110    if (bitmapsLoaded) return;
    114111
    115112    //CB: Open32 hack to load our own bitmap
     
    128125    hRgArrowI = NativeLoadBitmap( hinst, MAKEINTRESOURCEA(OBM_RGARROWI) );
    129126    FreeLibrary(hinst);
     127
     128    bitmapsLoaded = TRUE;
    130129}
    131130
    132131/***********************************************************************
    133  *           SCROLL_GetPtrScrollInfo
    134  */
    135 static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( HWND hwnd, INT nBar )
    136 {
    137     SCROLLBAR_INFO *infoPtr;
     132 *           SCROLL_GetInfoPtr
     133 */
     134static SCROLLBAR_INFO *SCROLL_GetInfoPtr( HWND hwnd, INT nBar )
     135{
     136    Win32BaseWindow *win32wnd;
     137    HWND hwndFrame;
    138138
    139139    switch(nBar)
    140140    {
    141 /* CB: implement this later!
    142141        case SB_HORZ:
    143           infoPtr = (SCROLLBAR_INFO *)wndPtr->pHScroll;
    144           break;
    145142        case SB_VERT:
    146           infoPtr = (SCROLLBAR_INFO *)wndPtr->pVScroll;
    147           break;
    148 */
     143          win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     144          if (!win32wnd) return NULL;
     145          hwndFrame = OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_PARENT);
     146          win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndFrame);
     147          if (!win32wnd) return NULL;
     148          return win32wnd->getScrollInfo(nBar);
     149
    149150        case SB_CTL:
    150           infoPtr = (SCROLLBAR_INFO *)GetInfoPtr(hwnd);
    151           break;
    152         default:      return NULL;
    153     }
    154 
    155     if (!infoPtr)  /* Create the info structure if needed */
    156     {
    157         infoPtr = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
    158         infoPtr->MinVal = infoPtr->CurVal = infoPtr->Page = 0;
    159         infoPtr->MaxVal = 100;
    160         infoPtr->flags  = ESB_ENABLE_BOTH;
    161 
    162         //CB: store in window class if not control!
    163         SetInfoPtr(hwnd,(DWORD)infoPtr);
    164 
    165         if (!hUpArrow) SCROLL_LoadBitmaps();
    166     }
    167     return infoPtr;
    168 }
    169 
    170 
    171 /***********************************************************************
    172  *           SCROLL_GetScrollInfo
    173  */
    174 static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
    175 {
    176  Win32BaseWindow *window;
    177 
    178     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    179     if(!window && nBar != SB_CTL) {
    180         dprintf(("SCROLL_GetScrollInfo window %x not found!", hwnd));
    181         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    182         return NULL;
    183     }
    184 
    185     if (window) {
    186             return window->getScrollInfo(nBar);
    187     }
    188 
    189     return SCROLL_GetPtrScrollInfo( hwnd, nBar );
     151          return (SCROLLBAR_INFO*)GetInfoPtr(hwnd);
     152    }
     153
     154    return NULL;
    190155}
    191156
     
    208173    INT pixels;
    209174    BOOL vertical;
    210     DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    211175    RECT rectClient;
    212176
    213177    switch(nBar)
    214178    {
    215 /* CB: implement later!
    216179      case SB_HORZ:
    217         lprect->left   = wndPtr->rectClient.left - wndPtr->rectWindow.left;
    218         lprect->top    = wndPtr->rectClient.bottom - wndPtr->rectWindow.top;
    219         lprect->right  = wndPtr->rectClient.right - wndPtr->rectWindow.left;
    220         lprect->bottom = lprect->top + GetSystemMetrics(SM_CYHSCROLL);
    221         if(dwStyle & WS_BORDER) {
    222           lprect->left--;
    223           lprect->right++;
    224         } else if(dwStyle & WS_VSCROLL)
    225           lprect->right++;
    226         vertical = FALSE;
     180      case SB_VERT:
     181        GetClientRect( hwnd, lprect );
     182        vertical = (nBar == SB_VERT);
    227183        break;
    228184
    229       case SB_VERT:
    230         lprect->left   = wndPtr->rectClient.right - wndPtr->rectWindow.left;
    231         lprect->top    = wndPtr->rectClient.top - wndPtr->rectWindow.top;
    232         lprect->right  = lprect->left + GetSystemMetrics(SM_CXVSCROLL);
    233         lprect->bottom = wndPtr->rectClient.bottom - wndPtr->rectWindow.top;
    234         if(wndPtr->dwStyle & WS_BORDER) {
    235           lprect->top--;
    236           lprect->bottom++;
    237         } else if(wndPtr->dwStyle & WS_HSCROLL)
    238           lprect->bottom++;
    239         vertical = TRUE;
    240         break;
    241 */
    242185      case SB_CTL:
    243         GetClientRect( hwnd, lprect );
    244         vertical = ((dwStyle & SBS_VERT) != 0);
    245         break;
     186        {
     187          DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     188
     189          GetClientRect( hwnd, lprect );
     190          vertical = ((dwStyle & SBS_VERT) != 0);
     191          break;
     192        }
    246193
    247194    default:
     
    262209    else
    263210    {
    264         SCROLLBAR_INFO *info = SCROLL_GetPtrScrollInfo( hwnd, nBar );
     211        SCROLLBAR_INFO *info = SCROLL_GetInfoPtr( hwnd, nBar );
    265212
    266213        *arrowSize = GetSystemMetrics(SM_CXVSCROLL);
     
    454401 * Draw the moving thumb rectangle.
    455402 */
    456 static void SCROLL_DrawMovingThumb_9x( HDC hdc, RECT *rect, BOOL vertical,
     403static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical,
    457404                       INT arrowSize, INT thumbSize )
    458405{
     
    477424
    478425  SCROLL_MovingThumb = !SCROLL_MovingThumb;
    479 }
    480 //******************************************************************************
    481 //******************************************************************************
    482 static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical,
    483                     INT arrowSize, INT thumbSize )
    484 {
    485   SCROLL_DrawMovingThumb_9x( hdc, rect, vertical, arrowSize, thumbSize );
    486426}
    487427/***********************************************************************
     
    511451    else
    512452    {
    513       //CB: implement!
    514       //hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
     453      hBrush = (HBRUSH)SendMessageA( hwnd, WM_CTLCOLORSCROLLBAR,
     454                     (WPARAM)hdc,(LPARAM)hwnd);
    515455    }
    516456
     
    591531    BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
    592532
     533//SCROLL_DrawInterior_9x(hwnd,hdc,nBar,rect,arrowSize,thumbSize,thumbPos,flags,vertical,top_selected,bottom_selected);
     534//return; //CB: improve!
     535
    593536    if (Save_SCROLL_MovingThumb &&
    594537        (SCROLL_TrackingWin == hwnd) &&
     
    606549                                       (WPARAM)hdc,(LPARAM)hwnd);
    607550    } else {
    608         //CB: implement!
    609         //hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
     551        hBrush = (HBRUSH)SendMessageA( hwnd, WM_CTLCOLORSCROLLBAR,
     552                                       (WPARAM)hdc,(LPARAM)hwnd);
     553
    610554    }
    611555
     
    706650    RECT rect;
    707651    BOOL vertical;
    708     SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( hwnd, nBar );
     652    SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr( hwnd, nBar );
    709653    BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
    710     DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    711 
    712     if (!infoPtr ||
    713         ((nBar == SB_VERT) && !(dwStyle & WS_VSCROLL)) ||
    714         ((nBar == SB_HORZ) && !(dwStyle & WS_HSCROLL))) return;
    715     //if (!WIN_IsWindowDrawable( hwnd, FALSE )) return; //CB: what's that???
    716654
    717655    vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
     
    754692                                     BOOL arrows, BOOL interior )
    755693{
    756     HDC hdc = GetDCEx( hwnd, 0,
    757                            DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
     694    //HDC hdc = GetDCEx( hwnd, 0,
     695    //                       DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
     696HDC hdc;
     697
     698return;
     699//CB: bug: paints in client window!
     700//    GetClientRect returns wrong window size after GetDC
     701//    why?!?
     702
    758703    if (!hdc) return;
    759704
     
    811756    HDC hdc;
    812757
    813     SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
     758    SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr( hwnd, nBar );
    814759    if (!infoPtr) return;
    815760    if ((SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN))
    816761                  return;
    817762
    818     hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
    819763    vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
    820764                                        &arrowSize, &thumbSize, &thumbPos );
    821     hwndOwner = (nBar == SB_CTL) ? GetParent(hwnd) : hwnd;
     765    if (nBar == SB_CTL) hwndOwner = GetParent(hwnd); else
     766    {
     767      Win32BaseWindow *win32wnd;
     768      HWND hwndFrame;
     769
     770      win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     771      if (!win32wnd) return;
     772      hwndFrame = OSLibWinQueryWindow(win32wnd->getOS2WindowHandle(),QWOS_PARENT);
     773      win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndFrame);
     774      if (!win32wnd) return;
     775      hwndOwner = win32wnd->getWindowHandle();
     776    }
     777
    822778    hwndCtl   = (nBar == SB_CTL) ? hwnd : 0;
    823779
     
    854810    }
    855811
     812    hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
     813
    856814    //TRACE("Event: hwnd=%04x bar=%d msg=%x pt=%ld,%ld hit=%d\n",
    857815    //             hwnd, nBar, msg, pt.x, pt.y, hittest );
     
    872830                                SB_LINEUP, hwndCtl );
    873831            }
    874             //CB: SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
    875             //                  SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
    876             //                  (TIMERPROC)0 );
    877         }
    878         //CB: else KillSystemTimer( hwnd, SCROLL_TIMER );
     832            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
     833                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
     834                            (TIMERPROC)0 );
     835        }
     836        else KillSystemTimer( hwnd, SCROLL_TIMER );
    879837        break;
    880838
     
    889847                SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
    890848                                SB_PAGEUP, hwndCtl );
    891                 //CB: SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
    892                 //                  SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
    893                 //                  (TIMERPROC)0 );
     849                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
     850                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
     851                                (TIMERPROC)0 );
    894852            }
    895853        }
    896         //CB: else KillSystemTimer( hwnd, SCROLL_TIMER );
     854        else KillSystemTimer( hwnd, SCROLL_TIMER );
    897855        break;
    898856
     
    955913                SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
    956914                                SB_PAGEDOWN, hwndCtl );
    957                 //CB: SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
    958                 //                  SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
    959                 //                  (TIMERPROC)0 );
     915                SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
     916                                SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
     917                                (TIMERPROC)0 );
    960918            }
    961919        }
    962         //CB: else KillSystemTimer( hwnd, SCROLL_TIMER );
     920        else KillSystemTimer( hwnd, SCROLL_TIMER );
    963921        break;
    964922
     
    973931                                SB_LINEDOWN, hwndCtl );
    974932            }
    975             //CB: SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
    976             //                  SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
    977             //                  (TIMERPROC)0 );
    978         }
    979         //CB: else KillSystemTimer( hwnd, SCROLL_TIMER );
     933            SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
     934                            SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
     935                            (TIMERPROC)0 );
     936        }
     937        else KillSystemTimer( hwnd, SCROLL_TIMER );
    980938        break;
    981939    }
     
    1008966    switch(message)
    1009967    {
     968    case WM_NCCREATE:
     969      {
     970        SCROLLBAR_INFO *infoPtr = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
     971
     972        infoPtr->MinVal = infoPtr->CurVal = infoPtr->Page = 0;
     973        infoPtr->MaxVal = 100;
     974        infoPtr->flags  = ESB_ENABLE_BOTH;
     975
     976        SetInfoPtr(hwnd,(DWORD)infoPtr);
     977
     978        if (!bitmapsLoaded) SCROLL_LoadBitmaps();
     979
     980        return TRUE;
     981      }
    1010982    case WM_CREATE:
    1011983        {
     
    1014986            {
    1015987                //FIXME("Unimplemented style SBS_SIZEBOX.\n" );
    1016                 return 0;
     988                return 0; //CB: implement! (for frames/toolbar already done)
    1017989            }
    1018990
     
    10401012            }
    10411013        }
    1042         if (!hUpArrow) SCROLL_LoadBitmaps();
     1014
    10431015        //TRACE("ScrollBar creation, hwnd=%04x\n", hwnd );
    10441016        return 0;
     
    10811053
    10821054    case SBM_SETRANGE:
    1083         SetScrollRange( hwnd, SB_CTL, wParam, lParam, FALSE );
    1084         return 0;  /* FIXME: return previous position */
     1055        {
     1056          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_CTL);
     1057          INT oldPos = infoPtr->CurVal;
     1058
     1059          SetScrollRange(hwnd,SB_CTL,wParam,lParam,FALSE);
     1060          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1061        }
    10851062
    10861063    case SBM_GETRANGE:
     
    10921069
    10931070    case SBM_SETRANGEREDRAW:
    1094         SetScrollRange( hwnd, SB_CTL, wParam, lParam, TRUE );
    1095         return 0;  /* FIXME: return previous position */
     1071        {
     1072          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_CTL);
     1073          INT oldPos = infoPtr->CurVal;
     1074
     1075          SetScrollRange(hwnd,SB_CTL,wParam,lParam,TRUE);
     1076          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1077        }
    10961078
    10971079    case SBM_SETSCROLLINFO:
     
    11141096
    11151097    default:
    1116 //SvL: BUGFIX: Send WM_NCCREATE to defwndproc, return value 0 cancels window creation!
    1117 //        if (message >= WM_USER)
    1118             //WARN("unknown msg %04x wp=%04x lp=%08lx\n",
    1119             //             message, wParam, lParam );
    1120         return DefWindowProcA( hwnd, message, wParam, lParam );
     1098      return DefWindowProcA( hwnd, message, wParam, lParam );
    11211099    }
    11221100    return 0;
     1101}
     1102
     1103/* frame handlers */
     1104
     1105VOID SCROLL_SubclassScrollBars(HWND hwndHorz,HWND hwndVert)
     1106{
     1107  if (hwndHorz)
     1108  {
     1109    SetWindowLongA(hwndHorz,GWL_WNDPROC,(ULONG)HorzScrollBarWndProc);
     1110    //windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
     1111//    InvalidateRect(hwndHorz,NULL,FALSE);
     1112  }
     1113
     1114  if (hwndVert)
     1115  {
     1116    SetWindowLongA(hwndVert,GWL_WNDPROC,(ULONG)VertScrollBarWndProc);
     1117//    InvalidateRect(hwndVert,NULL,FALSE);
     1118  }
     1119
     1120  if (!bitmapsLoaded) SCROLL_LoadBitmaps();
     1121}
     1122
     1123LRESULT WINAPI HorzScrollBarWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam )
     1124{
     1125  switch (message)
     1126  {
     1127    case WM_LBUTTONDOWN:
     1128    case WM_LBUTTONUP:
     1129    case WM_MOUSEMOVE:
     1130    case WM_SYSTIMER:
     1131        {
     1132            POINT pt;
     1133            CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
     1134            SCROLL_HandleScrollEvent( hwnd, SB_HORZ, message, pt );
     1135        }
     1136        break;
     1137
     1138    case WM_ERASEBKGND:
     1139         return 1;
     1140
     1141    case WM_GETDLGCODE:
     1142         return DLGC_WANTARROWS; /* Windows returns this value */
     1143
     1144    case WM_PAINT:
     1145      {
     1146        PAINTSTRUCT ps;
     1147
     1148        HDC hdc = BeginPaint( hwnd, &ps );
     1149        SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE );
     1150        EndPaint( hwnd, &ps );
     1151      }
     1152      break;
     1153
     1154    case SBM_SETPOS:
     1155      return SetScrollPos( hwnd, SB_HORZ, wParam, (BOOL)lParam );
     1156
     1157    case SBM_GETPOS:
     1158        return GetScrollPos( hwnd, SB_HORZ );
     1159
     1160    case SBM_SETRANGE:
     1161        {
     1162          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_HORZ);
     1163          INT oldPos = infoPtr->CurVal;
     1164
     1165          SetScrollRange(hwnd,SB_HORZ,wParam,lParam,FALSE);
     1166          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1167        }
     1168
     1169    case SBM_GETRANGE:
     1170        GetScrollRange( hwnd, SB_HORZ, (LPINT)wParam, (LPINT)lParam );
     1171        return 0;
     1172
     1173    case SBM_ENABLE_ARROWS:
     1174        return EnableScrollBar( hwnd, SB_HORZ, wParam );
     1175
     1176    case SBM_SETRANGEREDRAW:
     1177        {
     1178          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_HORZ);
     1179          INT oldPos = infoPtr->CurVal;
     1180
     1181          SetScrollRange(hwnd,SB_HORZ,wParam,lParam,TRUE);
     1182          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1183        }
     1184
     1185    case SBM_SETSCROLLINFO:
     1186        return SetScrollInfo( hwnd, SB_HORZ, (SCROLLINFO *)lParam, wParam );
     1187
     1188    case SBM_GETSCROLLINFO:
     1189        return GetScrollInfo( hwnd, SB_HORZ, (SCROLLINFO *)lParam );
     1190
     1191    default:
     1192      return DefWindowProcA(hwnd,message,wParam,lParam);
     1193  }
     1194
     1195  return 0;
     1196}
     1197
     1198LRESULT WINAPI VertScrollBarWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam )
     1199{
     1200  switch (message)
     1201  {
     1202    case WM_LBUTTONDOWN:
     1203    case WM_LBUTTONUP:
     1204    case WM_MOUSEMOVE:
     1205    case WM_SYSTIMER:
     1206        {
     1207            POINT pt;
     1208            CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
     1209            SCROLL_HandleScrollEvent( hwnd, SB_VERT, message, pt );
     1210        }
     1211        break;
     1212
     1213    case WM_ERASEBKGND:
     1214         return 1;
     1215
     1216    case WM_GETDLGCODE:
     1217         return DLGC_WANTARROWS; /* Windows returns this value */
     1218
     1219    case WM_PAINT:
     1220      {
     1221        PAINTSTRUCT ps;
     1222
     1223        HDC hdc = BeginPaint( hwnd, &ps );
     1224        SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE );
     1225        EndPaint( hwnd, &ps );
     1226      }
     1227      break;
     1228
     1229    case SBM_SETPOS:
     1230      return SetScrollPos( hwnd, SB_VERT, wParam, (BOOL)lParam );
     1231
     1232    case SBM_GETPOS:
     1233        return GetScrollPos( hwnd, SB_VERT );
     1234
     1235    case SBM_SETRANGE:
     1236        {
     1237          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_VERT);
     1238          INT oldPos = infoPtr->CurVal;
     1239
     1240          SetScrollRange(hwnd,SB_VERT,wParam,lParam,FALSE);
     1241          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1242        }
     1243
     1244    case SBM_GETRANGE:
     1245        GetScrollRange( hwnd, SB_VERT, (LPINT)wParam, (LPINT)lParam );
     1246        return 0;
     1247
     1248    case SBM_ENABLE_ARROWS:
     1249        return EnableScrollBar( hwnd, SB_VERT, wParam );
     1250
     1251    case SBM_SETRANGEREDRAW:
     1252        {
     1253          SCROLLBAR_INFO *infoPtr = SCROLL_GetInfoPtr(hwnd,SB_VERT);
     1254          INT oldPos = infoPtr->CurVal;
     1255
     1256          SetScrollRange(hwnd,SB_VERT,wParam,lParam,TRUE);
     1257          return (oldPos != infoPtr->CurVal) ? infoPtr->CurVal:0;
     1258        }
     1259
     1260    case SBM_SETSCROLLINFO:
     1261        return SetScrollInfo( hwnd, SB_VERT, (SCROLLINFO *)lParam, wParam );
     1262
     1263    case SBM_GETSCROLLINFO:
     1264        return GetScrollInfo( hwnd, SB_VERT, (SCROLLINFO *)lParam );
     1265
     1266    default:
     1267      return DefWindowProcA(hwnd,message,wParam,lParam);
     1268  }
     1269
     1270  return 0;
    11231271}
    11241272
     
    11481296  INT retVal;
    11491297
     1298/* CB: handled here, todo: hide/show
    11501299    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    11511300    if(!window && nBar != SB_CTL) {
     
    11571306        return window->setScrollInfo(nBar, (SCROLLINFO *)info, bRedraw);
    11581307    }
     1308*/
    11591309
    11601310    retVal = SCROLL_SetScrollInfo( hwnd, nBar, info, &action );
     
    11871337   *action = 0;
    11881338
    1189     if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;
     1339    if (!(infoPtr = SCROLL_GetInfoPtr(hwnd, nBar))) return 0;
    11901340    if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;
    11911341    if ((info->cbSize != sizeof(*info)) &&
     
    13031453  SCROLLBAR_INFO *infoPtr;
    13041454
    1305     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
     1455    if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, nBar ))) return FALSE;
    13061456    if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return FALSE;
    13071457    if ((info->cbSize != sizeof(*info)) &&
     
    13411491
    13421492    dprintf(("SetScrollPos %x %d %d %d", hwnd, nBar, nPos, bRedraw));
    1343     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return 0;
     1493    if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, nBar ))) return 0;
    13441494    oldPos      = infoPtr->CurVal;
    13451495    info.cbSize = sizeof(info);
     
    13681518    dprintf(("GetScrollPos %x %d", hwnd, nBar));
    13691519
    1370     infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
     1520    infoPtr = SCROLL_GetInfoPtr( hwnd, nBar );
    13711521    if (!infoPtr) return 0;
    13721522
     
    14421592  SCROLLBAR_INFO *infoPtr;
    14431593
    1444     infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
     1594    infoPtr = SCROLL_GetInfoPtr( hwnd, nBar );
    14451595    if (!infoPtr)
    14461596    {
     
    16171767    if (nBar == SB_BOTH)
    16181768    {
    1619         if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, SB_VERT ))) return FALSE;
     1769        if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, SB_VERT ))) return FALSE;
    16201770        if (!(bFineWithMe = (infoPtr->flags == flags)) )
    16211771        {
     
    16281778        bFineWithMe = TRUE;
    16291779
    1630     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
     1780    if (!(infoPtr = SCROLL_GetInfoPtr( hwnd, nBar ))) return FALSE;
    16311781    if (bFineWithMe && infoPtr->flags == flags) return FALSE;
    16321782    infoPtr->flags = flags;
  • trunk/src/user32/user32exp.def

    r1025 r1333  
    565565    _wvsprintfA@12                            @579
    566566    _wvsprintfW@12                            @580
     567    _GetMenuInfo@8                            @800
     568    _SetMenuInfo@8                            @801
    567569    _GetMonitorInfoW@8                        @1000
    568570    _GetMonitorInfoA@8                        @1001
  • trunk/src/user32/win32dlg.cpp

    r1320 r1333  
    1 /* $Id: win32dlg.cpp,v 1.15 1999-10-16 11:05:38 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.16 1999-10-17 12:17:44 cbratschi Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    261261        ShowWindow( SW_SHOW );
    262262
     263        //CB: 100% CPU usage, need a better solution with OSLibWinGetMsg
     264        //    is WM_ENTERIDLE used and leaving away breaks an application?
     265        //    this style was useful for Win3.1 but today there are threads
     266        // solution: send only few WM_ENTERIDLE messages
     267
     268#if 1
     269        while (TRUE)
     270        {
     271          if (!OSLibWinPeekMsg(&msg,0,0,0,MSG_NOREMOVE))
     272          {
     273            if(!(getStyle() & DS_NOIDLEMSG))
     274              topOwner->SendMessageA(WM_ENTERIDLE,MSGF_DIALOGBOX,getWindowHandle());
     275            OSLibWinGetMsg(&msg,0,0,0);
     276          } else OSLibWinPeekMsg(&msg,0,0,0,MSG_REMOVE);
     277
     278          if(msg.message == WM_QUIT)
     279          {
     280            dprintf(("Win32Dialog::doDialogBox: received  WM_QUIT"));
     281            break;
     282          }
     283          if (!IsDialogMessageA( getWindowHandle(), &msg))
     284          {
     285            TranslateMessage( &msg );
     286            DispatchMessageA( &msg );
     287          }
     288          if (dialogFlags & DF_END) break;
     289        }
     290#else
    263291        while (TRUE) {
    264292//        while (OSLibWinPeekMsg(&msg, getWindowHandle(), owner, MSGF_DIALOGBOX,
     
    284312            }
    285313        }
     314#endif
    286315        topOwner->EnableWindow( TRUE );
    287316    }
  • trunk/src/user32/win32wbase.cpp

    r1322 r1333  
    1 /* $Id: win32wbase.cpp,v 1.47 1999-10-16 14:51:42 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.48 1999-10-17 12:17:45 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    4040#include "pmframe.h"
    4141#include "win32wdesktop.h"
     42#include "pmwindow.h"
    4243#include <wprocess.h>
    4344
     
    8586//******************************************************************************
    8687//******************************************************************************
     88Win32BaseWindow::Win32BaseWindow(HWND os2Handle,VOID* win32WndProc) : GenericObject(&windows,OBJTYPE_WINDOW)
     89{
     90  Init();
     91  OS2Hwnd = OS2HwndFrame = os2Handle;
     92  dwStyle = WS_VISIBLE;
     93  setWindowProc((WNDPROC)win32WndProc);
     94  fIsSubclassedOS2Wnd = TRUE;
     95  fFirstShow = FALSE;
     96
     97  //CB: replace by a secure method
     98
     99  if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     100        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
     101        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     102        return;
     103  }
     104  if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     105        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
     106        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     107        return;
     108  }
     109
     110  OSLibWinQueryWindowRect(OS2Hwnd,&rectWindow);
     111  rectClient = rectWindow;
     112  rectClient.bottom -= rectClient.top;
     113  rectClient.top = 0;
     114  rectClient.right -= rectClient.left;
     115  rectClient.left = 0;
     116
     117  setOldWndProc(SubclassWithDefHandler(OS2Hwnd));
     118}
     119//******************************************************************************
     120//******************************************************************************
    87121Win32BaseWindow::Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
    88122                        : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()
     
    97131{
    98132  isUnicode        = FALSE;
     133  fIsSubclassedOS2Wnd = FALSE;
    99134  fFirstShow       = TRUE;
    100135  fIsDialog        = FALSE;
     
    200235        horzScrollInfo = NULL;
    201236    }
    202   //TODO: Destroy windows if they're not associated with our window anymore (showwindow false)?
    203 //  hwndHorzScroll
    204 //  hwndVertScroll
    205 
    206237}
    207238//******************************************************************************
     
    584615  }
    585616
     617  //CB: switch off -> OS/2 scrollbars
     618  subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);
     619
    586620  fakeWinBase.hwndThis     = OS2Hwnd;
    587621  fakeWinBase.pWindowClass = windowClass;
     
    690724 Win32BaseWindow *child;
    691725
     726    if (isSubclassedOS2Wnd) OSLibWinSubclassWindow(OS2Hwnd,pOldWndProc);
     727
    692728    //According to the SDK, WM_PARENTNOTIFY messages are sent to the parent (this window)
    693729    //before any window destruction has begun
     
    699735    }
    700736    SendInternalMessageA(WM_DESTROY, 0, 0);
     737
     738    if (hwndHorzScroll && OSLibWinQueryWindow(hwndHorzScroll,QWOS_PARENT) == OSLIB_HWND_OBJECT) OSLibWinDestroyWindow(hwndHorzScroll);
     739    if (hwndVertScroll && OSLibWinQueryWindow(hwndVertScroll,QWOS_PARENT) == OSLIB_HWND_OBJECT) OSLibWinDestroyWindow(hwndVertScroll);
    701740
    702741    fIsDestroyed = TRUE;
     
    10071046                break;
    10081047        case BUTTON_LEFTDBLCLICK:
    1009                 if (windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
     1048                if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
    10101049                {
    10111050                  win32msg = WM_LBUTTONDBLCLK;
     
    10261065                break;
    10271066        case BUTTON_RIGHTDBLCLICK:
    1028                 if (windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
     1067                if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
    10291068                {
    10301069                  win32msg = WM_RBUTTONDBLCLK;
     
    10451084                break;
    10461085        case BUTTON_MIDDLEDBLCLICK:
    1047                 if (windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
     1086                if (windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)
    10481087                {
    10491088                  win32msg = WM_MBUTTONDBLCLK;
     
    11861225    case SB_HORZ:
    11871226        if(horzScrollInfo) {
    1188             horzScrollInfo->CurVal = OSLibWinGetScrollPos(OS2HwndFrame, hwndHorzScroll);
     1227            //CB:horzScrollInfo->CurVal = OSLibWinGetScrollPos(OS2HwndFrame, hwndHorzScroll);
    11891228            return horzScrollInfo;
    11901229        }
     
    11921231    case SB_VERT:
    11931232        if(vertScrollInfo) {
    1194             vertScrollInfo->CurVal = OSLibWinGetScrollPos(OS2HwndFrame, hwndVertScroll);
     1233            //CB:vertScrollInfo->CurVal = OSLibWinGetScrollPos(OS2HwndFrame, hwndVertScroll);
    11951234            return vertScrollInfo;
    11961235        }
     
    12081247  ULONG           scrollType;
    12091248  int             new_flags;
     1249
     1250//CB: handled internally
     1251return 0;
    12101252
    12111253    switch(nBar) {
     
    13271369    return infoPtr->CurVal;
    13281370}
     1371/***********************************************************************/
     1372/***********************************************************************/
     1373VOID Win32BaseWindow::subclassScrollBars(BOOL subHorz,BOOL subVert)
     1374{
     1375  SCROLL_SubclassScrollBars(subHorz ? hwndHorzScroll:0,subVert ? hwndVertScroll:0);
     1376}
    13291377/***********************************************************************
    13301378 *           NC_HandleSysCommand
     
    15671615      int rc;
    15681616
    1569         if (!windowClass->getBackgroundBrush()) return 0;
     1617        if (!windowClass || !windowClass->getBackgroundBrush()) return 0;
    15701618
    15711619        rc = GetClipBox( (HDC)wParam, &rect );
     
    16251673    {
    16261674            LRESULT result = 0;
     1675            if (!windowClass) return result;
    16271676            int index = GCL_HICON;
    16281677
  • trunk/src/user32/win32wbase.h

    r1322 r1333  
    1 /* $Id: win32wbase.h,v 1.25 1999-10-16 14:51:43 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.26 1999-10-17 12:17:45 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    5858
    5959                Win32BaseWindow(DWORD objType);
     60                Win32BaseWindow(HWND os2Handle,VOID* win32WndProc);
    6061                Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
    6162virtual        ~Win32BaseWindow();
     
    163164         BOOL   IsWindow()                    { return TRUE; };
    164165         BOOL   IsDialog()                    { return fIsDialog; };
    165 
    166          BOOL   CanReceiveSizeMsgs()          { return !fNoSizeMsg; };
    167          BOOL   IsWindowDestroyed()           { return fIsDestroyed; };
     166         BOOL   CanReceiveSizeMsgs()          { return !fNoSizeMsg; };
     167         BOOL   IsWindowDestroyed()           { return fIsDestroyed; };
    168168         BOOL   IsWindowEnabled();
    169169         BOOL   IsWindowVisible();
     
    185185       HWND      getVertScrollHandle()        { return hwndVertScroll; };
    186186       HWND      getHorzScrollHandle()        { return hwndHorzScroll; };
     187       VOID      subclassScrollBars(BOOL subHorz,BOOL subVert);
    187188
    188189       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     
    212213       ULONG getBorderWidth() { return borderWidth; };
    213214       ULONG getBorderHeight() { return borderHeight; };
     215
     216       PVOID getOldWndProc() { return pOldWndProc; }
     217       VOID  setOldWndProc(PVOID aOldWndProc) { pOldWndProc = aOldWndProc; }
     218       BOOL  isSubclassedOS2Wnd() { return fIsSubclassedOS2Wnd; };
    214219
    215220protected:
     
    249254        BOOL    fInternalMsg;           //Used to distinguish between messages
    250255                                        //sent by PM and those sent by apps
    251         BOOL    fNoSizeMsg;
    252         BOOL    fIsDestroyed;
     256        BOOL    fNoSizeMsg;
     257        BOOL    fIsDestroyed;
    253258
    254259        PVOID   pOldFrameProc;
    255260        ULONG   borderWidth;
    256261        ULONG   borderHeight;
     262
     263        PVOID   pOldWndProc;
     264        BOOL    fIsSubclassedOS2Wnd;  //subclassed OS/2 window: Netscape plug-in/scrollbar
    257265
    258266   Win32BaseWindow *owner;
     
    286294#ifndef OS2_INCLUDED
    287295        void  GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
    288         LONG  HandleSysCommand(WPARAM wParam, POINT *pt32);
     296        LONG  HandleSysCommand(WPARAM wParam, POINT *pt32);
    289297
    290298        LONG  SendNCCalcSize(BOOL calcValidRect,
     
    293301                             RECT *newClientRect );
    294302
    295         LONG  NCHandleCalcSize(WPARAM wParam, NCCALCSIZE_PARAMS *ncsize);
     303        LONG  NCHandleCalcSize(WPARAM wParam, NCCALCSIZE_PARAMS *ncsize);
    296304
    297305     LRESULT  SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
     
    309317         fakeOpen32WinBaseClass fakeWinBase;
    310318
    311          BOOL   isOwnDC() { return (windowClass->getStyle() & CS_OWNDC_W); }
     319         BOOL   isOwnDC() { return (windowClass && windowClass->getStyle() & CS_OWNDC_W); }
    312320         HDC    getOwnDC() { return ownDC; }
    313321         void   setOwnDC(HDC hdc) { ownDC = hdc; }
  • trunk/src/user32/windowword.cpp

    r949 r1333  
    1 /* $Id: windowword.cpp,v 1.1 1999-09-15 23:19:03 sandervl Exp $ */
     1/* $Id: windowword.cpp,v 1.2 1999-10-17 12:17:46 cbratschi Exp $ */
    22
    33/*
     
    1717//******************************************************************************
    1818//******************************************************************************
    19 LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG  arg3)
     19LONG WIN32API SetWindowLongA(HWND hwnd, int nIndex, LONG  lNewLong)
    2020{
    2121 Win32BaseWindow *window;
     
    2424    if(window)
    2525    {
    26     return window->SetWindowLongA(nIndex, arg3);
    27     }
    28     else
     26      return window->SetWindowLongA(nIndex,lNewLong);
     27    } else
    2928    {
    30     dprintf(("SetWindowLongA; window %x not found!", hwnd));
     29      if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
     30      {
     31        dprintf(("Start subclassing OS/2 window"));
     32
     33        window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
     34
     35        if(window == NULL)
     36        {
     37          dprintf(("Win32BaseWindow creation failed!!"));
     38          return 0;
     39        }
     40
     41        if(GetLastError() != 0)
     42        {
     43          dprintf(("Win32BaseWindow error found!!"));
     44          delete window;
     45          return 0;
     46        }
     47
     48        return (LONG)window->getOldWndProc();
     49      } else dprintf(("SetWindowLongA; window %x not found!", hwnd));
    3150    }
    3251    return 0;
     
    3453//******************************************************************************
    3554//******************************************************************************
    36 LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG  arg3)
     55LONG WIN32API SetWindowLongW(HWND hwnd, int nIndex, LONG  lNewLong)
    3756{
    3857 Win32BaseWindow *window;
     
    4160    if(window)
    4261    {
    43     return window->SetWindowLongA(nIndex, arg3);
    44     }
    45     else
     62      return window->SetWindowLongA(nIndex,lNewLong);
     63    } else
    4664    {
    47     dprintf(("SetWindowLongW; window %x not found!", hwnd));
     65      if (nIndex == GWL_WNDPROC && !Win32BaseWindow::GetWindowFromOS2Handle(hwnd))
     66      {
     67        dprintf(("Start subclassing OS/2 window"));
     68
     69        window = new Win32BaseWindow(hwnd,(PVOID)lNewLong);
     70
     71        if(window == NULL)
     72        {
     73          dprintf(("Win32BaseWindow creation failed!!"));
     74          return 0;
     75        }
     76
     77        if(GetLastError() != 0)
     78        {
     79          dprintf(("Win32BaseWindow error found!!"));
     80          delete window;
     81          return 0;
     82        }
     83
     84        return (LONG)window->getOldWndProc();
     85      } else dprintf(("SetWindowLongW; window %x not found!", hwnd));
    4886    }
    4987    return 0;
Note: See TracChangeset for help on using the changeset viewer.