dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Windows.Forms/Form.c...


From: Heiko Weiss
Subject: [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Windows.Forms/Form.c...
Date: Tue, 21 Mar 2006 10:40:02 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Branch:         
Changes by:     Heiko Weiss <address@hidden>    06/03/21 10:40:01

Modified files:
        .              : ChangeLog 
        System.Windows.Forms: Form.cs Control.cs 
        System.Drawing.Xsharp: DrawingWindow.cs 

Log message:
        Form.cs: CloseRequest, do nothing if Form was desposed
        Control.cs: changed handling of setting Parent to null, or reparent the 
control.
        DrawingWindow.cs: fixed Dispose.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2372&tr2=1.2373&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs.diff?tr1=1.113&tr2=1.114&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Drawing.Xsharp/DrawingWindow.cs.diff?tr1=1.30&tr2=1.31&r1=text&r2=text

Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2372 pnetlib/ChangeLog:1.2373
--- pnetlib/ChangeLog:1.2372    Mon Mar 20 13:19:38 2006
+++ pnetlib/ChangeLog   Tue Mar 21 10:40:01 2006
@@ -1,3 +1,10 @@
+2006-03-21  Heiko Weiss  <address@hidden>
+
+       * System.Windows.Forms/Form.cs: CloseRequest, do nothing if Form was 
desposed
+       * System.Windows.Forms/Control.cs: changed handling of setting Parent 
to null, or reparent the control.
+       * System.Drawing.Xsharp/DrawingWindow.cs: fixed Dispose.
+
+
 2006-03-20  Heiko Weiss  <address@hidden>
 
        * System.Windows.Form/Control.cs : fixed Dispose, Controls.Remove(), 
DestroyHandle
Index: pnetlib/System.Drawing.Xsharp/DrawingWindow.cs
diff -u pnetlib/System.Drawing.Xsharp/DrawingWindow.cs:1.30 
pnetlib/System.Drawing.Xsharp/DrawingWindow.cs:1.31
--- pnetlib/System.Drawing.Xsharp/DrawingWindow.cs:1.30 Wed Oct 12 00:55:06 2005
+++ pnetlib/System.Drawing.Xsharp/DrawingWindow.cs      Tue Mar 21 10:40:01 2006
@@ -125,6 +125,12 @@
        void IToolkitWindow.Destroy()
                        {
                                Destroy();
+                               /*
+                                * if the window is destroyed, set toolkit and 
sink to zero.
+                                * otherwise, we couold get events like 
LostFocus...
+                               */
+                               toolkit = null;
+                               sink    = null;
                        }
 
        // Move or resize this window.
Index: pnetlib/System.Windows.Forms/Control.cs
diff -u pnetlib/System.Windows.Forms/Control.cs:1.113 
pnetlib/System.Windows.Forms/Control.cs:1.114
--- pnetlib/System.Windows.Forms/Control.cs:1.113       Mon Mar 20 13:19:39 2006
+++ pnetlib/System.Windows.Forms/Control.cs     Tue Mar 21 10:40:01 2006
@@ -132,14 +132,14 @@
        internal class InvokeAsyncResult: IAsyncResult
        {
                private bool bComplete;
-               private ManualResetEvent waitHandle;    // brubbel: waitHandle 
must not be a Mutex, you cannot wait for Mutexes
+               private ManualResetEvent waitHandle;
                public Object retObject;
                public Object asyncStateObject; // The AsyncState object
 
                public InvokeAsyncResult()
                {
                        bComplete = false;                      // This event 
hasn't completed
-                       waitHandle = new ManualResetEvent(false);       // 
brubbel: create an event
+                       waitHandle = new ManualResetEvent(false);
                }
 
                public void WaitToComplete()
@@ -213,11 +213,7 @@
        {
                public Delegate method;
                public Object[] args;
-#if BRUBBEL
-               public WeakReference wr;        // to the InvokeAsyncResult
-#else
                public InvokeAsyncResult wr;
-#endif
        }
 
        // Constructors.
@@ -339,11 +335,8 @@
                Delegate dg = iParm.method;
                Object ro = dg.DynamicInvoke(iParm.args);
 
-#if BRUBBEL
-               InvokeAsyncResult ar = (InvokeAsyncResult)iParm.wr.Target;
-#else
                InvokeAsyncResult ar = iParm.wr;
-#endif
+               
                if( ar != null )
                {
                        ar.retObject = ro;
@@ -367,11 +360,7 @@
 
                                iParm.method = method;
                                iParm.args   = args;
-#if BRUBBEL
-                               iParm.wr = new WeakReference(ar);
-#else
                                iParm.wr = ar;
-#endif
 
                                if(toolkitWindow == null)
                                {
@@ -1448,7 +1437,11 @@
                                                                                
parent.children[posn + 1];
                                                                        posn++;
                                                                }
-                                                               
parent.children[posn] = null; // Brubbel: Don't forget to set to null !!!
+                                                               /* 
+                                                               Don't forget to 
set to null, 
+                                                               Or a reference 
of the would be kept !!!
+                                                               */
+                                                               
parent.children[posn] = null; 
                                                                break;
                                                        }
                                                        posn++;
@@ -2011,20 +2004,7 @@
                                                ("control", 
S._("SWF_ControlDisposed"));
                                }
 
-                               #if false // brubbel, does this break anything ?
-                               // Find the highest ancestor that isn't created
-                               // and start building the control tree from 
there.
-                               Control control = this;
-                               while(control.parent != null &&
-                                       control.parent.toolkitWindow == null)
-                               {
-                                       control = control.parent;
-                               }
-                               control.CreateControlInner();
-                               #else
                                this.CreateControlInner();
-                               #endif
-                               
 
                                // If one of the parents of this control is not 
visible then the control
                                // will not be created. We must ensure that the 
control is created, even if
@@ -2216,7 +2196,7 @@
                                        toolkitWindow = null;
                                }
                                
-                               // Brubbel
+                               // Dispose DoubleBuffer too here
                                if( buffer != null ) {
                                        buffer.Dispose();
                                        buffer = null;
@@ -2278,11 +2258,12 @@
                                                {
                                                        DestroyHandle();
                                                
-                                                       // Brubbel start
+                                                       // Remove this control 
from Parent
                                                        if( null != this.parent 
) {
                                                                
this.parent.Controls.Remove(this);
                                                        }
                                                        
+                                                       // Dispose all childs
                                                        if( null != 
controlCollection ) {
                                                                Control o;
                                                                for( int i = 0; 
i < controlCollection.Count; i++ ) {
@@ -2293,7 +2274,6 @@
                                                                }
                                                                
controlCollection = null;
                                                        }
-                                                       // brubbel end
                                                }
                                                finally
                                                {
@@ -5535,11 +5515,18 @@
 
                                if(newParent == null)
                                {
-                                       /* Brubbel Start */
+                                       /* 
+                                        * Don't reparent the window to null, 
because the window would be 
+                                        * reparent to a placeholder window.
+                                        * Then a reference would be still 
kept, and the control never gets disposed.
+                                        * So Destroy the handle. If the 
control is reused, the handle gets 
+                                        * created again.
+                                        */
+                                       /*
                                        toolkitWindow.Reparent(null, left + 
ToolkitDrawOrigin.X,
                                                top + ToolkitDrawOrigin.Y);
-                                       /* Brubbel should*/
-                                       //DestroyHandle();
+                                       */
+                                       DestroyHandle();
                                }
                                else if(newParent.toolkitWindow != null)
                                {
@@ -5765,21 +5752,6 @@
                                                                
value.CreateControl();
                                                                
owner.PerformLayout(value, "Parent");
                                                        }
-
-                                                       // If it's supposed to 
be visible then fire the
-                                                       // OnVisibleChanged 
event.
-                                                       
-                                                       /* Brubbel : this is 
not needed
-                                                       if (value.visible)
-                                                       {
-                                                               
value.OnVisibleChanged(EventArgs.Empty);
-                                                       }
-                                                       */
-                                                       
-                                                       // Notify the owner 
that the control was added.
-                                                       // no, do not notify, 
because the statement value.Parent = owner does the notify for us.
-                                                       /* owner.OnControlAdded
-                                                               (new 
ControlEventArgs(value)); */
                                                }
                                        }
                                }
@@ -5821,25 +5793,19 @@
                                {
                                        if(value != null && value.Parent == 
owner)
                                        {
-                                               //bool wasVisible = 
value.Visible;
-
                                                // Update the parent.
                                                value.Parent = null;
 
                                                // Perform layout on the owner.
                                                owner.PerformLayout(value, 
"Parent");
 
-                                               // If it was visible, it now 
isn't and thus the
-                                               // visibility changed.
-                                               /* Brubbel : this is not needed
-                                               if (wasVisible)
-                                                       value.OnVisibleChanged 
(EventArgs.Empty);
-                                                       */
-
                                                // Notify the owner that the 
control has been removed.
                                                owner.OnControlRemoved(new 
ControlEventArgs(value));
                                                
-                                               // Brubbel new
+                                               /* 
+                                                * Get the ContainerControl and 
notify that the control was removed.
+                                                * the ContainerControl should 
activate the next control
+                                               */
                                                ContainerControl container = 
this.owner.GetContainerControl() as ContainerControl;
                                                if( null != container ) {
                                                        
container.AfterControlRemoved(value);
Index: pnetlib/System.Windows.Forms/Form.cs
diff -u pnetlib/System.Windows.Forms/Form.cs:1.49 
pnetlib/System.Windows.Forms/Form.cs:1.50
--- pnetlib/System.Windows.Forms/Form.cs:1.49   Tue Mar 14 18:43:29 2006
+++ pnetlib/System.Windows.Forms/Form.cs        Tue Mar 21 10:40:01 2006
@@ -597,7 +597,7 @@
                                }
                                set
                                {
-                                       // Brubbel recreate toolkitwindow, if 
exists
+                                       // recreate toolkitwindow, if exists
                                        if( value != topLevel ) {
                                                topLevel = value;
                                                if( null != toolkitWindow ) {
@@ -1619,6 +1619,8 @@
        // Close request received from "Control.ToolkitClose".
        internal override void CloseRequest()
                        {
+                               if( IsDisposed ) return;        // irgnore 
CloseRequest, if form was destroyed
+                               
                                CancelEventArgs args = new CancelEventArgs();
                                OnClosing(args);
                                if(!(args.Cancel))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]