Changeset 5951 for trunk/src


Ignore:
Timestamp:
Jun 10, 2001, 2:05:41 PM (24 years ago)
Author:
sandervl
Message:

bugfixes + os/2 look support added

Location:
trunk/src/user32
Files:
10 edited

Legend:

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

    r5950 r5951  
    1 /* $Id: gen_object.cpp,v 1.9 2001-06-10 09:19:57 sandervl Exp $ */
     1/* $Id: gen_object.cpp,v 1.10 2001-06-10 12:05:38 sandervl Exp $ */
    22/*
    33 * Generic Object Class for OS/2
     
    9191LONG GenericObject::addRef()
    9292{
    93   dprintf(("addRef %x -> refcount %x", this, refCount));
     93////  dprintf(("addRef %x -> refcount %x", this, refCount));
    9494  return InterlockedIncrement(&refCount);
    9595}
     
    9999LONG GenericObject::release()
    100100{
    101   dprintf(("release %x -> refcount %x", this, refCount));
     101////  dprintf(("release %x -> refcount %x", this, refCount));
    102102#ifdef DEBUG
    103103  if(refCount-1 < 0) {
  • trunk/src/user32/oslibwin.cpp

    r5935 r5951  
    1 /* $Id: oslibwin.cpp,v 1.96 2001-06-09 14:50:19 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.97 2001-06-10 12:05:38 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    5252//******************************************************************************
    5353//******************************************************************************
    54 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle,
     54HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, ULONG dwOSFrameStyle,
    5555                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM,
    5656                          ULONG id, BOOL fTaskList,BOOL fShellPosition,
     
    9393                           pszName, (dwWinStyle & ~WS_CLIPCHILDREN), 0, 0, 0, 0,
    9494                           Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP,
    95                            id, NULL, NULL);
     95                           id, (PVOID)&FCData, NULL);
     96    if(fOS2Look && *hwndFrame) {
     97        FCData.flCreateFlags = dwOSFrameStyle;
     98        WinCreateFrameControls(*hwndFrame, &FCData, NULL);
     99    }
    96100    hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
    97101                              NULL, dwWinStyle | WS_VISIBLE, 0, 0, 0, 0,
    98102                              *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
     103
    99104    return hwndClient;
    100105}
     
    102107//Note: Also check OSLibSetWindowStyle when changing this!!
    103108//******************************************************************************
    104 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle)
     109BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
    105110{
    106111  *OSWinStyle   = 0;
     112  *OSFrameStyle = 0;
    107113
    108114  /* Window styles */
    109 #if 0
    110   //Done explicitely in CreateWindowExA
    111   if(dwStyle & WS_MINIMIZE_W)
    112         *OSWinStyle |= WS_MINIMIZED;
    113   if(dwStyle & WS_VISIBLE_W)
    114         *OSWinStyle |= WS_VISIBLE;
    115 #endif
    116115  if(dwStyle & WS_DISABLED_W)
    117116        *OSWinStyle |= WS_DISABLED;
     
    120119  if(dwStyle & WS_CLIPCHILDREN_W)
    121120        *OSWinStyle |= WS_CLIPCHILDREN;
    122 #if 0
    123   if(dwStyle & WS_MAXIMIZE_W)
    124         *OSWinStyle |= WS_MAXIMIZED;
    125   if(dwStyle & WS_GROUP_W)
    126         *OSWinStyle |= WS_GROUP;
    127   if(dwStyle & WS_TABSTOP_W)
    128         *OSWinStyle |= WS_TABSTOP;
    129 #endif
    130 
     121
     122  if(fOS2Look) {
     123      if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
     124          *OSFrameStyle = FCF_TITLEBAR;
     125          if(dwStyle & WS_SYSMENU_W)
     126          {
     127              *OSFrameStyle |= FCF_SYSMENU;
     128          }
     129          if((dwStyle & WS_MINIMIZEBOX_W) || (dwStyle & WS_MAXIMIZEBOX_W)) {
     130              *OSFrameStyle |= FCF_MINMAX;
     131          }
     132      }
     133  }
    131134  return TRUE;
     135}
     136//******************************************************************************
     137//******************************************************************************
     138BOOL OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect)
     139{
     140  SWP  swp[3];
     141  HWND hwndControl;
     142  int  i = 0;
     143  static int minmaxwidth = 0;
     144
     145  if(minmaxwidth == 0) {
     146      minmaxwidth = WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON);
     147  }
     148
     149  hwndControl = WinWindowFromID(hwndFrame, FID_SYSMENU);
     150  if(hwndControl) {
     151      swp[i].hwnd = hwndControl;
     152      swp[i].hwndInsertBehind = HWND_TOP;
     153      swp[i].x  = pRect->xLeft;
     154      swp[i].y  = pRect->yBottom;
     155      swp[i].cx = minmaxwidth/2;
     156      swp[i].cy = pRect->yTop - pRect->yBottom;
     157      swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
     158      pRect->xLeft += swp[i].cx;
     159      i++;
     160  }
     161  hwndControl = WinWindowFromID(hwndFrame, FID_TITLEBAR);
     162  if(hwndControl) {
     163      swp[i].hwnd = hwndControl;
     164      swp[i].hwndInsertBehind = HWND_TOP;
     165      swp[i].x  = pRect->xLeft;
     166      swp[i].y  = pRect->yBottom;
     167      swp[i].cx = pRect->xRight - pRect->xLeft;
     168      if(WinWindowFromID(hwndFrame, FID_MINMAX)) {
     169          swp[i].cx -= minmaxwidth - minmaxwidth/2;
     170      }
     171      swp[i].cy = pRect->yTop - pRect->yBottom;
     172      swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
     173      pRect->xLeft += swp[i].cx;
     174      i++;
     175  }
     176  hwndControl = WinWindowFromID(hwndFrame, FID_MINMAX);
     177  if(hwndControl) {
     178      swp[i].hwnd = hwndControl;
     179      swp[i].hwndInsertBehind = HWND_TOP;
     180      swp[i].x  = pRect->xLeft;
     181      swp[i].y  = pRect->yBottom;
     182      swp[i].cx = minmaxwidth + minmaxwidth/2;
     183      swp[i].cy = pRect->yTop - pRect->yBottom;
     184      swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
     185      pRect->xLeft += swp[i].cx;
     186      i++;
     187  }
     188  return WinSetMultWindowPos(GetThreadHAB(), swp, i);
    132189}
    133190//******************************************************************************
     
    360417{
    361418  return WinSetWindowText(hwnd, lpsz);
     419}
     420//******************************************************************************
     421//******************************************************************************
     422BOOL OSLibWinSetTitleBarText(HWND hwnd, LPSTR lpsz)
     423{
     424  return WinSetWindowText(WinWindowFromID(hwnd, FID_TITLEBAR), lpsz);
    362425}
    363426//******************************************************************************
     
    759822
    760823    if(dwWinStyle != dwOldWinStyle) {
    761         WinSetWindowULong(hwndClient, QWL_STYLE, dwWinStyle);
     824         WinSetWindowULong(hwndClient, QWL_STYLE, dwWinStyle);
    762825    }
    763826
     
    781844
    782845    if(dwWinStyle != dwOldWinStyle) {
    783       WinSetWindowULong(hwndFrame, QWL_STYLE, dwWinStyle);
     846         WinSetWindowULong(hwndFrame, QWL_STYLE, dwWinStyle);
    784847    }
    785848}
  • trunk/src/user32/oslibwin.h

    r5721 r5951  
    1 /* $Id: oslibwin.h,v 1.55 2001-05-16 07:42:26 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.56 2001-06-10 12:05:39 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3838
    3939
    40 HWND  OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle,
     40HWND  OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, ULONG dwOSFrameStyle,
    4141                           char *pszName, HWND Owner, ULONG fBottom,
    4242                           ULONG id, BOOL fTaskList,BOOL fShellPosition,
    4343                           int classStyle, HWND *hwndFrame);
    4444
    45 BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle);
     45BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
    4646void  OSLibSetWindowStyle(HWND hwndFrame, HWND hwndClient, ULONG dwStyle, ULONG dwExStyle);
    4747DWORD OSLibQueryWindowStyle(HWND hwnd);
     48
     49BOOL  OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect);
    4850
    4951#define OSLIB_QWL_USER -4
     
    242244LONG  OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz);
    243245BOOL  OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz);
     246BOOL  OSLibWinSetTitleBarText(HWND hwnd, LPSTR lpsz);
    244247BOOL  OSLibWinFlashWindow(HWND hwnd, BOOL fFlash);
    245248HWND  OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint);
  • trunk/src/user32/pmwindow.cpp

    r5935 r5951  
    1 /* $Id: pmwindow.cpp,v 1.133 2001-06-09 14:50:19 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.134 2001-06-10 12:05:39 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    4141#include "timer.h"
    4242#include <codepage.h>
     43#include "syscolor.h"
     44#include "options.h"
     45
    4346
    4447#define DBG_LOCALLOG    DBG_pmwindow
     
    5558ULONG ScreenHeight = 0;
    5659ULONG ScreenBitsPerPel = 0;
     60BOOL  fOS2Look = FALSE;
    5761
    5862static PFNWP pfnFrameWndProc = NULL;
     
    144148    DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel);
    145149    DevCloseDC(hdc);
     150
     151    fOS2Look = PROFILE_GetOdinIniBool(ODINSYSTEM_SECTION, "OS2Look", FALSE);
     152    if(fOS2Look) {
     153        SYSCOLOR_Init(FALSE); //use OS/2 colors
     154    }
    146155
    147156    dprintf(("InitPM: Desktop (%d,%d) bpp %d", ScreenWidth, ScreenHeight, ScreenBitsPerPel));
     
    807816                {
    808817                    WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd);
     818                    if(fOS2Look) {
     819                        WinSendDlgItemMsg(hwnd, FID_TITLEBAR, TBM_SETHILITE, MPFROMSHORT(TRUE), 0);
     820                    }
    809821                }
    810822            }
     
    816828                {
    817829                    WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd);
     830                    if(fOS2Look) {
     831                        WinSendDlgItemMsg(hwnd, FID_TITLEBAR, TBM_SETHILITE, MPFROMSHORT(FALSE), 0);
     832                    }
    818833                }
    819834            }
     
    958973             {
    959974                WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd);
     975                if(fOS2Look) {
     976                    WinSendDlgItemMsg(hwnd, FID_TITLEBAR, TBM_SETHILITE, MPFROMSHORT(TRUE), 0);
     977                }
    960978             }
    961979        }
     
    967985            {
    968986                    WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd);
     987                    if(fOS2Look) {
     988                        WinSendDlgItemMsg(hwnd, FID_TITLEBAR, TBM_SETHILITE, MPFROMSHORT(FALSE), 0);
     989                    }
    969990            }
    970991        }
     
    11131134        {
    11141135            WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2);
     1136            if(fOS2Look) {
     1137                WinSendDlgItemMsg(hwnd, FID_TITLEBAR, TBM_SETHILITE, mp1, 0);
     1138            }
    11151139            WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
    11161140
     
    12371261        dprintf(("PMFRAME:WM_UPDATEFRAME %x", win32wnd->getWindowHandle()));
    12381262        goto RunDefFrameWndProc;
     1263
     1264    case WM_TRACKFRAME:
     1265        if(fOS2Look) {//sent by titlebar control
     1266            FrameTrackFrame(win32wnd, TF_MOVE);
     1267        }
     1268        rc = 0;
     1269        break;
    12391270
    12401271    default:
  • trunk/src/user32/pmwindow.h

    r5935 r5951  
    1 /* $Id: pmwindow.h,v 1.10 2001-06-09 14:50:19 sandervl Exp $ */
     1/* $Id: pmwindow.h,v 1.11 2001-06-10 12:05:39 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    2222extern ULONG ScreenHeight;
    2323extern ULONG ScreenBitsPerPel;
     24extern BOOL  fOS2Look;
    2425
    2526#define TFOS_LEFT                    0x0001
  • trunk/src/user32/syscolor.cpp

    r5406 r5951  
    1 /* $Id: syscolor.cpp,v 1.26 2001-03-30 22:08:19 sandervl Exp $ */
     1/* $Id: syscolor.cpp,v 1.27 2001-06-10 12:05:39 sandervl Exp $ */
    22
    33/*
     
    175175//******************************************************************************
    176176//******************************************************************************
    177 void SYSCOLOR_Init(void)
     177void SYSCOLOR_Init(int fOverride)
    178178{
    179179  INT x;
    180180
    181   USEWINCOLORS = PROFILE_GetOdinIniBool(ODINCOLORS,"UseWinColors",TRUE);
     181  if(fOverride == -1) {
     182       USEWINCOLORS = PROFILE_GetOdinIniBool(ODINCOLORS,"UseWinColors",TRUE);
     183  }
     184  else USEWINCOLORS = fOverride;
    182185
    183186  SYSCOLOR_Load();
  • trunk/src/user32/syscolor.h

    r4674 r5951  
    1 /* $Id: syscolor.h,v 1.13 2000-11-22 13:44:50 sandervl Exp $ */
     1/* $Id: syscolor.h,v 1.14 2001-06-10 12:05:40 sandervl Exp $ */
    22
    33/*
     
    1515HBRUSH WIN32API OS2GetSysColorBrush(int nIndex);
    1616
    17 extern void SYSCOLOR_Init(void);
     17extern void SYSCOLOR_Init(int fOverride = -1);
    1818extern void SYSCOLOR_Save(void);
    1919
  • trunk/src/user32/user32.cpp

    r5751 r5951  
    1 /* $Id: user32.cpp,v 1.98 2001-05-19 11:16:01 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.99 2001-06-10 12:05:40 sandervl Exp $ */
    22
    33/*
     
    425425
    426426    case SM_CYCAPTION:
    427         rc = 19;
    428         //rc = OSLibWinQuerySysValue(SVOS_CYTITLEBAR);
     427        if(fOS2Look) {
     428             rc = OSLibWinQuerySysValue(SVOS_CYTITLEBAR);
     429        }
     430        else rc = 19;
    429431        break;
    430432
     
    442444    case SM_CXMENUSIZE:
    443445    case SM_CYMENUSIZE:
    444         rc = 19;
     446        if(fOS2Look) {
     447             rc = OSLibWinQuerySysValue(SVOS_CYMENU);
     448        }
     449        else rc = 19;
    445450        break;
    446451
  • trunk/src/user32/win32wbase.cpp

    r5950 r5951  
    1 /* $Id: win32wbase.cpp,v 1.261 2001-06-10 09:19:58 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.262 2001-06-10 12:05:40 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    469469    teb->o.odin.newWindow = (ULONG)this;
    470470
    471     DWORD dwOSWinStyle;
    472 
    473     OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
     471    DWORD dwOSWinStyle, dwOSFrameStyle;
     472
     473    OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle, &dwOSFrameStyle);
    474474
    475475    OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    476                                    dwOSWinStyle,(char *)windowNameA,
     476                                   dwOSWinStyle, dwOSFrameStyle, (char *)windowNameA,
    477477                                   (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
    478478                                   (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     
    582582                windowNameA[0] = 0;
    583583            }
     584        }
     585        if(fOS2Look) {
     586            OSLibWinSetTitleBarText(OS2HwndFrame, windowNameA);
    584587        }
    585588    }
     
    12021205  }
    12031206#endif
     1207  if(fOS2Look && ((dwStyle & WS_CAPTION) == WS_CAPTION))
     1208  {
     1209      RECT rect = {0};
     1210      int  height  = getWindowHeight();
     1211      RECTLOS2 rectOS2;
     1212
     1213      AdjustRectOuter(&rect, FALSE);
     1214
     1215      rect.left   = -rect.left;
     1216      rect.top    = rect.bottom - rect.top;
     1217      rect.right  = rectWindow.right - rectWindow.left - rect.right;
     1218 
     1219      rectOS2.xLeft   = rect.left;
     1220      rectOS2.xRight  = rect.right;
     1221      rectOS2.yBottom = height - rect.top;
     1222      rectOS2.yTop    = height - rect.bottom;
     1223      OSLibWinPositionFrameControls(getOS2FrameWindowHandle(), &rectOS2);
     1224  }
    12041225  return rc;
    12051226}
     
    14231444            if(hTaskList) {
    14241445                OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     1446                if(fOS2Look) {
     1447                    OSLibWinSetTitleBarText(OS2HwndFrame, getWindowNameA());
     1448                }
    14251449            }
    14261450        }
     
    19131937            if(hTaskList) {
    19141938                OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     1939                if(fOS2Look) {
     1940                    OSLibWinSetTitleBarText(OS2HwndFrame, getWindowNameA());
     1941                }
    19151942            }
    19161943        }
     
    27662793   }
    27672794   else {
     2795        if(newparent) RELEASE_WNDOBJ(newparent);
     2796
    27682797        setParent(windowDesktop);
     2798        windowDesktop->addRef();
    27692799        windowDesktop->addChild(this);
    27702800        OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP);
     
    36513681    if(HwGetWindowHandleData(hwnd, (DWORD *)&window) == TRUE) {
    36523682         if(window) {
    3653              dprintf(("addRef %x; refcount %d", hwnd, window->getRefCount()+1));
     3683////             dprintf(("addRef %x; refcount %d", hwnd, window->getRefCount()+1));
    36543684             window->addRef();
    36553685         }
  • trunk/src/user32/win32wbasenonclient.cpp

    r5935 r5951  
    1 /* $Id: win32wbasenonclient.cpp,v 1.31 2001-06-09 14:50:22 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.32 2001-06-10 12:05:41 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    527527      //Check context help
    528528      if (dwExStyle & WS_EX_CONTEXTHELP)
    529         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     529          rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    530530      if (pt.x > rect.right) return HTHELP;
    531531
     
    533533      /* In win95 there is automatically a Maximize button when there is a minimize one*/
    534534      if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
    535         rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     535          rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    536536      if (pt.x > rect.right) return HTMAXBUTTON;
    537537
     
    539539      /* In win95 there is automatically a Maximize button when there is a Maximize one*/
    540540      if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
    541       rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     541          rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    542542
    543543      if (pt.x > rect.right) return HTMINBUTTON;
     
    887887  HDC memDC;
    888888  HBITMAP memBmp,oldBmp;
     889
     890  if(fOS2Look) return;
    889891
    890892  memDC = CreateCompatibleDC(hdc);
Note: See TracChangeset for help on using the changeset viewer.