Author: andreia
Date: 2007-12-05 23:33:17 -0500 (Wed, 05 Dec 2007)
New Revision: 90793

Modified:
   
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
Log:
[Backport to 1.2.6]
* Control.cs: When updating the zorder, ignore windows that are not
mapped. Fixes #342509

2007-12-05  Andreia Gaita <[EMAIL PROTECTED]>

Modified: 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
  2007-12-06 03:39:38 UTC (rev 90792)
+++ 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
  2007-12-06 04:33:17 UTC (rev 90793)
@@ -1,3 +1,8 @@
+2007-12-05  Andreia Gaita <[EMAIL PROTECTED]>
+       [Backport to 1.2.6]
+       * Control.cs: When updating the zorder, ignore windows that are not
+       mapped. Fixes #342509
+
 2007-12-04  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
        [Backport to 1.2.6]
        * XplatUIX11.cs: Make toolwindows' decorations show up without causing 
any

Modified: 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
 2007-12-06 03:39:38 UTC (rev 90792)
+++ 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
 2007-12-06 04:33:17 UTC (rev 90793)
@@ -4891,15 +4891,21 @@
                private void UpdateZOrderOfChild(Control child) {
                        if (IsHandleCreated && child.IsHandleCreated && 
(child.parent == this)) {
                                // Need to take into account all controls
-                               int     index;
                                Control [] all_controls = 
child_controls.GetAllControls ();
-                               index = Array.IndexOf (all_controls, child);
 
-                               if (index > 0) {
+                               int index = Array.IndexOf (all_controls, child);
+                               
+                               for (; index > 0; index--) {
+                                       if (!all_controls [index - 
1].IsHandleCreated || !all_controls [index - 1].VisibleInternal)
+                                               continue;
+                                       break;
+                               }
+                               
+                               if (index > 0)  {
                                        XplatUI.SetZOrder(child.Handle, 
all_controls [index - 1].Handle, false, false);
                                } else {
                                        IntPtr after = AfterTopMostControl ();
-                                       if (after != IntPtr.Zero /*&& 
child.Handle != after*/)
+                                       if (after != IntPtr.Zero && after != 
child.Handle)
                                                XplatUI.SetZOrder 
(child.Handle, after, false, false);
                                        else
                                                XplatUI.SetZOrder 
(child.Handle, IntPtr.Zero, true, false);

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

Reply via email to