Index: trunk/src/helpers/comctl.c
===================================================================
--- trunk/src/helpers/comctl.c	(revision 194)
+++ trunk/src/helpers/comctl.c	(revision 195)
@@ -136,4 +136,5 @@
  *@@changed V0.9.16 (2001-10-24) [umoeller]: fixed wrong hatch color and paint offset
  *@@changed V0.9.16 (2001-10-28) [umoeller]: added bitmap support, fixed bad clip rectangle
+ *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color
  */
 
@@ -147,6 +148,8 @@
             ulOfs = 0;
     LONG    lLeft,
-            lRight;
+            lRight,
+            lColorMiddle = pxbd->lMiddle;
     RECTL   rclWin;
+
     memcpy(&rclWin, &pxbd->rcl, sizeof(RECTL));
 
@@ -165,4 +168,9 @@
         if (ulBorder == 0)
             ulBorder = 1;
+
+        // make the depressed color darker
+        // V0.9.20 (2002-07-31) [umoeller]
+        gpihManipulateRGB(&lColorMiddle,
+                          .95);
     }
     else
@@ -196,5 +204,5 @@
         WinFillRect(hps,
                     &rclWin,        // exclusive
-                    pxbd->lMiddle);
+                    lColorMiddle);
 
     // get icon
@@ -254,6 +262,6 @@
             WinDrawPointer(hps,
                            // center this in remaining rectl
-                           ptl.x + ulOfs,
-                           ptl.y - ulOfs,
+                           ptl.x, //  + ulOfs,
+                           ptl.y, //  - ulOfs,
                            pxbd->hptr,
                            DP_MINI);
Index: trunk/src/helpers/gpih.c
===================================================================
--- trunk/src/helpers/gpih.c	(revision 194)
+++ trunk/src/helpers/gpih.c	(revision 195)
@@ -2507,12 +2507,14 @@
  *      replacement for WinDrawPointer that can do clipping.
  *
- *      To do clipping with WinDrawPointer, one has to
- *      alter the clip rectangle for the current HPS,
- *      which involves creating regions and is thus quite
- *      some overhead.
- *
- *      Instead, this function  allows for specifying a clip
- *      rectangle directly. Besides, since it uses GpiWCBitBlt,
- *      it should probably work with all types of device contexts.
+ *      Normally, to do clipping with WinDrawPointer, one
+ *      would have to alter the clip rectangle for the current
+ *      HPS, which requires creating regions and is thus quite
+ *      expensive.
+ *
+ *      Instead, this function allows for specifying a clip
+ *      rectangle directly. It blits the icon bitmaps directly
+ *      without calling WinDrawPointer.
+ *      Besides, since it uses GpiWCBitBlt, it should probably
+ *      work with all types of device contexts.
  *
  *      This also replaces gpihIcon2Bitmap, which wasn't quite
@@ -2522,5 +2524,5 @@
  *      If you don't need clipping and are drawing to the
  *      screen only, this function has no advantage over
- *      WinDrawPointer because it's presumably slower.
+ *      WinDrawPointer because it's presumably a bit slower.
  *
  *      Flags presently supported in fl:
@@ -2528,4 +2530,6 @@
  *      --  DP_MINI (not DP_MINIICON, as stated in PMREF):
  *          use mini-icon.
+ *
+ *      --  DP_HALFTONED (V0.9.20)
  *
  *      Preconditions:
@@ -2540,4 +2544,6 @@
  *
  *@@added V0.9.19 (2002-06-18) [umoeller]
+ *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader
+ *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED
  */
 
@@ -2559,5 +2565,6 @@
         POINTL  aptl[4];
         HBITMAP hbmThis;
-        BITMAPINFOHEADER2 bmi;
+        BITMAPINFOHEADER2 bmiAndXor,
+                          bmiColor;
 
         // A HPOINTER really consists of two bitmaps,
@@ -2645,4 +2652,7 @@
             GpiSetBackColor(hps, RGBCOL_BLACK);
 
+            if (fl & DP_HALFTONED) // V0.9.20 (2002-08-04) [umoeller]
+                GpiSetPattern(hps, PATSYM_HALFTONE);
+
             /*
              * 1)   work on the AND image
@@ -2656,20 +2666,20 @@
                )
             {
-                bmi.cbFix = sizeof(bmi);
-                GpiQueryBitmapInfoHeader(hbmThis, &bmi);
+                bmiAndXor.cbFix = sizeof(bmiAndXor);
+                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
 
                 // use only half the bitmap height
-                cySrc = bmi.cy / 2;
+                cySrc = bmiAndXor.cy / 2;
 
                 // aptl[2]: source bottom-left
                 aptl[2].x =   0
-                            + lClipLeft   * bmi.cx / cxIcon;
+                            + lClipLeft   * bmiAndXor.cx / cxIcon;
                 aptl[2].y =   cySrc
                             + lClipBottom * cySrc / cyIcon;
 
                 // aptl[3]: source top-right (exclusive!)
-                aptl[3].x =   bmi.cx
-                            - lClipRight  * bmi.cx / cxIcon;
-                aptl[3].y =   bmi.cy
+                aptl[3].x =   bmiAndXor.cx
+                            - lClipRight  * bmiAndXor.cx / cxIcon;
+                aptl[3].y =   bmiAndXor.cy
                             - lClipTop    * cySrc / cyIcon;
 
@@ -2693,18 +2703,18 @@
                )
             {
-                bmi.cbFix = sizeof(bmi);
-                GpiQueryBitmapInfoHeader(hbmThis, &bmi);
+                bmiColor.cbFix = sizeof(bmiColor);
+                GpiQueryBitmapInfoHeader(hbmThis, &bmiColor);
 
                 // aptl[2]: source bottom-left
                 aptl[2].x =   0
-                            + lClipLeft   * bmi.cx / cxIcon;
+                            + lClipLeft   * bmiColor.cx / cxIcon;
                 aptl[2].y =   0
-                            + lClipBottom * bmi.cy / cyIcon;
+                            + lClipBottom * bmiColor.cy / cyIcon;
 
                 // aptl[3]: source top-right (exclusive!)
-                aptl[3].x =   bmi.cx
-                            - lClipRight  * bmi.cx / cxIcon;
-                aptl[3].y =   bmi.cy
-                            - lClipTop    * bmi.cy / cyIcon;
+                aptl[3].x =   bmiColor.cx
+                            - lClipRight  * bmiColor.cx / cxIcon;
+                aptl[3].y =   bmiColor.cy
+                            - lClipTop    * bmiColor.cy / cyIcon;
 
                 GpiWCBitBlt(hps,        // target
@@ -2727,19 +2737,21 @@
                )
             {
-                bmi.cbFix = sizeof(bmi);
-                GpiQueryBitmapInfoHeader(hbmThis, &bmi);
+                /*  we queried this one above V0.9.20 (2002-07-31) [umoeller]
+                bmiAndXor.cbFix = sizeof(bmiAndXor);
+                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
+                */
 
                 // use only half the bitmap height
-                cySrc = bmi.cy / 2;
+                cySrc = bmiAndXor.cy / 2;
 
                 // aptl[2]: source bottom-left
                 aptl[2].x =   0
-                            + lClipLeft   * bmi.cx / cxIcon;
+                            + lClipLeft   * bmiAndXor.cx / cxIcon;
                 aptl[2].y =   0
                             + lClipBottom * cySrc / cyIcon;
 
                 // aptl[3]: source top-right (exclusive!)
-                aptl[3].x =   bmi.cx
-                            - lClipRight  * bmi.cx / cxIcon;
+                aptl[3].x =   bmiAndXor.cx
+                            - lClipRight  * bmiAndXor.cx / cxIcon;
                 aptl[3].y =   cySrc
                             - lClipTop    * cySrc / cyIcon;
Index: trunk/src/helpers/winh.c
===================================================================
--- trunk/src/helpers/winh.c	(revision 194)
+++ trunk/src/helpers/winh.c	(revision 195)
@@ -2888,5 +2888,5 @@
 
 /*
- *@@ winhQueryPresColor:
+ *@@ winhQueryPresColor2:
  *      returns the specified color. This is queried in the
  *      following order:
@@ -2966,32 +2966,60 @@
  *@@changed V0.9.0 [umoeller]: added fInherit parameter
  *@@changed V0.9.7 (2000-12-02) [umoeller]: added lSysColor == -1 support
- */
-
-LONG winhQueryPresColor(HWND    hwnd,       // in: window to query
-                        ULONG   ulPP,       // in: PP_* index
-                        BOOL    fInherit,   // in: search parent windows too?
-                        LONG    lSysColor)  // in: SYSCLR_* index or -1
+ *@@changed V0.9.20 (2002-08-04) [umoeller]: added ulPPIndex, renamed func
+ */
+
+LONG winhQueryPresColor2(HWND hwnd,          // in: window to query
+                         ULONG ulppRGB,      // in: PP_* index for RGB color
+                         ULONG ulppIndex,    // in: PP_* index for color _index_ (can be null)
+                         BOOL fInherit,      // in: search parent windows too?
+                         LONG lSysColor)     // in: SYSCLR_* index or -1
 {
     ULONG   ul,
-            attrFound,
-            abValue[32];
-
-    if (ulPP != (ULONG)-1)
+            attrFound;
+    LONG    lColorFound;
+
+    if (ulppRGB != (ULONG)-1)
+    {
+        ULONG fl = 0;
+        if (!fInherit)
+            fl = QPF_NOINHERIT;
+        if (ulppIndex)
+            fl |= QPF_ID2COLORINDEX;            // convert indexed color 2 to RGB V0.9.20 (2002-08-04) [umoeller]
+
         if ((ul = WinQueryPresParam(hwnd,
-                                    ulPP,
-                                    0,
+                                    ulppRGB,
+                                    ulppIndex,
                                     &attrFound,
-                                    (ULONG)sizeof(abValue),
-                                    (PVOID)&abValue,
-                                    (fInherit)
-                                         ? 0
-                                         : QPF_NOINHERIT)))
-            return (abValue[0]);
+                                    sizeof(lColorFound),
+                                    &lColorFound,
+                                    fl)))
+            return lColorFound;
+    }
 
     // not found: get system color
     if (lSysColor != -1)
-        return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
+        return WinQuerySysColor(HWND_DESKTOP, lSysColor, 0);
 
     return -1;
+}
+
+/*
+ *@@ winhQueryPresColor:
+ *      compatibility function because this one was
+ *      exported.
+ *
+ *@@added V0.9.20 (2002-08-04) [umoeller]
+ */
+
+LONG XWPENTRY winhQueryPresColor(HWND hwnd,
+                                 ULONG ulPP,
+                                 BOOL fInherit,
+                                 LONG lSysColor)
+{
+    return winhQueryPresColor2(hwnd,
+                               ulPP,
+                               0,
+                               fInherit,
+                               lSysColor);
 }
 
@@ -3339,13 +3367,17 @@
 VOID winhSleep(ULONG ulSleep)    // in: sleep time in milliseconds
 {
-    HWND hwnd;
+    HWND    hwnd;
+
     if (hwnd = winhCreateObjectWindow(WC_STATIC, NULL))
     {
-        QMSG qmsg;
-        HAB hab = WinQueryAnchorBlock(hwnd);
-        if (WinStartTimer(hab,
-                          hwnd,
-                          1,
-                          ulSleep))
+        QMSG    qmsg;
+        HAB     hab;
+
+        if (    (hab = WinQueryAnchorBlock(hwnd))
+             && (WinStartTimer(hab,
+                               hwnd,
+                               1,
+                               ulSleep))
+           )
         {
             while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
Index: trunk/src/helpers/wphandle.c
===================================================================
--- trunk/src/helpers/wphandle.c	(revision 194)
+++ trunk/src/helpers/wphandle.c	(revision 195)
@@ -116,5 +116,5 @@
     }
 
-    return (ERROR_WPH_NO_ACTIVEHANDLES_DATA);
+    return ERROR_WPH_NO_ACTIVEHANDLES_DATA;
 }
 
