Author: toshok
Date: 2006-10-18 13:11:52 -0400 (Wed, 18 Oct 2006)
New Revision: 66794

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/XplatUIX11.cs
Log:
2006-10-18  Chris Toshok  <[EMAIL PROTECTED]>

        * XplatUIX11.cs: change some debug ifdefs, and return XGetParent
        to being private instead of internal static.

        * Control.cs: remove all the stupid ParentWaitingOnRecreation
        crap, it wasn't working for more deeply nested controls anyway,
        and we already have the is_recreating flag - use that instead.
        Before calling DestroyHandle in RecreateHandle, recurse through
        the control tree setting it to true.  this returns the recreate
        code to much of its original simplicity, while now guaranteeing we
        actually recreate everything we're supposed to.  This change gets
        fyireporting actually showing mdi children.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-18 16:01:54 UTC (rev 66793)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-18 17:11:52 UTC (rev 66794)
@@ -1,3 +1,17 @@
+2006-10-18  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * XplatUIX11.cs: change some debug ifdefs, and return XGetParent
+       to being private instead of internal static.
+
+       * Control.cs: remove all the stupid ParentWaitingOnRecreation
+       crap, it wasn't working for more deeply nested controls anyway,
+       and we already have the is_recreating flag - use that instead.
+       Before calling DestroyHandle in RecreateHandle, recurse through
+       the control tree setting it to true.  this returns the recreate
+       code to much of its original simplicity, while now guaranteeing we
+       actually recreate everything we're supposed to.  This change gets
+       fyireporting actually showing mdi children.
+
 2006-10-17  Chris Toshok  <[EMAIL PROTECTED]>
 
        * Form.cs: remove some debug spew, and collapse some duplicate

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-10-18 16:01:54 UTC (rev 66793)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-10-18 17:11:52 UTC (rev 66794)
@@ -74,7 +74,6 @@
                internal bool                   is_captured;            // 
tracks if the control has captured the mouse
                internal bool                   is_toplevel;            // 
tracks if the control is a toplevel window
                internal bool                   is_recreating;          // 
tracks if the handle for the control is being recreated
-               internal ArrayList              children_to_recreate;   // keep 
track of the children which need to be recreated
                internal bool                   causes_validation;      // 
tracks if validation is executed on changes
                internal int                    tab_index;              // 
position in tab order of siblings
                internal bool                   tab_stop = true;        // is 
the control a tab stop?
@@ -882,34 +881,10 @@
 
                internal bool IsRecreating {
                        get {
-                               if (is_recreating) {
-                                       return true;
-                               }
-
-                               return ParentWaitingOnRecreation(this);
+                               return is_recreating;
                        }
                }
 
-               internal bool ChildNeedsRecreating (Control child)
-               {
-                       if (children_to_recreate != null && 
children_to_recreate.Contains (child))
-                                       return true;
-                       return ParentWaitingOnRecreation (this);
-               }
-
-               internal void RemoveChildFromRecreateList (Control child)
-               {
-                       if (children_to_recreate != null)
-                               children_to_recreate.Remove (child);
-               }
-
-               private bool ParentWaitingOnRecreation (Control c) {
-                       if (parent != null) {
-                               return parent.ChildNeedsRecreating (c);
-                       }
-                       return false;
-               }
-
                internal Graphics DeviceContext {
                        get { 
                                if (dc_mem == null) {
@@ -3578,19 +3553,27 @@
                        // MS Internal
                }
 
+               private void SetIsRecreating (bool flag)
+               {
+                       is_recreating=true;
+
+                       foreach (Control c in Controls) {
+                               c.SetIsRecreating (flag);
+                       }
+               }
+
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected void RecreateHandle() {
 #if DebugRecreate
                        Console.WriteLine("Recreating control {0}", 
XplatUI.Window(window.Handle));
 #endif
-                       is_recreating=true;
 
+                       SetIsRecreating (true);
+
                        if (IsHandleCreated) {
 #if DebugRecreate
                                Console.WriteLine(" + handle is created, 
destroying it.");
 #endif
-                               children_to_recreate = new ArrayList();
-                               children_to_recreate.AddRange 
(child_controls.GetAllControls ());
                                DestroyHandle();
                                // WM_DESTROY will CreateHandle for us
                        } else {
@@ -3602,13 +3585,10 @@
                                } else {
                                        CreateHandle();
                                }
-                               if (parent != null)
-                                       parent.RemoveChildFromRecreateList 
(this);
 
                                is_recreating = false;
 #if DebugRecreate
                                Console.WriteLine (" + new handle = {0:X}", 
Handle.ToInt32());
-                               Console.WriteLine (" + new parent = {0:X}", 
XplatUIX11.XGetParent (XplatUIX11.XGetParent (Handle)).ToInt32 ());
 #endif
                        }
 
@@ -3954,19 +3934,13 @@
 #endif
                                        window.InvalidateHandle();
 
-                                       if (ParentWaitingOnRecreation (this)) {
+                                       if (is_recreating) {
 #if DebugRecreate
-                                               Console.WriteLine ("Recreating 
handle for {0:X}, as parent is waiting on us", handle);
-#endif
-                                               RecreateHandle();
-                                       } else if (is_recreating) {
-#if DebugRecreate
                                                Console.WriteLine ("Creating 
handle for {0:X}", handle.ToInt32());
 #endif
                                                CreateHandle();
 #if DebugRecreate
                                                Console.WriteLine (" + new 
handle = {0:X}", Handle.ToInt32());
-                                               Console.WriteLine (" + new 
parent = {0:X}", XplatUIX11.XGetParent (XplatUIX11.XGetParent (Handle)).ToInt32 
());
 #endif
                                                is_recreating = false;
                                        }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-10-18 16:01:54 UTC (rev 66793)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-10-18 17:11:52 UTC (rev 66794)
@@ -1581,7 +1581,7 @@
 
                        return (IntPtr)result;
                }
-               internal static IntPtr XGetParent(IntPtr handle) {
+               private IntPtr XGetParent(IntPtr handle) {
                        IntPtr  Root;
                        IntPtr  Parent;
                        IntPtr  Children;
@@ -1618,6 +1618,7 @@
 
                                        #if DriverDebug || DriverDebugDestroy
                                        Console.WriteLine (" + adding {0} to 
the list of zombie windows", XplatUI.Window (hwnd.Handle));
+                                       Console.WriteLine (" + parent X window 
is {0:X}", XGetParent (hwnd.whole_window).ToInt32());
                                        #endif
 
                                        list.Add (hwnd);
@@ -2824,7 +2825,6 @@
 
                        #if DriverDebug || DriverDebugDestroy
                                Console.WriteLine("Destroying window {0}", 
XplatUI.Window(hwnd.client_window));
-                               Console.WriteLine (Environment.StackTrace);
                        #endif
 
                        CleanupCachedWindows (hwnd);
@@ -4221,7 +4221,7 @@
                                data.Result = result;
                                
                                SendAsyncMethod (data);
-                               #if DriverDebug || DriverDebugParent
+                               #if DriverDebug || DriverDebugThreads
                                Console.WriteLine ("Sending {0} message 
across.", message);
                                #endif
 

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

Reply via email to