All pastes #407170 Raw Edit

Someone

public text v1 · immutable
#407170 ·published 2007-03-22 22:49 UTC
rendered paste body
Index: System.Windows.Forms/XplatUIX11.cs
===================================================================
--- System.Windows.Forms/XplatUIX11.cs  (revision 74814)
+++ System.Windows.Forms/XplatUIX11.cs  (working copy)
@@ -1311,8 +1311,11 @@

                private void MapWindow(Hwnd hwnd, WindowType windows) {
                        if (!hwnd.mapped) {
-                               if (Control.FromHandle(hwnd.Handle) is Form)
-                                       SendMessage(hwnd.Handle, Msg.WM_SHOWWINDOW, (IntPtr)1, IntPtr.Zero);
+                               if (Control.FromHandle(hwnd.Handle) is Form) {
+                                       Form f = Control.FromHandle(hwnd.Handle) as Form;
+                                       if (f.WindowState == FormWindowState.Normal)
+                                               SendMessage(hwnd.Handle, Msg.WM_SHOWWINDOW, (IntPtr)1, IntPtr.Zero);
+                               }

                                // it's possible that our Hwnd is no
                                // longer valid after making that
@@ -1340,8 +1343,11 @@

                private void UnmapWindow(Hwnd hwnd, WindowType windows) {
                        if (hwnd.mapped) {
-                               if (Control.FromHandle(hwnd.Handle) is Form)
-                                       SendMessage(hwnd.Handle, Msg.WM_SHOWWINDOW, IntPtr.Zero, IntPtr.Zero);
+                               if (Control.FromHandle(hwnd.Handle) is Form) {
+                                       Form f = Control.FromHandle(hwnd.Handle) as Form;
+                                       if (f.WindowState == FormWindowState.Normal)
+                                               SendMessage(hwnd.Handle, Msg.WM_SHOWWINDOW, IntPtr.Zero, IntPtr.Zero);
+                               }

                                // it's possible that our Hwnd is no
                                // longer valid after making that