Author: jpobst
Date: 2007-11-01 10:32:08 -0500 (Thu, 01 Nov 2007)
New Revision: 88653

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
Log:
2007-11-01  Jonathan Pobst  <[EMAIL PROTECTED]>

        * Application.cs: When a toolstrip has the keyboard input loop, let 
messages
        it does not use flow through to controls that are hosted in menus.
        Same with mouse clicks.
        * Form.cs: Don't close all menus on click if the click is on a
        control hosted in a menu.
        Fixes part of bug #327498, and part of bug #325969.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2007-11-01 15:19:36 UTC (rev 88652)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2007-11-01 15:32:08 UTC (rev 88653)
@@ -777,14 +777,20 @@
                                                        }
 
                                                m.HWnd = 
keyboard_capture.Handle;
-                                               
-                                               if 
(keyboard_capture.PreProcessControlMessageInternal (ref m) != 
PreProcessControlState.MessageProcessed && (m.Msg == (int)Msg.WM_KEYDOWN && 
!keyboard_capture.ProcessControlMnemonic ((char)m.WParam))) {
-                                                       if (c == null || 
c.Parent == null || !(c.Parent is ToolStrip))
+
+                                               switch 
(keyboard_capture.PreProcessControlMessageInternal (ref m)) {
+                                                       case 
PreProcessControlState.MessageProcessed:
                                                                continue;
-                                                       else
-                                                               m.HWnd = 
msg.hwnd;
-                                               } else
-                                                       continue;
+                                                       case 
PreProcessControlState.MessageNeeded:
+                                                       case 
PreProcessControlState.MessageNotNeeded:
+                                                               if ((m.Msg == 
(int)Msg.WM_KEYDOWN && !keyboard_capture.ProcessControlMnemonic 
((char)m.WParam))) {
+                                                                       if (c 
== null || !ControlOnToolStrip (c))
+                                                                               
continue;
+                                                                       else
+                                                                               
m.HWnd = msg.hwnd;
+                                                               }
+                                                               break;
+                                               }
                                        }
 #endif
 
@@ -806,8 +812,16 @@
                                                if (c2 is ToolStrip) {
                                                        if ((c2 as 
ToolStrip).GetTopLevelToolStrip () != keyboard_capture.GetTopLevelToolStrip ())
                                                                
ToolStripManager.FireAppClicked ();
-                                               } else
+                                               } else {
+                                                       if (c2.Parent != null)
+                                                               if (c2.Parent 
is ToolStripDropDownMenu)
+                                                                       if 
((c2.Parent as ToolStripDropDownMenu).GetTopLevelToolStrip () == 
keyboard_capture.GetTopLevelToolStrip ())
+                                                                               
goto default;
+                                                       if (c2.TopLevelControl 
== null)
+                                                               goto default;
+                                                               
                                                        
ToolStripManager.FireAppClicked ();
+                                               }
                                        }
                                        
                                        goto default;
@@ -929,6 +943,21 @@
                                forms.Remove (f);
                }
 
+#if NET_2_0
+               private static bool ControlOnToolStrip (Control c)
+               {
+                       Control p = c.Parent;
+                       
+                       while (p != null) {
+                               if (p is ToolStrip)
+                                       return true;
+                                       
+                               p = p.Parent;
+                       }
+                       
+                       return false;
+               }
+#endif
                #endregion
        }
 }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-11-01 15:19:36 UTC (rev 88652)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-11-01 15:32:08 UTC (rev 88653)
@@ -1,3 +1,12 @@
+2007-11-01  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * Application.cs: When a toolstrip has the keyboard input loop, let 
messages
+       it does not use flow through to controls that are hosted in menus.
+       Same with mouse clicks.
+       * Form.cs: Don't close all menus on click if the click is on a
+       control hosted in a menu.
+       Fixes part of bug #327498, and part of bug #325969.
+
 2007-10-31  Andreia Gaita <[EMAIL PROTECTED]>
 
        * WebBrowserBase.cs: Only call resize on gluezilla when it is active

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-11-01 15:19:36 UTC (rev 88652)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-11-01 15:32:08 UTC (rev 88653)
@@ -2592,7 +2592,7 @@
                                IsActive = true;
                        } else {
 #if NET_2_0
-                               if (XplatUI.IsEnabled (Handle))
+                               if (XplatUI.IsEnabled (Handle) && 
XplatUI.GetParent (m.LParam) != Handle)
                                        ToolStripManager.FireAppFocusChanged 
(this);
 #endif
                                IsActive = false;

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

Reply via email to