All pastes #255240 Raw Edit

Miscellany

public text v1 · immutable
#255240 ·published 2006-11-22 19:40 UTC
rendered paste body
Index: Control.cs
===================================================================
--- Control.cs  (revision 68351)
+++ Control.cs  (working copy)
@@ -3762,6 +3762,15 @@
                        // SetBoundsCore updates the Win32 control itself. UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
                        if (IsHandleCreated) {
                                XplatUI.SetWindowPos(Handle, x, y, width, height);
+
+                               // Win32 automatically changes negative width/height to 0.
+                               // The control has already been sent a WM_WINDOWPOSCHANGED message and it has the correct
+                               // data, but it'll be overwritten when we call UpdateBounds unless we get the updated
+                               // size.
+                               if (width < 0 || height < 0) {
+                                       int cw, ch, ix, iy;
+                                       XplatUI.GetWindowPos(Handle, this is Form, out ix, out iy, out width, out height, out cw, out ch);
+                               }
                        }

                        UpdateBounds(x, y, width, height);
Index: XplatUIX11.cs
===================================================================
--- XplatUIX11.cs       (revision 68351)
+++ XplatUIX11.cs       (working copy)
@@ -4725,6 +4725,12 @@
                                return;
                        }

+                       // Win32 automatically changes negative width/height to 0.
+                       if (width < 0)
+                               width = 0;
+                       if (height < 0)
+                               height = 0;
+
                        // X requires a sanity check for width & height; otherwise it dies
                        if (hwnd.zero_sized && width > 0 && height > 0) {
                                if (hwnd.visible) {