Author: rolf
Date: 2006-12-11 19:57:16 -0500 (Mon, 11 Dec 2006)
New Revision: 69381

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
        * Hwnd.cs: Save the CreateParams.ExStyle so that it can be
        queried after the window is created.
        
        * XplatUIX11.cs: Added SendParentNotify to implement 
        WM_PARENTNOTIFY logic. Fixes #79965.
        
        * Control.cs: Added MakeParam.
        
2006-12-11  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-12 00:46:53 UTC (rev 69380)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-12 00:57:16 UTC (rev 69381)
@@ -1,5 +1,15 @@
 2006-12-11  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
 
+       * Hwnd.cs: Save the CreateParams.ExStyle so that it can be
+       queried after the window is created.
+       
+       * XplatUIX11.cs: Added SendParentNotify to implement 
+       WM_PARENTNOTIFY logic. Fixes #79965.
+       
+       * Control.cs: Added MakeParam.
+       
+2006-12-11  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
        * MdiClient.cs: Resume Layout before setting window
        states (fixes #80201).
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-12-12 00:46:53 UTC (rev 69380)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-12-12 00:57:16 UTC (rev 69381)
@@ -983,6 +983,10 @@
                        // Only here to be overriden by our actual controls; 
this is needed by the accessibility class
                }
 
+               internal static IntPtr MakeParam (int low, int high){
+                       return new IntPtr (high << 16 | low & 0xffff);
+               }
+
                internal static int LowOrder (int param) {
                        return ((int)(short)(param & 0xffff));
                }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs  
2006-12-12 00:46:53 UTC (rev 69380)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs  
2006-12-12 00:57:16 UTC (rev 69381)
@@ -78,6 +78,7 @@
                internal static Graphics bmp_g = Graphics.FromImage (bmp);
                internal XEventQueue    queue;
                internal bool           no_activate;    // For Win32, popup 
windows will not steal focus
+               internal WindowExStyles initial_ex_style;
                #endregion      // Local Variables
 
                // locks for some operations (used in XplatUIX11.cs)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-12-12 00:46:53 UTC (rev 69380)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-12-12 00:57:16 UTC (rev 69381)
@@ -702,6 +702,49 @@
                        XSendEvent(DisplayHandle, window, false, new IntPtr 
((int)EventMask.NoEventMask), ref xev);
                }
 
+               // For WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN, 
WM_XBUTTONDOWN
+               //     WM_CREATE and WM_DESTROY causes
+               void SendParentNotify(IntPtr child, Msg cause, int x, int y)
+               {       
+                       Hwnd hwnd;
+                       
+                       if (child == IntPtr.Zero) {
+                               //Console.WriteLine ("Child is zero");
+                               return;
+                       }
+                       
+                       hwnd = Hwnd.GetObjectFromWindow (child);
+                       
+                       if (hwnd == null) {
+                               return;
+                       }
+                       
+                       if (hwnd.Handle == IntPtr.Zero) {
+                               //Console.WriteLine ("Child's Handle is zero");
+                               return;
+                       }
+                       
+                       if (ExStyleSet ((int) hwnd.initial_ex_style, 
WindowExStyles.WS_EX_NOPARENTNOTIFY)) {
+                               return;
+                       }
+                       
+                       if (hwnd.Parent == null) {
+                               return;
+                       }
+                       
+                       if (hwnd.Parent.Handle == IntPtr.Zero) {
+                               return;
+                       }
+
+                       if (cause == Msg.WM_CREATE || cause == Msg.WM_DESTROY) {
+                               SendMessage(hwnd.Parent.Handle, 
Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), child);
+                       } else {
+                               SendMessage(hwnd.Parent.Handle, 
Msg.WM_PARENTNOTIFY, Control.MakeParam((int)cause, 0), Control.MakeParam(x, y));
+                       }
+                       
+                       SendParentNotify (hwnd.Parent.Handle, cause, x, y);
+               }
+               
                bool StyleSet (int s, WindowStyles ws)
                {
                        return (s & (int)ws) == (int)ws;
@@ -2292,6 +2335,7 @@
                        hwnd.width = Width;
                        hwnd.height = Height;
                        hwnd.parent = Hwnd.ObjectFromHandle(cp.Parent);
+                       hwnd.initial_ex_style = (WindowExStyles) cp.ExStyle;
 
                        if (StyleSet (cp.Style, WindowStyles.WS_DISABLED)) {
                                hwnd.enabled = false;
@@ -2386,6 +2430,8 @@
 
                        // Set caption/window title
                        Text(hwnd.Handle, cp.Caption);
+                       
+                       SendParentNotify (hwnd.Handle, Msg.WM_CREATE, 
int.MaxValue, int.MaxValue);
 
                        return hwnd.Handle;
                }
@@ -2800,6 +2846,8 @@
                                Console.WriteLine("Destroying window {0}", 
XplatUI.Window(hwnd.client_window));
                        #endif
 
+                       SendParentNotify (hwnd.Handle, Msg.WM_DESTROY, 
int.MaxValue, int.MaxValue);
+                               
                        CleanupCachedWindows (hwnd);
 
                        ArrayList windows = new ArrayList ();
@@ -3231,7 +3279,10 @@
                                                ClickPending.lParam = 
msg.lParam;
                                                ClickPending.Time = 
(long)xevent.ButtonEvent.time;
                                        }
-
+                                       
+                                       if (msg.message == Msg.WM_LBUTTONDOWN 
|| msg.message == Msg.WM_MBUTTONDOWN || msg.message == Msg.WM_RBUTTONDOWN)
+                                               SendParentNotify(msg.hwnd, 
msg.message, mouse_position.X, mouse_position.Y);
+                                       
                                        break;
                                }
 

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

Reply via email to