Author: toshok
Date: 2007-02-15 14:56:42 -0500 (Thu, 15 Feb 2007)
New Revision: 72955

Modified:
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
Log:
2007-02-15  Chris Toshok  <[EMAIL PROTECTED]>

        * Control.cs (Refresh): only refresh if we've got a handle and are
        visible.
        (CreateAccessibilityInstance): CreateControl() here.
        (UpdateChildrenZOrder): complicate the code loop even more by
        taking into account controls that haven't had their handle
        created, and those that aren't visible.  But on the flip side,
        simplify the code by splitting it into two loops.  one which
        builds up the list of child controls we're interested in, and the
        other that sets the z order of those children.

        * Control.cs: Control.AccessibilityObject causes the control to be
        created, not just the handle.

2007-02-14  Chris Toshok  <[EMAIL PROTECTED]>



Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 
    2007-02-15 19:56:07 UTC (rev 72954)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 
    2007-02-15 19:56:42 UTC (rev 72955)
@@ -1,5 +1,22 @@
+2007-02-15  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * Control.cs (Refresh): only refresh if we've got a handle and are
+       visible.
+       (CreateAccessibilityInstance): CreateControl() here.
+       (UpdateChildrenZOrder): complicate the code loop even more by
+       taking into account controls that haven't had their handle
+       created, and those that aren't visible.  But on the flip side,
+       simplify the code by splitting it into two loops.  one which
+       builds up the list of child controls we're interested in, and the
+       other that sets the z order of those children.
+
 2007-02-14  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * Control.cs: Control.AccessibilityObject causes the control to be
+       created, not just the handle.
+
+2007-02-14  Chris Toshok  <[EMAIL PROTECTED]>
+
        * Control.cs: rework UpdateChildrenZOrder to correctly handle the
        problem on X where a window might have its handle created (and be
        visible) while the window is unmapped.  calling XConfigureWindow

Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
    2007-02-15 19:56:07 UTC (rev 72954)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
    2007-02-15 19:56:42 UTC (rev 72955)
@@ -3549,7 +3549,7 @@
                }
 
                public virtual void Refresh() {
-                       if (IsHandleCreated) {
+                       if (IsHandleCreated && Visible) {
                                Invalidate();
                                XplatUI.UpdateWindow(window.Handle);
 
@@ -3739,6 +3739,7 @@
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected virtual AccessibleObject 
CreateAccessibilityInstance() {
+                       CreateControl ();
                        return new Control.ControlAccessibleObject(this);
                }
 
@@ -4359,8 +4360,6 @@
                                return;
                        }
 
-                       controls = child_controls.GetAllControls ();
-
                        // XXX This code is severely broken.  It leaks
                        // the "zero_sized" abstraction out of the X11
                        // backend and into Control.cs.  It'll work on
@@ -4370,27 +4369,27 @@
                        // basically what we need to guard against is
                        // calling XplatUI.SetZOrder on an hwnd that
                        // corresponds to an unmapped X window.
-                       int i = 0;
-                       while (i < controls.Length) {
-                               Hwnd upper = Hwnd.ObjectFromHandle 
(controls[i].Handle);
-                               if (upper.zero_sized) {
-                                       i++;
+                       controls = child_controls.GetAllControls ();
+
+                       ArrayList children_to_order = new ArrayList ();
+
+                       for (int i = 0; i < controls.Length; i ++) {
+                               if (!controls[i].IsHandleCreated || 
!controls[i].VisibleInternal)
                                        continue;
-                               }
 
-                               bool found_lower = false;
-                               for (int j = i + 1; j < controls.Length; j ++) {
-                                       Hwnd lower = Hwnd.ObjectFromHandle 
(controls[j].Handle);
-                                       if (!lower.zero_sized) {
-                                               XplatUI.SetZOrder(lower.Handle, 
upper.Handle, false, false);
-                                               i = j;
-                                               found_lower = true;
-                                       }
-                               }
+                               Hwnd hwnd = Hwnd.ObjectFromHandle 
(controls[i].Handle);
+                               if (hwnd.zero_sized)
+                                       continue;
 
-                               if (!found_lower)
-                                       break;
+                               children_to_order.Add (controls[i]);
                        }
+
+                       for (int i = 1; i < children_to_order.Count; i ++) {
+                               Control upper = (Control)children_to_order[i-1];
+                               Control lower = (Control)children_to_order[i];
+
+                               XplatUI.SetZOrder(lower.Handle, upper.Handle, 
false, false);
+                       }
                }
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]

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

Reply via email to