Author: rolf
Date: 2007-01-17 14:15:13 -0500 (Wed, 17 Jan 2007)
New Revision: 71225

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * XplatUIX11.cs: Caption height for MDI children is 19, not 26.
        * XplatUIWin32.cs: We need to recalculate NC size after changing 
        window style to toolwindow (otherwise the client rectangle will be
        3 pixels to small for some reason).
        * MdiWindowManager.cs: Revert NC size calculations to match how
        they are calculated only based on window styles (to match
        Win32AdjustWindowRectEx, since otherwise when setting size or 
        location, Control will call Win32AdjustWindowRectEx to update client 
        size, which would provoke a paint, then we'd get a NCCALCSIZE and 
        calculate a different value of client size causing another paint 
        (and flickering))
        * InternalWindowManager.cs: When moving or resizing a window only
        update size or location if they actually changed.
        * ThemeWin32Classic.cs: ManagedWindowsBorderWidth is now 4 instead of 3
        (seems to match Windows behaviour better). Cleaned up 
        ManagedWindowDecorations to draw what's needed and nothing else
        (was drawing borders and lines where they shouldn't be)
        * Hwnd.cs: GetWindowRectangle now knows about MDI border sizes
        (style = 0xFFFF) and takes into account caption height when 
        calculating window rectangle.   



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-17 19:08:31 UTC (rev 71224)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-17 19:15:13 UTC (rev 71225)
@@ -1,3 +1,26 @@
+2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * XplatUIX11.cs: Caption height for MDI children is 19, not 26.
+       * XplatUIWin32.cs: We need to recalculate NC size after changing 
+       window style to toolwindow (otherwise the client rectangle will be
+       3 pixels to small for some reason).
+       * MdiWindowManager.cs: Revert NC size calculations to match how
+       they are calculated only based on window styles (to match
+       Win32AdjustWindowRectEx, since otherwise when setting size or 
+       location, Control will call Win32AdjustWindowRectEx to update client 
+       size, which would provoke a paint, then we'd get a NCCALCSIZE and 
+       calculate a different value of client size causing another paint 
+       (and flickering))
+       * InternalWindowManager.cs: When moving or resizing a window only
+       update size or location if they actually changed.
+       * ThemeWin32Classic.cs: ManagedWindowsBorderWidth is now 4 instead of 3
+       (seems to match Windows behaviour better). Cleaned up 
+       ManagedWindowDecorations to draw what's needed and nothing else
+       (was drawing borders and lines where they shouldn't be)
+       * Hwnd.cs: GetWindowRectangle now knows about MDI border sizes
+       (style = 0xFFFF) and takes into account caption height when 
+       calculating window rectangle.   
+
 2007-01-16  Everaldo Canuto  <[EMAIL PROTECTED]>
 
        * ToolBar.cs: Internal ToolBarButtonInfo class added, Because same 
button 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs  
2007-01-17 19:08:31 UTC (rev 71224)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs  
2007-01-17 19:15:13 UTC (rev 71225)
@@ -197,6 +197,8 @@
                                border_size = ThemeEngine.Current.BorderSize;
                        else if (border_style == FormBorderStyle.Fixed3D)
                                border_size = ThemeEngine.Current.Border3DSize;
+                       else if (border_style == (FormBorderStyle) 0xFFFF)
+                               border_size = new Size(4, 4);
                        
                        if (border_size.Width != 0) {
                                rect.X -= border_size.Width;
@@ -207,6 +209,9 @@
                                rect.Y -= border_size.Height;
                                rect.Height += border_size.Height * 2;
                        }
+                       
+                       rect.Y -= caption_height;
+                       rect.Height += caption_height;
 
                        return rect;
                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
 2007-01-17 19:08:31 UTC (rev 71224)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
 2007-01-17 19:15:13 UTC (rev 71225)
@@ -775,7 +775,10 @@
                        ClearVirtualPosition ();
 
                        form.Capture = false;
-                       form.Bounds = virtual_position;
+                       if (state == State.Moving && form.Location != 
virtual_position.Location) 
+                               form.Location = virtual_position.Location;
+                       else if (state == State.Sizing && form.Bounds != 
virtual_position)
+                               form.Bounds = virtual_position;
                        state = State.Idle;
 
                        OnWindowFinishedMoving ();

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs  
    2007-01-17 19:08:31 UTC (rev 71224)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs  
    2007-01-17 19:15:13 UTC (rev 71225)
@@ -585,15 +585,15 @@
                                                typeof 
(XplatUIWin32.NCCALCSIZE_PARAMS));
 
                                int bw = 
ThemeEngine.Current.ManagedWindowBorderWidth (this);
-                               if (!IsMaximized)
-                                       bw++;
+                               //if (!IsMaximized)
+                               //        bw++;
 
                                if (HasBorders) {
                                        ncp.rgrc1.top += TitleBarHeight + bw;
                                        if (!IsMaximized) {
                                                //ncp.rgrc1.top -= 1;
-                                               ncp.rgrc1.left += bw - 2;
-                                               ncp.rgrc1.bottom -= bw - 2;
+                                               ncp.rgrc1.left += bw;// - 2;
+                                               ncp.rgrc1.bottom -= bw;// - 2;
                                                ncp.rgrc1.right -= bw;
                                        } else {
                                                ncp.rgrc1.left += 1;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs 
    2007-01-17 19:08:31 UTC (rev 71224)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs 
    2007-01-17 19:15:13 UTC (rev 71225)
@@ -4773,7 +4773,7 @@
 
                public override int ManagedWindowBorderWidth 
(InternalWindowManager wm)
                {
-                       return 3;
+                       return 4;
                }
 
                public override int ManagedWindowIconWidth 
(InternalWindowManager wm)
@@ -4811,33 +4811,31 @@
                        int bdwidth = ManagedWindowBorderWidth (wm);
                        Color titlebar_color = Color.FromArgb (255, 10, 36, 
106);
                        Color titlebar_color2 = Color.FromArgb (255, 166, 202, 
240);
+                       Color color = ThemeEngine.Current.ColorControlDark;
+                       Color color2 = Color.FromArgb (255, 192, 192, 192);
 
+#if debug
+                               dc.FillRectangle (Brushes.Black, clip);
+#endif
+                       
                        if (wm.HasBorders) {
-                               Pen pen = new Pen(ColorControl, 1);
+                               Pen pen = ResPool.GetPen (ColorControl);
                                Rectangle borders = new Rectangle (0, 0, 
form.Width, form.Height);
-                               // The 3d border is only 2 pixels wide, so we 
draw the innermost pixel ourselves
-                               dc.DrawRectangle (new Pen (ColorControl, 1), 2, 
2, form.Width - 5, form.Height - 5);
-                               ControlPaint.DrawBorder3D (dc, borders, 
Border3DStyle.Raised);
-                               
-                               if (!wm.IsMaximized) {
-                                       borders.Y += tbheight + bdwidth;
-                                       borders.X += bdwidth;
-                                       borders.Height -= tbheight + bdwidth * 
2 + 1;
-                                       borders.Width -= bdwidth * 2 + 1;
-                                       
+                               ControlPaint.DrawBorder3D (dc, borders, 
Border3DStyle.Raised);
+                               // The 3d border is only 2 pixels wide, so we 
draw the innermost pixels ourselves
+                               borders = new Rectangle (2, 2, form.Width - 5, 
form.Height - 5);
+                               for (int i = 2; i < bdwidth; i++) {
                                        dc.DrawRectangle (pen, borders);
-                               }
+                                       borders.Inflate (-1, -1);
+                               }                               
                        }
 
-                       Color color = ThemeEngine.Current.ColorControlDark;
-                       Color color2 = Color.FromArgb (255, 192, 192, 192);
                        if (wm.IsActive () && !wm.IsMaximized) {
                                color = titlebar_color;
                                color2 = titlebar_color2;
                        }
 
-                       Rectangle tb = new Rectangle (bdwidth, bdwidth,
-                                       form.Width - (bdwidth * 2), tbheight);
+                       Rectangle tb = new Rectangle (bdwidth, bdwidth, 
form.Width - (bdwidth * 2), tbheight - 1);
 
                        // HACK: For now always draw the titlebar until we get 
updates better
                        // Rectangle vis = Rectangle.Intersect (tb, 
pe.ClipRectangle);  
@@ -4849,9 +4847,10 @@
                                }       
                        }
                        
-                       dc.DrawLine (new Pen (SystemColors.ControlLight, 1), 
bdwidth,
-                                       tbheight + bdwidth, form.Width - 
(bdwidth * 2),
-                                       tbheight + bdwidth);
+                       // Draw the line just beneath the title bar
+                       dc.DrawLine (ResPool.GetPen (SystemColors.Control), 
bdwidth,
+                                       tbheight + bdwidth - 1, form.Width - 
bdwidth - 1,
+                                       tbheight + bdwidth - 1);
 
                        if (!wm.IsToolWindow) {
                                tb.X += 18; // Room for the icon and the buttons

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-01-17 19:08:31 UTC (rev 71224)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-01-17 19:15:13 UTC (rev 71225)
@@ -1254,6 +1254,9 @@
 
                        Win32SetWindowLong(handle, WindowLong.GWL_STYLE, 
(uint)cp.Style);
                        Win32SetWindowLong(handle, WindowLong.GWL_EXSTYLE, 
(uint)cp.ExStyle);
+
+                       if ((cp.ExStyle & (int) 
WindowExStyles.WS_EX_TOOLWINDOW) > 0)
+                               XplatUI.RequestNCRecalc (handle);
                }
 
                internal override double GetWindowTransparency(IntPtr handle)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2007-01-17 19:08:31 UTC (rev 71224)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2007-01-17 19:15:13 UTC (rev 71225)
@@ -774,7 +774,7 @@
                                title_style = TitleStyle.None;
 
                                if (ExStyleSet (ExStyle, 
WindowExStyles.WS_EX_MDICHILD)) {
-                                       caption_height = 26;
+                                       caption_height = 19;
 
                                        if (StyleSet (Style, 
WindowStyles.WS_CAPTION)) {
                                                if (ExStyleSet (ExStyle, 
WindowExStyles.WS_EX_TOOLWINDOW)) {

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

Reply via email to