Răsfoiți Sursa

- We had SetWindowPos and MoveWindow to set window positions and size,
removed MoveWindow. We have GetWindowPos, so it made sense to keep
SetWindowPos as matching counterpart
- Added some X11 sanity checking

svn path=/trunk/mcs/; revision=32232

Peter Dennis Bartok 21 ani în urmă
părinte
comite
51ea6a75d7

+ 8 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

@@ -29,9 +29,15 @@
 //	Jaak Simm		[email protected]
 //	John Sohn		[email protected]
 //
-// $Revision: 1.21 $
+// $Revision: 1.22 $
 // $Modtime: $
 // $Log: Control.cs,v $
+// Revision 1.22  2004/08/11 19:19:44  pbartok
+// - We had SetWindowPos and MoveWindow to set window positions and size,
+//   removed MoveWindow. We have GetWindowPos, so it made sense to keep
+//   SetWindowPos as matching counterpart
+// - Added some X11 sanity checking
+//
 // Revision 1.21  2004/08/11 18:59:45  pbartok
 // - Major cleanup of my SetBounds/SetBoundsCore/UpdateBounds mess
 //   (It seems that SetBounds is just a front for SetBoundsCore and
@@ -1665,7 +1671,7 @@ Console.WriteLine("DockStyle.Fill: Moving control {0} to {1}:{2} {3}x{4} (prev w
 			}
 
 			if (IsHandleCreated) {
-				XplatUI.MoveWindow(Handle, x, y, width, height);
+				XplatUI.SetWindowPos(Handle, x, y, width, height);
 			}
 
 			UpdateBounds(x, y, width, height);

+ 7 - 5
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs

@@ -23,9 +23,15 @@
 //	Peter Bartok	[email protected]
 //
 //
-// $Revision: 1.8 $
+// $Revision: 1.9 $
 // $Modtime: $
 // $Log: XplatUI.cs,v $
+// Revision 1.9  2004/08/11 19:19:44  pbartok
+// - We had SetWindowPos and MoveWindow to set window positions and size,
+//   removed MoveWindow. We have GetWindowPos, so it made sense to keep
+//   SetWindowPos as matching counterpart
+// - Added some X11 sanity checking
+//
 // Revision 1.8  2004/08/11 18:55:46  pbartok
 // - Added method to calculate difference between decorated window and raw
 //   client area
@@ -201,10 +207,6 @@ namespace System.Windows.Forms {
 			driver.PaintEventEnd(handle);
 		}
 
-		internal static void MoveWindow(IntPtr hWnd, int x, int y, int width, int height) {
-			driver.MoveWindow(hWnd, x, y, width, height);
-		}
-
 		internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
 			driver.SetWindowPos(handle, x, y, width, height);
 		}

+ 7 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs

@@ -23,9 +23,15 @@
 //	Peter Bartok	[email protected]
 //
 //
-// $Revision: 1.8 $
+// $Revision: 1.9 $
 // $Modtime: $
 // $Log: XplatUIDriver.cs,v $
+// Revision 1.9  2004/08/11 19:19:44  pbartok
+// - We had SetWindowPos and MoveWindow to set window positions and size,
+//   removed MoveWindow. We have GetWindowPos, so it made sense to keep
+//   SetWindowPos as matching counterpart
+// - Added some X11 sanity checking
+//
 // Revision 1.8  2004/08/11 18:55:46  pbartok
 // - Added method to calculate difference between decorated window and raw
 //   client area
@@ -137,7 +143,6 @@ namespace System.Windows.Forms {
 		internal abstract bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags);
 		internal abstract bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax);
 		internal abstract bool TranslateMessage(ref MSG msg);
-		internal abstract bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height);
 		internal abstract bool DispatchMessage(ref MSG msg);
 
 		internal abstract bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, bool HasMenu, out Rectangle WindowRect);

+ 8 - 6
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs

@@ -23,9 +23,15 @@
 //	Peter Bartok	[email protected]
 //
 //
-// $Revision: 1.10 $
+// $Revision: 1.11 $
 // $Modtime: $
 // $Log: XplatUIWin32.cs,v $
+// Revision 1.11  2004/08/11 19:19:44  pbartok
+// - We had SetWindowPos and MoveWindow to set window positions and size,
+//   removed MoveWindow. We have GetWindowPos, so it made sense to keep
+//   SetWindowPos as matching counterpart
+// - Added some X11 sanity checking
+//
 // Revision 1.10  2004/08/11 18:55:46  pbartok
 // - Added method to calculate difference between decorated window and raw
 //   client area
@@ -514,7 +520,7 @@ namespace System.Windows.Forms {
 
 
 		internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
-			Console.WriteLine("#region #line");
+			Win32MoveWindow(handle, x, y, width, height);
 			return;
 		}
 
@@ -582,10 +588,6 @@ namespace System.Windows.Forms {
 			return Win32DispatchMessage(ref msg);
 		}
 
-		internal override bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height) {
-			return Win32MoveWindow(hWnd, x, y, width, height);
-		}
-
 		internal override bool Text(IntPtr handle, string text) {
 			Win32SetWindowText(handle, text);
 			return true;

+ 15 - 6
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

@@ -23,9 +23,15 @@
 //	Peter Bartok	[email protected]
 //
 //
-// $Revision: 1.17 $
+// $Revision: 1.18 $
 // $Modtime: $
 // $Log: XplatUIX11.cs,v $
+// Revision 1.18  2004/08/11 19:19:44  pbartok
+// - We had SetWindowPos and MoveWindow to set window positions and size,
+//   removed MoveWindow. We have GetWindowPos, so it made sense to keep
+//   SetWindowPos as matching counterpart
+// - Added some X11 sanity checking
+//
 // Revision 1.17  2004/08/11 18:55:46  pbartok
 // - Added method to calculate difference between decorated window and raw
 //   client area
@@ -334,12 +340,15 @@ namespace System.Windows.Forms {
 			;
 		}
 
-		internal override bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height) {
-			XMoveResizeWindow(DisplayHandle, hWnd, x, y, width, height);
-			return true;
-		}
-
 		internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
+			// X requires a sanity check for width & height; otherwise it dies
+			if (width < 1) {
+				width = 1;
+			}
+
+			if (height < 1) {
+				height = 1;
+			}
 			XMoveResizeWindow(DisplayHandle, handle, x, y, width, height);
 			return;
 		}