Index: trunk/src/user32/menu.cpp
===================================================================
--- trunk/src/user32/menu.cpp	(revision 7191)
+++ trunk/src/user32/menu.cpp	(revision 7195)
@@ -1,3 +1,3 @@
-/* $Id: menu.cpp,v 1.38 2001-10-16 14:49:45 sandervl Exp $*/
+/* $Id: menu.cpp,v 1.39 2001-10-24 15:41:53 sandervl Exp $*/
 /*
  * Menu functions
@@ -35,4 +35,5 @@
 #include "pmwindow.h"
 #include "win32wmisc.h"
+#include "oslibmsg.h"
 
 #define DBG_LOCALLOG    DBG_menu
@@ -2827,7 +2828,13 @@
     }
 
-    //EVENT_Capture( mt.hOwnerWnd, HTMENU ); //CB: todo
+#ifdef __WIN32OS2__
     //SvL: Set keyboard & mouse event capture
     SetCapture(mt.hOwnerWnd);
+    //SetCapture breaks system menu (double click), must generate double
+    //clicks manually
+    SetMenuDoubleClick(TRUE);
+#else
+    EVENT_Capture( mt.hOwnerWnd, HTMENU );
+#endif
 
     while (!fEndMenu)
@@ -2838,7 +2845,10 @@
         /* we have to keep the message in the queue until it's
          * clear that menu loop is not over yet. */
-//        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
+#ifdef __WIN32OS2__
         //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
         if (!GetMessageA(&msg,0,0,0)) break;
+#else
+        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
+#endif
         TranslateMessage( &msg );
         mt.pt = msg.pt;
@@ -2868,4 +2878,8 @@
                     if (bSysMenu && (hmenu == mt.hTopMenu))
                     {
+#ifdef __WIN32OS2__
+                        //double click on system menu -> close application
+                        PostMessageA(hwnd, WM_SYSCOMMAND,SC_CLOSE, msg.lParam);
+#endif
                         fEndMenu = TRUE;
                         break;
@@ -3062,7 +3076,7 @@
         else if (msg.message == WM_SYSCOMMAND)
         {
-                /* The user clicked on the system menu/button */
-        fEndMenu = TRUE;
-        break;
+            /* The user clicked on the system menu/button */
+            fEndMenu = TRUE;
+            break;
         }
         else
@@ -3079,6 +3093,8 @@
         else mt.trackFlags &= ~TF_SKIPREMOVE;
     }
-
+#ifdef __WIN32OS2__
+    SetMenuDoubleClick(FALSE);
     ReleaseCapture();
+#endif
 
     menu = MENU_GetMenu(mt.hTopMenu);
Index: trunk/src/user32/oslibmsg.h
===================================================================
--- trunk/src/user32/oslibmsg.h	(revision 7191)
+++ trunk/src/user32/oslibmsg.h	(revision 7195)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsg.h,v 1.15 2001-10-03 18:37:52 sandervl Exp $ */
+/* $Id: oslibmsg.h,v 1.16 2001-10-24 15:41:53 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -39,4 +39,6 @@
 BOOL  OSLibWinReplyMessage(ULONG result);
 ULONG OSLibWinQueryQueueStatus();
+
+void  SetMenuDoubleClick(BOOL fSet);
 
 BOOL  OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode);
Index: trunk/src/user32/oslibmsgtranslate.cpp
===================================================================
--- trunk/src/user32/oslibmsgtranslate.cpp	(revision 7191)
+++ trunk/src/user32/oslibmsgtranslate.cpp	(revision 7195)
@@ -1,3 +1,3 @@
-/* $Id: oslibmsgtranslate.cpp,v 1.65 2001-10-24 13:18:59 phaller Exp $ */
+/* $Id: oslibmsgtranslate.cpp,v 1.66 2001-10-24 15:41:54 sandervl Exp $ */
 /*
  * Window message translation functions for OS/2
@@ -161,4 +161,7 @@
 };
 
+static BOOL fGenerateDoubleClick = FALSE;
+static MSG  doubleClickMsg = {0};
+
 //******************************************************************************
 //******************************************************************************
@@ -185,4 +188,10 @@
 {
   return ((win32wnd->getLastHitTestVal() != HTCLIENT_W) && (WinQueryCapture(HWND_DESKTOP) != win32wnd->getOS2WindowHandle()));
+}
+//******************************************************************************
+//******************************************************************************
+void SetMenuDoubleClick(BOOL fSet)
+{
+  fGenerateDoubleClick = fSet;
 }
 //******************************************************************************
@@ -389,4 +398,6 @@
         //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
 
+        dprintf(("MsgButton %x (%x) %d at (%d,%d) time %x", winMsg->hwnd, os2Msg->hwnd, WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN), winMsg->pt.x, winMsg->pt.y, winMsg->time));
+
         HWND hwnd;
 
@@ -445,4 +456,35 @@
             else goto dummymessage; //don't send mouse messages to disabled windows
         }
+
+        DisableLogging();
+        if ((winMsg->message == WINWM_LBUTTONDOWN) ||
+            (winMsg->message == WINWM_RBUTTONDOWN) ||
+            (winMsg->message == WINWM_MBUTTONDOWN) ||
+            (winMsg->message == WINWM_NCLBUTTONDOWN) ||
+            (winMsg->message == WINWM_NCRBUTTONDOWN) ||
+            (winMsg->message == WINWM_NCMBUTTONDOWN))
+        {
+            if(fGenerateDoubleClick && doubleClickMsg.message == winMsg->message && 
+               winMsg->time - doubleClickMsg.time < GetDoubleClickTime() &&
+               (abs(winMsg->pt.x - doubleClickMsg.pt.x) < GetSystemMetrics(SM_CXDOUBLECLK_W)/2) &&
+               (abs(winMsg->pt.y - doubleClickMsg.pt.y) < GetSystemMetrics(SM_CYDOUBLECLK_W)/2)) 
+            {
+                 dprintf(("single -> double click"));
+                 if(winMsg->message >= WINWM_LBUTTONDOWN) {
+                      winMsg->message += (WINWM_LBUTTONDBLCLK - WINWM_LBUTTONDOWN);
+                 }
+                 else winMsg->message += (WINWM_LBUTTONDBLCLK - WINWM_NCLBUTTONDOWN);
+                 doubleClickMsg.message = 0;
+            }
+            else {
+                 dprintf(("save for double click"));
+                 doubleClickMsg = *winMsg;
+                 if(doubleClickMsg.message >= WINWM_NCLBUTTONDOWN && doubleClickMsg.message <= WINWM_NCMBUTTONDOWN) {
+                      doubleClickMsg.message += (WINWM_LBUTTONDOWN - WINWM_NCLBUTTONDOWN);
+                 }
+            }
+        }
+        EnableLogging();
+
         break;
     }
Index: trunk/src/user32/pmwindow.cpp
===================================================================
--- trunk/src/user32/pmwindow.cpp	(revision 7191)
+++ trunk/src/user32/pmwindow.cpp	(revision 7195)
@@ -1,3 +1,3 @@
-/* $Id: pmwindow.cpp,v 1.156 2001-10-18 13:28:08 sandervl Exp $ */
+/* $Id: pmwindow.cpp,v 1.157 2001-10-24 15:41:54 sandervl Exp $ */
 /*
  * Win32 Window Managment Code for OS/2
@@ -331,7 +331,4 @@
     case WM_SHOW:
         dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1));
-        //SvL: When a window is made visible, then we don't receive a
-        //     WM_VRNENABLED message (for some weird reason)
-        win32wnd->callVisibleRgnNotifyProc(TRUE);
         win32wnd->MsgShow((ULONG)mp1);
         break;
@@ -695,5 +692,5 @@
     {
         //WM_CREATE handled during client window creation
-        dprintf(("PMFRAME: WM_CREATE %x"));
+        dprintf(("PMFRAME: WM_CREATE %x", hwnd));
         goto RunDefFrameWndProc;
     }
@@ -972,4 +969,14 @@
         }
 
+        //SvL: When a window is made visible, then we don't receive a
+        //     WM_VRNENABLED message (for some weird reason)
+        if(pswp->fl & SWP_SHOW) {
+            win32wnd->callVisibleRgnNotifyProc(TRUE);
+        }
+        else 
+        if(pswp->fl & SWP_HIDE) {
+            win32wnd->callVisibleRgnNotifyProc(FALSE);
+        }
+
         if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
         {
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 7191)
+++ trunk/src/user32/win32wbase.cpp	(revision 7195)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.294 2001-10-24 10:26:45 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.295 2001-10-24 15:41:54 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -1080,5 +1080,5 @@
  BOOL  fClick = FALSE;
 
-//    dprintf(("MsgButton at (%d,%d)", msg->pt.x, msg->pt.y));
+    dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y));
     switch(msg->message) {
         case WM_LBUTTONDBLCLK:
@@ -1088,6 +1088,4 @@
                 {
                     msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
-                    MsgButton(msg);
-                    msg->message++; //button-up
                     return MsgButton(msg);
                 }
