Author: toshok
Date: 2007-02-21 00:04:35 -0500 (Wed, 21 Feb 2007)
New Revision: 73231

Modified:
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Application.cs
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Form.cs
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
   
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
        * ListBox.cs (.ctor): move the Control.AddImplicits here instead
        of OnHandleCreated.
        (HorizontalScrollEvent): only call XplatUI.ScrollWindow if the
        handle is created.  otherwise we'll create it here.
        (VerticalScrollEvent): same here.

        * Application.cs (CloseForms): call Form.Dispose, don't post
        WM_CLOSE_INTERNAL.

        * Form.cs (WndProc): we don't need to use CLOSE_INTERNAL
        here. Application should Dispose() of the Form's.

        * XplatUIX11.cs (WaitForHwndMessage): break out of the loop on
        WM_DESTROY as well.
        (MapWindow,UnmapWindow): only actually do the waiting for
        SHOWWINDOW if the control we're dealing with is a Form.
        (CreateWindow): if the control isn't a form, SendMessage
        WM_SHOWWINDOW here (if the WS_VISIBLE style is set).

        * Control.cs (SetVisibleCore): always use is_visible here, not
        value.  If we use value, we can end up re-setting something
        visible if, for instance, you do Control.Hide() in a delegate
        attached to VisibleChanged as we do in FormTest.ShowDialogTest.

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



Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Application.cs
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Application.cs
        2007-02-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Application.cs
        2007-02-21 05:04:35 UTC (rev 73231)
@@ -176,12 +176,10 @@
                                        f = (Form)control.Current;
                                        
                                        if (all || (thread == 
f.creator_thread)) {
-                                               if (f.IsHandleCreated) {
-                                                       
XplatUI.PostMessage(f.Handle, Msg.WM_CLOSE_INTERNAL, IntPtr.Zero, IntPtr.Zero);
-                                               }
                                                #if DebugRunLoop
                                                        Console.WriteLine("     
 Closing form {0}", f);
                                                #endif
+                                               f.Dispose ();
                                        }
                                }
                        }

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-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 
    2007-02-21 05:04:35 UTC (rev 73231)
@@ -1,5 +1,31 @@
 2007-02-20  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * ListBox.cs (.ctor): move the Control.AddImplicits here instead
+       of OnHandleCreated.
+       (HorizontalScrollEvent): only call XplatUI.ScrollWindow if the
+       handle is created.  otherwise we'll create it here.
+       (VerticalScrollEvent): same here.
+
+       * Application.cs (CloseForms): call Form.Dispose, don't post
+       WM_CLOSE_INTERNAL.
+
+       * Form.cs (WndProc): we don't need to use CLOSE_INTERNAL
+       here. Application should Dispose() of the Form's.
+
+       * XplatUIX11.cs (WaitForHwndMessage): break out of the loop on
+       WM_DESTROY as well.
+       (MapWindow,UnmapWindow): only actually do the waiting for
+       SHOWWINDOW if the control we're dealing with is a Form.
+       (CreateWindow): if the control isn't a form, SendMessage
+       WM_SHOWWINDOW here (if the WS_VISIBLE style is set).
+
+       * Control.cs (SetVisibleCore): always use is_visible here, not
+       value.  If we use value, we can end up re-setting something
+       visible if, for instance, you do Control.Hide() in a delegate
+       attached to VisibleChanged as we do in FormTest.ShowDialogTest.
+
+2007-02-20  Chris Toshok  <[EMAIL PROTECTED]>
+
        * XplatUIX11.cs (WaitForHwndMessage): we need to loop until we get
        the message we need.  PeekMessage returning false should not be a
        condition under which we exit the loop.

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-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Control.cs
    2007-02-21 05:04:35 UTC (rev 73231)
@@ -4206,12 +4206,12 @@
                        if (value != is_visible) {
                                is_visible = value;
                                
-                               if (value && ((window.Handle == IntPtr.Zero) || 
!is_created)) {
+                               if (is_visible && ((window.Handle == 
IntPtr.Zero) || !is_created)) {
                                        CreateControl();
                                }
 
                                if (IsHandleCreated) {
-                                       XplatUI.SetVisible(Handle, value, true);
+                                       XplatUI.SetVisible(Handle, is_visible, 
true);
                                        // Explicitly move Toplevel windows to 
where we want them;
                                        // apparently moving unmapped toplevel 
windows doesn't work
                                        if (is_visible && (this is Form)) {

Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Form.cs   
    2007-02-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/Form.cs   
    2007-02-21 05:04:35 UTC (rev 73231)
@@ -2009,11 +2009,6 @@
                                        return;
                                }
 
-                               case Msg.WM_CLOSE_INTERNAL: {
-                                       DestroyHandle();
-                                       break;
-                               }
-
                                case Msg.WM_CLOSE: {
                                        Form act = Form.ActiveForm;
                                        if (act != null && act != this && 
act.Modal == true) {

Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
    2007-02-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
    2007-02-21 05:04:35 UTC (rev 73231)
@@ -120,6 +120,9 @@
                        hscrollbar.Visible = false;
                        hscrollbar.ValueChanged += new EventHandler 
(HorizontalScrollEvent);
 
+                       Controls.AddImplicit (vscrollbar);
+                       Controls.AddImplicit (hscrollbar);
+
                        /* Events */
                        MouseDown += new MouseEventHandler (OnMouseDownLB);
                        MouseMove += new MouseEventHandler (OnMouseMoveLB);
@@ -854,12 +857,6 @@
                protected override void OnHandleCreated (EventArgs e)
                {
                        base.OnHandleCreated (e);
-
-                       SuspendLayout ();
-                       Controls.AddImplicit (vscrollbar);
-                       Controls.AddImplicit (hscrollbar);
-                       ResumeLayout ();
-                       LayoutListBox ();
                }
 
                protected override void OnHandleDestroyed (EventArgs e)
@@ -1145,7 +1142,8 @@
                                if (hbar_offset < 0)
                                        hbar_offset = 0;
 
-                               XplatUI.ScrollWindow (Handle, items_area, 
old_offset - hbar_offset, 0, false);
+                               if (IsHandleCreated)
+                                       XplatUI.ScrollWindow (Handle, 
items_area, old_offset - hbar_offset, 0, false);
                        }
                }
 
@@ -1215,7 +1213,8 @@
                                else
                                        vscrollbar.Value = top_index;
                                Scroll (vscrollbar, vscrollbar.Value - 
top_index);
-                               XplatUI.ScrollWindow (Handle, items_area, 0, 
ItemHeight * (val - vscrollbar.Value), false);
+                               if (IsHandleCreated)
+                                       XplatUI.ScrollWindow (Handle, 
items_area, 0, ItemHeight * (val - vscrollbar.Value), false);
                        }
                }
                
@@ -1927,7 +1926,8 @@
 
                        int diff = top_item - top_index;
 
-                       XplatUI.ScrollWindow (Handle, items_area, 0, ItemHeight 
* diff, false);
+                       if (IsHandleCreated)
+                               XplatUI.ScrollWindow (Handle, items_area, 0, 
ItemHeight * diff, false);
                }
 
                #endregion Private Methods

Modified: 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
 2007-02-21 02:34:10 UTC (rev 73230)
+++ 
branches/mwf-handle-branch/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
 2007-02-21 05:04:35 UTC (rev 73231)
@@ -1280,8 +1280,7 @@
                                        break;
 
                                if (PeekMessage(queue, ref msg, IntPtr.Zero, 0, 
0, (uint)PeekMessageFlags.PM_REMOVE)) {
-                                       Console.WriteLine ("got message {0}", 
(Msg)msg.message);
-                                       done = (msg.hwnd == hwnd.Handle) && 
(Msg)msg.message == message;
+                                       done = (msg.hwnd == hwnd.Handle) && 
((Msg)msg.message == message || (Msg)msg.message == Msg.WM_DESTROY);
                                        TranslateMessage (ref msg);
                                        DispatchMessage (ref msg);
                                }
@@ -1300,7 +1299,8 @@
                                if ((windows & WindowType.Client) != 0) {
                                        XMapWindow(DisplayHandle, 
hwnd.client_window);
 
-                                       WaitForHwndMessage (hwnd, 
Msg.WM_SHOWWINDOW);
+                                       if (Control.FromHandle(hwnd.Handle) is 
Form)
+                                               WaitForHwndMessage (hwnd, 
Msg.WM_SHOWWINDOW);
                                }
                        }
                }
@@ -1314,7 +1314,8 @@
                                if ((windows & WindowType.Client) != 0) {
                                        XUnmapWindow(DisplayHandle, 
hwnd.client_window);
 
-                                       WaitForHwndMessage (hwnd, 
Msg.WM_SHOWWINDOW);
+                                       if (Control.FromHandle(hwnd.Handle) is 
Form)
+                                               WaitForHwndMessage (hwnd, 
Msg.WM_SHOWWINDOW);
                                }
                        }
                }
@@ -2478,8 +2479,10 @@
                        SendParentNotify (hwnd.Handle, Msg.WM_CREATE, 
int.MaxValue, int.MaxValue);
 
                        if (StyleSet (cp.Style, WindowStyles.WS_VISIBLE)) {
+                               hwnd.visible = true;
                                MapWindow(hwnd, WindowType.Both);
-                               hwnd.visible = true;
+                               if (!(Control.FromHandle(hwnd.Handle) is Form))
+                                       SendMessage(hwnd.Handle, 
Msg.WM_SHOWWINDOW, (IntPtr)1, IntPtr.Zero);
                        }
 
                        return hwnd.Handle;

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

Reply via email to