Author: toshok
Date: 2006-09-26 17:58:25 -0400 (Tue, 26 Sep 2006)
New Revision: 65940

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/XplatUIWin32.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2006-09-26  Chris Toshok  <[EMAIL PROTECTED]>

        * XplatUIWin32.cs (SetParent): if parent == IntPtr.Zero (and the
        control isn't a Form), call Win32ShowWindow to hide the window,
        but don't update the control Visible property.  When we reparent
        back to a parent control, call SetVisible in order for the
        window's visibility to be reinstated.

        * XplatUIX11.cs (SetParent): if hwnd.parent == null, reparent to
        the FosterParent.

        * Control.cs (ControlCollection.Remove): remove that value.Hide()
        call for good, since it breaks MonoCalendar (and other things I'm
        sure.) Also, set all_controls to null *after* the owner calls,
        which end up regenerating it.
        (ChangeParent): allow new_parent to be == null, passing
        IntPtr.Zero down to XplatUI.

        this fixes #79294 the right way.




Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-26 21:32:13 UTC (rev 65939)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-26 21:58:25 UTC (rev 65940)
@@ -1,3 +1,23 @@
+2006-09-26  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * XplatUIWin32.cs (SetParent): if parent == IntPtr.Zero (and the
+       control isn't a Form), call Win32ShowWindow to hide the window,
+       but don't update the control Visible property.  When we reparent
+       back to a parent control, call SetVisible in order for the
+       window's visibility to be reinstated.
+
+       * XplatUIX11.cs (SetParent): if hwnd.parent == null, reparent to
+       the FosterParent.
+
+       * Control.cs (ControlCollection.Remove): remove that value.Hide()
+       call for good, since it breaks MonoCalendar (and other things I'm
+       sure.) Also, set all_controls to null *after* the owner calls,
+       which end up regenerating it.
+       (ChangeParent): allow new_parent to be == null, passing
+       IntPtr.Zero down to XplatUI.
+
+       this fixes #79294 the right way.
+
 2006-09-26  Mike Kestner  <[EMAIL PROTECTED]>
 
        * GridEntry.cs : internal SetParent method.
@@ -12,7 +32,7 @@
        * Control.cs (ChildNeedsRecreating): this should return true if
        either we're being recreated and the child is in our list, or our
        parent is waiting for our recreation.
-       
+
 2006-09-26  Chris Toshok  <[EMAIL PROTECTED]>
 
        * Control.cs (ControlCollection.Remove): reinstate the

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-09-26 21:32:13 UTC (rev 65939)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-09-26 21:58:25 UTC (rev 65940)
@@ -517,14 +517,13 @@
                        }
 
                        public virtual void Remove(Control value) {
-                               all_controls = null;
-
                                owner.PerformLayout(value, "Parent");
                                owner.OnControlRemoved(new 
ControlEventArgs(value));
+
+                               all_controls = null;
                                list.Remove(value);
 
                                value.ChangeParent(null);
-                               value.Hide ();
 
                                owner.UpdateChildrenZOrder();
                        }
@@ -1345,9 +1344,9 @@
 
                        parent = new_parent;
 
-                       if (IsHandleCreated && (new_parent != null) && 
new_parent.IsHandleCreated) {
-                               XplatUI.SetParent(Handle, new_parent.Handle);
-                       }
+                       if (IsHandleCreated)
+                               XplatUI.SetParent(Handle,
+                                                 (new_parent == null || 
!new_parent.IsHandleCreated) ? IntPtr.Zero : new_parent.Handle);
 
                        OnParentChanged(EventArgs.Empty);
 
@@ -2229,6 +2228,7 @@
                                if (parent!=value) {
                                        if (value==null) {
                                                parent.Controls.Remove(this);
+                                               parent = null;
                                                return;
                                        }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-09-26 21:32:13 UTC (rev 65939)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-09-26 21:58:25 UTC (rev 65940)
@@ -1566,6 +1566,15 @@
                }
 
                internal override IntPtr SetParent(IntPtr handle, IntPtr 
parent) {
+                       Control c = Control.FromHandle (handle);
+                       if (parent == IntPtr.Zero) {
+                               if (!(c is Form)) {
+                                       Win32ShowWindow(handle, 
WindowPlacementFlags.SW_HIDE);
+                               }
+                       }
+                       else
+                               SetVisible (handle, c.Visible);
+                               
                        return Win32SetParent(handle, parent);
                }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-26 21:32:13 UTC (rev 65939)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-26 21:58:25 UTC (rev 65940)
@@ -4376,7 +4376,7 @@
                                #if DriverDebug || DriverDebugParent
                                        Console.WriteLine("Parent for window 
{0} = {1}", XplatUI.Window(hwnd.Handle), XplatUI.Window(hwnd.parent != null ? 
hwnd.parent.Handle : IntPtr.Zero));
                                #endif
-                               XReparentWindow(DisplayHandle, 
hwnd.whole_window, hwnd.parent.client_window, hwnd.x, hwnd.y);
+                               XReparentWindow(DisplayHandle, 
hwnd.whole_window, hwnd.parent == null ? FosterParent : 
hwnd.parent.client_window, hwnd.x, hwnd.y);
                        }
 
                        return IntPtr.Zero;

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

Reply via email to