Author: toshok
Date: 2006-09-11 16:06:57 -0400 (Mon, 11 Sep 2006)
New Revision: 65255

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
Log:
2006-09-11  Chris Toshok  <[EMAIL PROTECTED]>

        * MenuAPI.cs: rework OnMouseUp a bit so that releasing the mouse
        button on various spots (including outside the menu) works closer
        to MS, and doesn't crash.  Fixes #79343.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-11 19:37:41 UTC (rev 65254)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-11 20:06:57 UTC (rev 65255)
@@ -1,3 +1,9 @@
+2006-09-11  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * MenuAPI.cs: rework OnMouseUp a bit so that releasing the mouse
+       button on various spots (including outside the menu) works closer
+       to MS, and doesn't crash.  Fixes #79343.
+
 2006-09-11  Gert Driesen  <[EMAIL PROTECTED]>
 
        * ListView.cs: Do not initialize item_sorter in init. To match MS,

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs       
2006-09-11 19:37:41 UTC (rev 65254)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs       
2006-09-11 20:06:57 UTC (rev 65255)
@@ -169,11 +169,22 @@
                public void OnMouseUp (MouseEventArgs args)
                {
                        MenuItem item = GetItemAtXY (args.X, args.Y);
-                       if (item.Parent is MainMenu)
-                               return;
 
-                       Deactivate ();
-                       item.PerformClick ();
+                       if (item == null) {
+                               /* the user released the mouse button outside 
the menu */
+                               Deactivate ();
+                       }
+                       else {
+                               /* releasing the mouse button on a
+                                * popup item leaves things active */
+                               if (item.IsPopup)
+                                       return;
+
+                               /* otherwise we hide the menu and
+                                * click the menu item */
+                               Deactivate ();
+                               item.PerformClick ();
+                       }
                }
 
                void MoveSelection (MenuItem item)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to