Author: everaldo
Date: 2007-02-23 01:39:34 -0500 (Fri, 23 Feb 2007)
New Revision: 73349

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
Log:
In System.Windows.Forms:
2007-02-22  Everaldo Canuto  <[EMAIL PROTECTED]>

        * Form.cs: Handle WM_NCHITTEST and return HTMENU when point is on 
        menu area to fix some problems for non X11 systems. Fixes #80613.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-02-23 06:34:23 UTC (rev 73348)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-02-23 06:39:34 UTC (rev 73349)
@@ -1,3 +1,8 @@
+2007-02-22  Everaldo Canuto  <[EMAIL PROTECTED]>
+
+       * Form.cs: Handle WM_NCHITTEST and return HTMENU when point is on 
+       menu area to fix some problems for non X11 systems. Fixes #80613.
+
 2007-02-22  Jackson Harper  <[EMAIL PROTECTED]>
 
        * TreeNode.cs: When a node is expanded, set its is_expanded flag

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-02-23 06:34:23 UTC (rev 73348)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-02-23 06:39:34 UTC (rev 73349)
@@ -2114,7 +2114,26 @@
                                }
 
                                // Menu drawing
-                               case Msg.WM_NCLBUTTONDOWN: {
+                case Msg.WM_NCHITTEST: {
+                    if (XplatUI.IsEnabled (Handle) && ActiveMenu != null && 
PointUnderMenu() ) {
+                        
+                        int x = LowOrder ((int)m.LParam.ToInt32 ());
+                        int y = HighOrder ((int)m.LParam.ToInt32 ());
+
+                        XplatUI.ScreenToMenu (ActiveMenu.Wnd.window.Handle, 
ref x, ref y);
+
+                        // If point is under menu return HTMENU, it prevents 
Win32 to return HTMOVE.
+                        if ((x > 0) && (y > 0) && (x < ActiveMenu.Rect.Width) 
&& (y < ActiveMenu.Rect.Height)) {
+                            m.Result = new IntPtr ((int)HitTest.HTMENU);
+                            return;
+                        }
+                                       }
+
+                                       base.WndProc (ref m);
+                                       return;
+                               }
+
+                case Msg.WM_NCLBUTTONDOWN: {
                                        if (XplatUI.IsEnabled (Handle) && 
ActiveMenu != null) {
                                                ActiveMenu.OnMouseDown(this, 
new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), 
mouse_clicks, Control.MousePosition.X, Control.MousePosition.Y, 0));
                                        }
@@ -2131,7 +2150,8 @@
                                        base.WndProc(ref m);
                                        return;
                                }
-                               case Msg.WM_NCLBUTTONUP: {
+
+                case Msg.WM_NCLBUTTONUP: {
                                        if (ActiveMaximizedMdiChild != null) {
                                                
ActiveMaximizedMdiChild.HandleMenuMouseUp (ActiveMenu,
                                                                LowOrder 
((int)m.LParam.ToInt32 ()),

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

Reply via email to