Index: trunk/src/user32/Makefile
===================================================================
--- trunk/src/user32/Makefile	(revision 1970)
+++ trunk/src/user32/Makefile	(revision 1971)
@@ -1,3 +1,3 @@
-# $Id: Makefile,v 1.45 1999-11-24 19:32:21 sandervl Exp $
+# $Id: Makefile,v 1.46 1999-12-05 00:31:46 sandervl Exp $
 
 #
@@ -159,7 +159,7 @@
 
 clean:
-        $(RM) *.obj *.lib *.dll *.map *.pch *.res *.lrf resource.asm
+        $(RM) *.obj *.lib *.dll *.map *.pch *.res *.lrf resource.asm *.lrf
         $(RM) $(PDWIN32_BIN)\$(TARGET).dll
         $(RM) $(PDWIN32_LIB)\$(TARGET).lib
-#        $(RM) $(TARGET)exp.def
+        $(RM) $(TARGET)exp.def
 
Index: trunk/src/user32/USER32.DEF
===================================================================
--- trunk/src/user32/USER32.DEF	(revision 1970)
+++ trunk/src/user32/USER32.DEF	(revision 1971)
@@ -1,3 +1,3 @@
-; $Id: USER32.DEF,v 1.21 1999-11-23 19:34:18 sandervl Exp $
+; $Id: USER32.DEF,v 1.22 1999-12-05 00:31:46 sandervl Exp $
 
 ;Created by BLAST for IBM's compiler
@@ -10,9 +10,9 @@
 
 IMPORTS
-    _WinSetDAXData             = PMMERGE.5448
-    _GpiQueryDCData            = PMGPI.665
-    _GpiEnableYInversion       = PMGPI.723
-    _HPSToHDC                  = PMWINX.1022
-    _DeleteHDC                 = PMWINX.1023
+    _WinSetDAXData              = PMMERGE.5448
+    _GpiQueryDCData             = PMGPI.665
+    _GpiEnableYInversion        = PMGPI.723
+    _HPSToHDC                   = PMWINX.1022
+    _DeleteHDC                  = PMWINX.1023
     __DestroyCaret              = PMMERGE.10001
     __GetCaretBlinkTime         = PMMERGE.10002
@@ -20,4 +20,5 @@
     __SetCaretBlinkTime         = PMMERGE.10005
     __ShowCaret                 = PMMERGE.10007
+    WinReplyMsg                 = PMMERGE.5325
 
 EXPORTS
Index: trunk/src/user32/oslibmsg.cpp
===================================================================
--- trunk/src/user32/oslibmsg.cpp	(revision 1970)
+++ trunk/src/user32/oslibmsg.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsg.cpp,v 1.13 1999-11-27 00:10:20 sandervl Exp $ */
+/* $Id: oslibmsg.cpp,v 1.14 1999-12-05 00:31:47 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -26,4 +26,5 @@
 #include <thread.h>
 #include <wprocess.h>
+#include "pmwindow.h"
 
 typedef BOOL (EXPENTRY FNTRANS)(MSG *, QMSG *);
@@ -274,2 +275,34 @@
 //******************************************************************************
 //******************************************************************************
+BOOL OSLibWinInSendMessage()
+{
+   return WinInSendMsg(GetThreadHAB());
+}
+//******************************************************************************
+//******************************************************************************
+DWORD OSLibWinGetMessagePos()
+{
+ APIRET rc;
+ POINTL ptl;
+
+   rc = WinQueryMsgPos(GetThreadHAB(), &ptl);
+   if(!rc) {
+      return 0;
+   }
+   //convert to windows coordinates
+   return MAKEULONG(ptl.x, ScreenHeight - ptl.y - 1);
+}
+//******************************************************************************
+//******************************************************************************
+LONG OSLibWinGetMessageTime()
+{
+   return (LONG)WinQueryMsgTime(GetThreadHAB());
+}
+//******************************************************************************
+//******************************************************************************
+BOOL OSLibWinReplyMessage(ULONG result)
+{
+   return (BOOL)WinReplyMsg( NULLHANDLE, NULLHANDLE, HMQ_CURRENT, (MRESULT)result);
+}
+//******************************************************************************
+//******************************************************************************
Index: trunk/src/user32/oslibmsg.h
===================================================================
--- trunk/src/user32/oslibmsg.h	(revision 1970)
+++ trunk/src/user32/oslibmsg.h	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsg.h,v 1.5 1999-11-27 00:10:20 sandervl Exp $ */
+/* $Id: oslibmsg.h,v 1.6 1999-12-05 00:31:47 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -33,4 +33,8 @@
 BOOL  OSLibInitMsgQueue();
 BOOL  OSLibWinWaitMessage();
+BOOL  OSLibWinInSendMessage();
+DWORD OSLibWinGetMessagePos();
+LONG  OSLibWinGetMessageTime();
+BOOL  OSLibWinReplyMessage(ULONG result);
 
 ULONG OSLibWinQueryQueueStatus();
Index: trunk/src/user32/pmframe.cpp
===================================================================
--- trunk/src/user32/pmframe.cpp	(revision 1970)
+++ trunk/src/user32/pmframe.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.25 1999-12-01 18:23:28 cbratschi Exp $ */
+/* $Id: pmframe.cpp,v 1.26 1999-12-05 00:31:47 sandervl Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -321,6 +321,11 @@
       LONG      yDelta = pswp->cy - swpOld.cy;
       LONG      xDelta = pswp->cx - swpOld.cx;
+      LONG      clientHeight;
 
         dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+
+ 	//Save height so WM_WINDOWPOSCHANGED handler in pmwindow.cpp 
+        //(for client) doesn't overwrite the client rectangle (breaks ydelta calculation)
+	clientHeight = win32wnd->getWindowHeight();
 
         RestoreOS2TIB();
@@ -329,7 +334,4 @@
 
         if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
-            goto PosChangedEnd;
-
-        if(!win32wnd->CanReceiveSizeMsgs())
             goto PosChangedEnd;
 
@@ -345,8 +347,11 @@
 
         //delta is difference between old and new client height
-        yDelta = swpOld.cy - win32wnd->getWindowHeight();
+        yDelta = swpOld.cy - clientHeight;
 
         win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
         win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
+
+        if(!win32wnd->CanReceiveSizeMsgs())
+            goto PosChangedEnd;
 
         wp.hwnd = win32wnd->getWindowHandle();
@@ -385,5 +390,5 @@
                     swp[i].fl &= ~(SWP_NOREDRAW);
                 }
-                //else child window with the same start coorindates as the client area
+                //else child window with the same start coordinates as the client area
                 //The app should resize it.
 
Index: trunk/src/user32/pmwindow.cpp
===================================================================
--- trunk/src/user32/pmwindow.cpp	(revision 1970)
+++ trunk/src/user32/pmwindow.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.61 1999-12-04 00:04:19 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.62 1999-12-05 00:31:47 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -277,5 +277,13 @@
         break;
 
-#if 0
+#if 1
+    case WM_ADJUSTWINDOWPOS:
+    {
+      PSWP     pswp = (PSWP)mp1;
+
+        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+        goto RunDefWndProc;
+    }
+#else
     case WM_ADJUSTWINDOWPOS:
     {
@@ -331,5 +339,7 @@
         break;
     }
-
+#endif
+
+#if 1
     case WM_WINDOWPOSCHANGED:
     {
@@ -341,7 +351,7 @@
       LONG      xDelta = pswp->cx - swpOld.cx;
 
-        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
-
-        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
+        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
+
+        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto RunDefWndProc;
 
         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
@@ -355,7 +365,7 @@
         OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, win32wnd->getOS2FrameWindowHandle());
 
-        if (!win32wnd->CanReceiveSizeMsgs())    break;
-
-        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
+        if (!win32wnd->CanReceiveSizeMsgs())    goto RunDefWndProc;
+
+        dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy));
         win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
 
@@ -366,61 +376,5 @@
            wp.hwndInsertAfter = wndAfter->getWindowHandle();
         }
-
-        if (yDelta != 0 || xDelta != 0)
-        {
-            HENUM henum = WinBeginEnumWindows(pswp->hwnd);
-            SWP swp[10];
-            int i = 0;
-            HWND hwnd;
-
-            while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
-            {
-#if 0
-                if (mdiClient )
-                {
-                  continue;
-                }
-#endif
-                WinQueryWindowPos(hwnd, &(swp[i]));
-
-#ifdef DEBUG
-                Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
-                dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
-                         yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
-#endif
-
-                if(swp[i].y != 0) {
-                    //child window at offset <> 0 from client area -> offset now changes
-                    swp[i].y  += yDelta;
-                    swp[i].fl &= ~(SWP_NOREDRAW);
-                }
-                //else child window with the same start coorindates as the client area
-                //The app should resize it.
-
-               if (i == 9)
-                {
-                    WinSetMultWindowPos(GetThreadHAB(), swp, 10);
-                    i = 0;
-                }
-                else
-                {
-                    i++;
-                }
-            }
-
-            WinEndEnumWindows(henum);
-
-            if (i)
-               WinSetMultWindowPos(GetThreadHAB(), swp, i);
-        }
-        if (yDelta != 0)
-        {
-            POINT pt;
-            if(GetCaretPos (&pt) == TRUE)
-            {
-                pt.y -= yDelta;
-                SetCaretPos (pt.x, pt.y);
-            }
-        }
+        //SvL: Can be sent twice now (once in pmframe, once here); shouldn't really matter though...
         win32wnd->MsgPosChanged((LPARAM)&wp);
 
@@ -881,5 +835,5 @@
         dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle()));
 #if 1
-	break;
+        break;
 #else
 
@@ -971,4 +925,5 @@
 //  dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
   RestoreOS2TIB();
+
   return WinDefWindowProc( hwnd, msg, mp1, mp2 );
 } /* End of Win32WindowProc */
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 1970)
+++ trunk/src/user32/win32wbase.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.103 1999-12-04 00:04:19 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.104 1999-12-05 00:31:48 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -11,4 +11,6 @@
  *
  * TODO: Not thread/process safe
+ * TODO: Calling window handler directly from SendMessageA/W can cause problems
+ *       for GetMessageTime/Pos & InSendMessage
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -716,4 +718,5 @@
 {
   if(SendInternalMessageA(WM_CLOSE, 0, 0) == 0) {
+	dprintf(("Win32BaseWindow::MsgClose, app handles msg"));
         return 0; //app handles this message
   }
Index: trunk/src/user32/window.cpp
===================================================================
--- trunk/src/user32/window.cpp	(revision 1970)
+++ trunk/src/user32/window.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: window.cpp,v 1.39 1999-12-02 19:30:41 sandervl Exp $ */
+/* $Id: window.cpp,v 1.40 1999-12-05 00:31:49 sandervl Exp $ */
 /*
  * Win32 window apis for OS/2
@@ -1251,5 +1251,4 @@
     POINT wPoint;
 
-
     wPoint.x = point.x;
     wPoint.y = windowDesktop->getWindowHeight() - point.y;
Index: trunk/src/user32/windowmsg.cpp
===================================================================
--- trunk/src/user32/windowmsg.cpp	(revision 1970)
+++ trunk/src/user32/windowmsg.cpp	(revision 1971)
@@ -1,3 +1,3 @@
-/* $Id: windowmsg.cpp,v 1.7 1999-11-27 00:10:22 sandervl Exp $ */
+/* $Id: windowmsg.cpp,v 1.8 1999-12-05 00:31:50 sandervl Exp $ */
 /*
  * Win32 window message APIs for OS/2
@@ -11,4 +11,5 @@
  * TODO: GetQueueStatus: QS_HOTKEY (oslibmsg.cpp) & low word bits
  * TODO: MsgWaitForMultipleObjects: timeout isn't handled correctly (can return too late)
+ * TODO: GetMessageExtraInfo
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -95,9 +96,10 @@
 }
 //******************************************************************************
-//******************************************************************************
-LONG WIN32API GetMessageExtraInfo(void)
-{
-    dprintf(("USER32:  GetMessageExtraInfo\n"));
-    return O32_GetMessageExtraInfo();
+//TODO: 
+//******************************************************************************
+LONG WIN32API GetMessageExtraInfo()
+{
+    dprintf(("USER32: GetMessageExtraInfo NOT SUPPORTED"));
+    return 0;
 }
 //******************************************************************************
@@ -105,6 +107,6 @@
 DWORD WIN32API GetMessagePos(void)
 {
-    dprintf(("USER32:  GetMessagePos\n"));
-    return O32_GetMessagePos();
+    dprintf(("USER32: GetMessagePos"));
+    return OSLibWinGetMessagePos();
 }
 //******************************************************************************
@@ -112,6 +114,6 @@
 LONG WIN32API GetMessageTime(void)
 {
-    dprintf(("USER32:  GetMessageTime\n"));
-    return O32_GetMessageTime();
+    dprintf(("USER32: GetMessageTime"));
+    return OSLibWinGetMessageTime();
 }
 //******************************************************************************
@@ -210,18 +212,14 @@
 BOOL WIN32API InSendMessage(void)
 {
-#ifdef DEBUG
-    WriteLog("USER32:  InSendMessage\n");
-#endif
-    return O32_InSendMessage();
-}
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API ReplyMessage( LRESULT arg1)
-{
-#ifdef DEBUG
-    WriteLog("USER32:  ReplyMessage\n");
-#endif
-    return O32_ReplyMessage(arg1);
+    dprintf(("USER32:  InSendMessage"));
+    return OSLibWinInSendMessage();
+}
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API ReplyMessage(LRESULT result)
+{
+    dprintf(("USER32: ReplyMessage %x", result));
+    return OSLibWinReplyMessage(result);
 }
 //******************************************************************************
