Index: trunk/src/user32/loadres.cpp
===================================================================
--- trunk/src/user32/loadres.cpp	(revision 1666)
+++ trunk/src/user32/loadres.cpp	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: loadres.cpp,v 1.14 1999-11-05 12:54:10 sandervl Exp $ */
+/* $Id: loadres.cpp,v 1.15 1999-11-09 17:07:21 cbratschi Exp $ */
 
 /*
@@ -23,4 +23,5 @@
 #include <win\virtual.h>
 #include "dib.h"
+#include "initterm.h"
 
 //******************************************************************************
@@ -33,5 +34,5 @@
 
     if (buffer && buflen)
-	buffer2 = (LPWSTR)HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
+        buffer2 = (LPWSTR)HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
 
     retval = LoadStringW(instance,resource_id,buffer2,buflen);
@@ -39,11 +40,11 @@
     if (buffer2)
     {
-	if (retval) {
-	    lstrcpynWtoA( buffer, buffer2, buflen );
-	    retval = lstrlenA( buffer );
-	}
-	else
-	    *buffer = 0;
-	HeapFree( GetProcessHeap(), 0, buffer2 );
+        if (retval) {
+            lstrcpynWtoA( buffer, buffer2, buflen );
+            retval = lstrlenA( buffer );
+        }
+        else
+            *buffer = 0;
+        HeapFree( GetProcessHeap(), 0, buffer2 );
     }
     return retval;
@@ -58,5 +59,5 @@
  int i = 0;
 
-    /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out 
+    /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out
      * 20 - 31. */
     winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)(((wID>>4)&0xffff)+1), RT_STRINGW);
@@ -69,20 +70,20 @@
     p = (LPWSTR)winres->lockResource();
     if(p) {
-    	string_num = wID & 0x000f;
-    	for (i = 0; i < string_num; i++)
-		p += *p + 1;
-     
-    	if (lpBuffer == NULL) return *p;
-    	i = min(cchBuffer - 1, *p);
-    	if (i > 0) {
-		memcpy(lpBuffer, p + 1, i * sizeof (WCHAR));
-		lpBuffer[i] = (WCHAR) 0;
-    	} 
-	else {
-		if (cchBuffer > 1) {
-	    		lpBuffer[0] = (WCHAR) 0;
-	    		return 0;
-		}
-    	}
+        string_num = wID & 0x000f;
+        for (i = 0; i < string_num; i++)
+                p += *p + 1;
+
+        if (lpBuffer == NULL) return *p;
+        i = min(cchBuffer - 1, *p);
+        if (i > 0) {
+                memcpy(lpBuffer, p + 1, i * sizeof (WCHAR));
+                lpBuffer[i] = (WCHAR) 0;
+        }
+        else {
+                if (cchBuffer > 1) {
+                        lpBuffer[0] = (WCHAR) 0;
+                        return 0;
+                }
+        }
     }
     delete winres;
@@ -98,6 +99,15 @@
  HICON          hIcon;
 
-    hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
-    if(hIcon == 0) {//not a system icon
+    if (!hinst)
+    {
+      winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_ICONA);
+      if (!winres) winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_GROUP_ICONA);
+      if (winres)
+      {
+        hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
+        delete winres;
+      } else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
+    } else
+    { //not a system icon
         winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
         if(winres == 0) {
@@ -107,5 +117,5 @@
                 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
                 delete winres;
-        }
+        } else hIcon = 0;
     }
     dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon));
@@ -120,6 +130,15 @@
  HICON          hIcon;
 
-    hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
-    if(hIcon == 0) {//not a system icon
+    if (!hinst)
+    {
+      winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_ICONW);
+      if (!winres) winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_GROUP_ICONW);
+      if (winres)
+      {
+        hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
+        delete winres;
+      } else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
+    } else
+    {//not a system icon
         winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
         if(winres == 0) {
@@ -129,5 +148,5 @@
                 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
                 delete winres;
-        }
+        } else hIcon = 0;
     }
     dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon));
@@ -142,6 +161,15 @@
  HCURSOR        hCursor;
 
-    hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
-    if(hCursor == 0) {//not a system pointer
+    if (!hinst)
+    {
+      winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_CURSORA);
+      if (!winres) winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_GROUP_CURSORA);
+      if (winres)
+      {
+        hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
+        delete winres;
+      } else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR));
+    } else
+    {//not a system pointer
         winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
         if(winres == 0) {
@@ -151,5 +179,5 @@
                 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
                 delete winres;
-        }
+        } else hCursor = 0;
     }
     if(HIWORD(lpszCursor)) {
@@ -167,6 +195,15 @@
  HCURSOR        hCursor;
 
-    hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
-    if(hCursor == 0) {//not a system pointer
+    if (!hinst)
+    {
+      winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW);
+      if (!winres) winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW);
+      if (winres)
+      {
+        hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
+        delete winres;
+      } else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR));
+    } else
+    {//not a system pointer
         winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
         if(winres == 0) {
@@ -176,5 +213,5 @@
                 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
                 delete winres;
-        }
+        } else hCursor = 0;
     }
     dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor));
@@ -341,33 +378,40 @@
  HBITMAP hBitmap = 0;
 
-  if(IsSystemBitmap((ULONG *)&lpszBitmap)) {
-        hBitmap = O32_LoadBitmap(hinst, lpszBitmap);
+  if (!hinst)
+  {
+    if(IsSystemBitmap((ULONG *)&lpszBitmap))
+    {
+      hBitmap = O32_LoadBitmap(hInstanceUser32,lpszBitmap);
+      if (!hBitmap) hBitmap = O32_LoadBitmap(hinst,lpszBitmap);
+    } else hBitmap = 0;
+  } else hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
+  dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
+
+  return(hBitmap);
+}
+//******************************************************************************
+//TODO: No support for RT_NEWBITMAP
+//******************************************************************************
+HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap)
+{
+ HBITMAP hBitmap = 0;
+
+  if (!hinst)
+  {
+    if(IsSystemBitmap((ULONG *)&lpszBitmap))
+    {
+      hBitmap = O32_LoadBitmap(hInstanceUser32,(LPCSTR)lpszBitmap);
+      if (!hBitmap) hBitmap = O32_LoadBitmap(hinst,(LPCSTR)lpszBitmap);
+    } else hBitmap = 0;
+  } else
+  {
+    if(HIWORD(lpszBitmap) != 0)
+      lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
+
+    hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
+
+    if(HIWORD(lpszBitmap) != 0)
+      FreeAsciiString((LPSTR)lpszBitmap);
   }
-  if(!hBitmap) {
-        hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
-  }
-  dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
-
-  return(hBitmap);
-}
-//******************************************************************************
-//TODO: No support for RT_NEWBITMAP
-//******************************************************************************
-HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap)
-{
- HBITMAP hBitmap = 0;
-
-  if(IsSystemBitmap((ULONG *)&lpszBitmap)) {
-        hBitmap = O32_LoadBitmap(hinst, (LPCSTR)lpszBitmap);
-  }
-  if(!hBitmap) {
-        if(HIWORD(lpszBitmap) != 0) {
-                 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
-        }
-        hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
-  }
-
-  if(HIWORD(lpszBitmap) != 0)
-        FreeAsciiString((LPSTR)lpszBitmap);
 
   dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
@@ -385,7 +429,7 @@
 
   if(HIWORD(lpszName)) {
-  	dprintf(("LoadImageA NOT COMPLETE %x %s %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
+        dprintf(("LoadImageA NOT COMPLETE %x %s %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
   }
-  else 	dprintf(("LoadImageA NOT COMPLETE %x %x %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
+  else  dprintf(("LoadImageA NOT COMPLETE %x %x %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
 
   if (fuLoad & LR_DEFAULTSIZE) {
@@ -482,12 +526,12 @@
     switch (type)
     {
-//	case IMAGE_BITMAP:
-//		return BITMAP_CopyBitmap(hnd);
-	case IMAGE_ICON:
-		return CopyIcon(hnd);
-	case IMAGE_CURSOR:
-		return CopyCursor(hnd);
-	default:
-		dprintf(("CopyImage: Unsupported type"));
+//      case IMAGE_BITMAP:
+//              return BITMAP_CopyBitmap(hnd);
+        case IMAGE_ICON:
+                return CopyIcon(hnd);
+        case IMAGE_CURSOR:
+                return CopyCursor(hnd);
+        default:
+                dprintf(("CopyImage: Unsupported type"));
     }
     return 0;
Index: trunk/src/user32/oslibres.cpp
===================================================================
--- trunk/src/user32/oslibres.cpp	(revision 1666)
+++ trunk/src/user32/oslibres.cpp	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: oslibres.cpp,v 1.5 1999-10-27 10:35:05 sandervl Exp $ */
+/* $Id: oslibres.cpp,v 1.6 1999-11-09 17:07:21 cbratschi Exp $ */
 /*
  * Window API wrappers for OS/2
@@ -155,5 +155,5 @@
         bfh  = (BITMAPFILEHEADER2 *)cursorbitmap;
         bfhColor = (BITMAPFILEHEADER2 *)((char *)bfh + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2));
-    	bafh = (BITMAPARRAYFILEHEADER2 *)bfh; //for calculation bitmap offset
+        bafh = (BITMAPARRAYFILEHEADER2 *)bfh; //for calculation bitmap offset
     }
     //skip xor/and mask
@@ -168,15 +168,15 @@
     }
 
-    if((ULONG)((char *)bafh+bfh->offBits) != (ULONG)bfhColor) 
+    if((ULONG)((char *)bafh+bfh->offBits) != (ULONG)bfhColor)
     {//color bitmap present
-    	hbmColor = GpiCreateBitmap(hps, &bfhColor->bmp2, CBM_INIT,
+        hbmColor = GpiCreateBitmap(hps, &bfhColor->bmp2, CBM_INIT,
                                (char *)bafh + bfhColor->offBits,
                                (BITMAPINFO2 *)&bfhColor->bmp2);
-    	if(hbmColor == GPI_ERROR) {
-        	dprintf(("OSLibWinCreateIcon: GpiCreateBitmap failed!"));
-	        GpiDeleteBitmap(hbmMask);
-        	WinReleasePS(hps);
-        	return 0;
-    	}
+        if(hbmColor == GPI_ERROR) {
+                dprintf(("OSLibWinCreateIcon: GpiCreateBitmap failed!"));
+                GpiDeleteBitmap(hbmMask);
+                WinReleasePS(hps);
+                return 0;
+        }
     }
 
@@ -198,7 +198,8 @@
 //******************************************************************************
 //******************************************************************************
-HANDLE OSLibWinQuerySysIcon(ULONG type)
+HANDLE OSLibWinQuerySysIcon(ULONG type,INT w,INT h)
 {
  ULONG os2type = 0;
+ HPOINTER hPointer;
 
     switch(type) {
@@ -222,9 +223,25 @@
     }
 
-    return WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-HANDLE OSLibWinQuerySysPointer(ULONG type)
+    hPointer = WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE);
+
+    if (hPointer)
+    {
+      INT sysW = WinQuerySysValue(HWND_DESKTOP,SV_CXICON),sysH = WinQuerySysValue(HWND_DESKTOP,SV_CYICON);
+
+      if (sysW != w || sysH != h)
+      {
+        POINTERINFO pi;
+
+        WinQueryPointerInfo(hPointer,&pi);
+        //CB: todo: change icon size
+
+      }
+    }
+
+    return hPointer;
+}
+//******************************************************************************
+//******************************************************************************
+HANDLE OSLibWinQuerySysPointer(ULONG type,INT w,INT h)
 {
  ULONG os2type = 0;
Index: trunk/src/user32/oslibres.h
===================================================================
--- trunk/src/user32/oslibres.h	(revision 1666)
+++ trunk/src/user32/oslibres.h	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: oslibres.h,v 1.1 1999-09-15 23:18:54 sandervl Exp $ */
+/* $Id: oslibres.h,v 1.2 1999-11-09 17:07:21 cbratschi Exp $ */
 /*
  * Window GUI resource wrapper functions for OS/2
@@ -16,10 +16,10 @@
 #include "win32type.h"
 #endif
- 
+
 HANDLE  OSLibWinSetAccelTable(HWND hwnd, HANDLE hAccel, PVOID acceltemplate);
 HANDLE  OSLibWinCreateIcon(PVOID iconbitmap);
 HANDLE  OSLibWinCreatePointer(PVOID cursorbitmap);
-HANDLE  OSLibWinQuerySysPointer(ULONG type);
-HANDLE  OSLibWinQuerySysIcon(ULONG type);
+HANDLE  OSLibWinQuerySysPointer(ULONG type,INT w,INT h);
+HANDLE  OSLibWinQuerySysIcon(ULONG type,INT w,INT h);
 
 #endif //__OSLIBGDI_H__
Index: trunk/src/user32/pmframe.cpp
===================================================================
--- trunk/src/user32/pmframe.cpp	(revision 1666)
+++ trunk/src/user32/pmframe.cpp	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.20 1999-11-03 22:04:22 cbratschi Exp $ */
+/* $Id: pmframe.cpp,v 1.21 1999-11-09 17:07:22 cbratschi Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -51,5 +51,5 @@
 //******************************************************************************
 //******************************************************************************
-VOID DeflateRect(RECTL *rect)
+inline VOID DeflateRect(RECTL *rect)
 {
   rect->xLeft++;
Index: trunk/src/user32/scroll.cpp
===================================================================
--- trunk/src/user32/scroll.cpp	(revision 1666)
+++ trunk/src/user32/scroll.cpp	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: scroll.cpp,v 1.18 1999-10-31 17:53:53 cbratschi Exp $ */
+/* $Id: scroll.cpp,v 1.19 1999-11-09 17:07:22 cbratschi Exp $ */
 /*
  * Scrollbar control
@@ -531,7 +531,7 @@
   INT x;
 
-  p1.x = rect.right-2;
+  p1.x = rect.right-1;
   p1.y = rect.bottom;
-  p2.x = rect.right-1;
+  p2.x = rect.right;
   p2.y = rect.bottom-1;
   for (x = 0;x < 3;x++)
Index: trunk/src/user32/uitools.cpp
===================================================================
--- trunk/src/user32/uitools.cpp	(revision 1666)
+++ trunk/src/user32/uitools.cpp	(revision 1667)
@@ -1,3 +1,3 @@
-/* $Id: uitools.cpp,v 1.15 1999-10-30 09:19:44 sandervl Exp $ */
+/* $Id: uitools.cpp,v 1.16 1999-11-09 17:07:23 cbratschi Exp $ */
 /*
  * User Interface Functions
@@ -191,6 +191,4 @@
         epy = rc->bottom;
         spy = epy - SmallDiam;
-        epx++;
-        epy--;
         break;
 
@@ -202,6 +200,4 @@
         epy = rc->top-1;
         spy = epy + SmallDiam;
-        epx++;
-        epy++;
         break;
 
@@ -221,6 +217,4 @@
         spy = rc->bottom-1;
         epy = spy - SmallDiam;
-        epx--;
-        epy++;
         break;
     }
@@ -358,9 +352,4 @@
  *
  * 23-Nov-1997: Changed by Bertho Stultiens
- * 25-June-1999: Changed by Christoph Bratschi
- *
- * Attention: only draw in the rect's range!
- *   left to right-1
- *   top to bottom-1
  *
  * Well, I started testing this and found out that there are a few things
@@ -508,10 +497,10 @@
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
-        LineTo(hdc, InnerRect.right-1, InnerRect.top);
+        LineTo(hdc, InnerRect.right, InnerRect.top);
     }
     if(uFlags & BF_LEFT)
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
-        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
+        LineTo(hdc, InnerRect.left, InnerRect.bottom);
     }
 
@@ -520,10 +509,10 @@
     {
         MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
-        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
+        LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1);
     }
     if(uFlags & BF_RIGHT)
     {
         MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
-        LineTo(hdc, InnerRect.right-1, InnerRect.top);
+        LineTo(hdc, InnerRect.right-1, InnerRect.top-1);
     }
 
@@ -533,10 +522,10 @@
     {
         MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
-        LineTo(hdc, InnerRect.right-RTpenplus-1, InnerRect.top+1);
+        LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
     }
     if(uFlags & BF_LEFT)
     {
         MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
-        LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus-1);
+        LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
     }
     SelectObject(hdc, RBInnerPen);
@@ -544,10 +533,10 @@
     {
         MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL);
-        LineTo(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2);
+        LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2);
     }
     if(uFlags & BF_RIGHT)
     {
         MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL);
-        LineTo(hdc, InnerRect.right-2, InnerRect.top+RTpenplus);
+        LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus);
     }
 
