Index: trunk/src/user32/oslibmsgtranslate.cpp
===================================================================
--- trunk/src/user32/oslibmsgtranslate.cpp	(revision 3602)
+++ trunk/src/user32/oslibmsgtranslate.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsgtranslate.cpp,v 1.30 2000-05-12 18:09:40 sandervl Exp $ */
+/* $Id: oslibmsgtranslate.cpp,v 1.31 2000-05-24 19:30:05 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -189,4 +189,9 @@
         //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
 
+#ifdef ODIN_HITTEST
+	//Send WM_HITTEST message
+        win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
+#endif
+
 	//if a window is disabled, it's parent receives the mouse messages
 	if(!win32wnd->IsWindowEnabled()) {
@@ -242,4 +247,8 @@
         //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
 
+#ifdef ODIN_HITTEST
+	//Send WM_HITTEST message
+        win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
+#endif
 	//if a window is disabled, it's parent receives the mouse messages
 	if(!win32wnd->IsWindowEnabled()) {
@@ -288,4 +297,5 @@
         winMsg->message = WINWM_NCACTIVATE;
         winMsg->wParam  = SHORT1FROMMP(os2Msg->mp1);
+
         return TRUE;
       }
@@ -417,10 +427,10 @@
       BOOL fMinimized = FALSE;
 
-        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
+        hwndActivate = Win32BaseWindow::OS2ToWin32Handle(hwndActivate);
+	if(hwndActivate == 0) {
                 //another (non-win32) application's window
                 //set to desktop window handle
-                hwndActivate = windowDesktop->getWindowHandle();
-        }
-        else    hwndActivate = Win32BaseWindow::OS2ToWin32Handle(hwndActivate);
+		hwndActivate = windowDesktop->getWindowHandle();
+	}
 
         if(WinQueryWindowULong(os2Msg->hwnd, QWL_STYLE) & WS_MINIMIZED)
@@ -483,4 +493,9 @@
         //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
 
+#ifdef ODIN_HITTEST
+	//Send WM_HITTEST message
+        win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
+#endif
+
 	//if a window is disabled, it's parent receives the mouse messages
 	if(!win32wnd->IsWindowEnabled()) {
@@ -535,4 +550,9 @@
     {
         //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
+
+#ifdef ODIN_HITTEST
+	//Send WM_HITTEST message
+        win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
+#endif
 
 	//if a window is disabled, it's parent receives the mouse messages
Index: trunk/src/user32/pmframe.cpp
===================================================================
--- trunk/src/user32/pmframe.cpp	(revision 3602)
+++ trunk/src/user32/pmframe.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: pmframe.cpp,v 1.54 2000-05-22 17:21:10 cbratschi Exp $ */
+/* $Id: pmframe.cpp,v 1.55 2000-05-24 19:30:05 sandervl Exp $ */
 /*
  * Win32 Frame Managment Code for OS/2
@@ -464,5 +464,5 @@
         USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS);
 
-        dprintf(("PMFRAME: WM_ACTIVATE %x %x", hwnd, mp2));
+        dprintf(("PMFRAME: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2));
         if(win32wnd->IsWindowCreated())
           win32wnd->DispatchMsgA(pWinMsg);
Index: trunk/src/user32/pmwindow.cpp
===================================================================
--- trunk/src/user32/pmwindow.cpp	(revision 3602)
+++ trunk/src/user32/pmwindow.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.90 2000-05-12 18:09:41 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.91 2000-05-24 19:30:06 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -96,5 +96,9 @@
      (PSZ)WIN32_STDCLASS,               /* Window class name            */
      (PFNWP)Win32WindowProc,            /* Address of window procedure  */
+#ifdef ODIN_HITTEST
+     0,
+#else
      CS_HITTEST,
+#endif
      NROF_WIN32WNDBYTES)) {
         dprintf(("WinRegisterClass Win32BaseWindow failed"));
@@ -105,5 +109,9 @@
      (PSZ)WIN32_STDCLASS2,              /* Window class name            */
      (PFNWP)Win32WindowProc,            /* Address of window procedure  */
+#ifdef ODIN_HITTEST
+     CS_SAVEBITS,
+#else
      CS_SAVEBITS | CS_HITTEST,
+#endif
      NROF_WIN32WNDBYTES)) {
         dprintf(("WinRegisterClass Win32BaseWindow failed"));
@@ -118,5 +126,9 @@
                           WIN32_INNERFRAME,
                           FrameClassInfo.pfnWindowProc,
+#ifdef ODIN_HITTEST
+                          FrameClassInfo.flClassStyle,
+#else
                           FrameClassInfo.flClassStyle | CS_HITTEST,
+#endif
                           FrameClassInfo.cbWindowData)) {
      dprintf (("WinRegisterClass Win32InnerFrame failed"));
@@ -263,5 +275,5 @@
     case WM_ACTIVATE:
     {
-        dprintf(("OS2: WM_ACTIVATE %x %x", hwnd, mp2));
+        dprintf(("OS2: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2));
 
         if(win32wnd->IsWindowCreated())
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 3602)
+++ trunk/src/user32/win32wbase.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.193 2000-05-22 19:05:58 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.194 2000-05-24 19:30:06 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -1142,4 +1142,11 @@
 //******************************************************************************
 //******************************************************************************
+LONG Win32BaseWindow::sendHitTest(ULONG lParam)
+{
+    lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, lParam);
+    return lastHitTestVal;
+}
+//******************************************************************************
+//******************************************************************************
 BOOL Win32BaseWindow::isMDIClient()
 {
@@ -1387,5 +1394,11 @@
 
     case WM_ACTIVATE:
-      return 0;
+	/* The default action in Windows is to set the keyboard focus to
+	 * the window, if it's being activated and not minimized */
+      	if (LOWORD(wParam) != WA_INACTIVE) {
+		if(!(getStyle() & WS_MINIMIZE))
+			SetFocus(getWindowHandle());
+      	}
+      	return 0;
 
     case WM_SETCURSOR:
@@ -2131,5 +2144,4 @@
    Win32BaseWindow *window;
    HWND hParent = 0;
-   BOOL fShow = FALSE;
 
     if (fuFlags &
@@ -2245,13 +2257,10 @@
     rc = OSLibWinSetMultWindowPos(&swp, 1);
 
-#ifdef DEBUG
-    if(fShow) {
-        dprintf(("Frame style 0x%08x, client style 0x%08x", OSLibQueryWindowStyle(OS2HwndFrame), OSLibQueryWindowStyle(OS2Hwnd)));
-    }
-#endif
-    if (rc == FALSE)
+    if(rc == FALSE)
     {
         dprintf(("OSLibWinSetMultWindowPos failed! Error %x",OSLibWinGetLastError()));
-    }
+	return 0;
+    }
+
     if((fuFlags & SWP_FRAMECHANGED) && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE)))
     {
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 3602)
+++ trunk/src/user32/win32wbase.h	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.94 2000-05-05 11:32:37 sandervl Exp $ */
+/* $Id: win32wbase.h,v 1.95 2000-05-24 19:30:07 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -149,4 +149,5 @@
 
          LONG   getLastHitTestVal()             { return lastHitTestVal; }
+         LONG   sendHitTest(ULONG lParam);
 
          DWORD  getWindowContextHelpId()        { return contextHelpId; };
Index: trunk/src/user32/win32wmdichild.cpp
===================================================================
--- trunk/src/user32/win32wmdichild.cpp	(revision 3602)
+++ trunk/src/user32/win32wmdichild.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: win32wmdichild.cpp,v 1.22 2000-02-16 14:28:24 sandervl Exp $ */
+/* $Id: win32wmdichild.cpp,v 1.23 2000-05-24 19:30:08 sandervl Exp $ */
 /*
  * Win32 MDI Child Window Class for OS/2
@@ -99,5 +99,5 @@
 
     case WM_CHILDACTIVATE:
-        client->childActivate(this);
+       	client->childActivate(this);
         return 0;
 
@@ -295,5 +295,6 @@
 
     /* this menu is needed to set a check mark in MDI_ChildActivate */
-    AppendMenuA(client->getMDIMenu(), MF_STRING ,wIDmenu, lpstrDef );
+    if(client->getMDIMenu())
+    	AppendMenuA(client->getMDIMenu(), MF_STRING ,wIDmenu, lpstrDef );
 
     client->incNrActiveChildren();
@@ -347,4 +348,7 @@
     if(newchild && GetLastError() == 0)
     {
+	/* All MDI child windows have the WS_EX_MDICHILD style */
+	newchild->setExStyle(newchild->getExStyle() | WS_EX_MDICHILD);
+
         newchild->menuModifyItem();
 
@@ -363,7 +367,10 @@
              * the SWP_SHOWWINDOW command.
              */
-            newchild->SetWindowLongA(GWL_STYLE, newchild->getStyle() & ~WS_VISIBLE);
+            newchild->setStyle(newchild->getStyle() & ~WS_VISIBLE);
+
             if(showflag){
-                newchild->SetWindowPos(0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
+		dprintf(("newchild->SetWindowPos active window %x", GetActiveWindow()));
+                newchild->SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
+		dprintf(("newchild->SetWindowPos active window %x", GetActiveWindow()));
 
                 /* Set maximized state here in case hwnd didn't receive WM_SIZE
@@ -382,5 +389,5 @@
             else
                 /* needed, harmless ? */
-                newchild->SetWindowPos(0, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE );
+                newchild->SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE );
 
         }
@@ -389,5 +396,7 @@
     {
         client->decNrActiveChildren();
-        DeleteMenu(client->getMDIMenu(), wIDmenu,MF_BYCOMMAND);
+	if(client->getMDIMenu()) {
+        	DeleteMenu(client->getMDIMenu(), wIDmenu,MF_BYCOMMAND);
+	}
 
         maximizedChild = client->getMaximizedChild();
Index: trunk/src/user32/win32wmdiclient.cpp
===================================================================
--- trunk/src/user32/win32wmdiclient.cpp	(revision 3602)
+++ trunk/src/user32/win32wmdiclient.cpp	(revision 3603)
@@ -1,3 +1,3 @@
-/* $Id: win32wmdiclient.cpp,v 1.26 2000-03-18 16:13:40 cbratschi Exp $ */
+/* $Id: win32wmdiclient.cpp,v 1.27 2000-05-24 19:30:08 sandervl Exp $ */
 /*
  * Win32 MDI Client Window Class for OS/2
@@ -333,4 +333,11 @@
     }
 
+    /* Don't activate if it is already active. Might happen 
+       since ShowWindow DOES activate MDI children */
+    if(activeChild == child)
+    {
+      	return 0;
+    }
+
     if( GetActiveWindow() == getParent()->getWindowHandle())
         isActiveFrameWnd = TRUE;
