Quellcode durchsuchen

2005-10-12 Peter Dennis Bartok <[email protected]>

	* XplatUI.cs, XplatUIDriver.cs: Removed EraseWindowBackground 
	  and SetWindowBackground methods
	* Control.cs:
	  - Setting proper ControlStyles
	  - We no longer call XplatUI.SetWindowBackground and XplatUI.
	    EraseWindowBackground, instead we draw the window background
	    ourselves in PaintControlBackground. This behaviour is
	    required to match MS, where, when OnPaintBackground is not
	    called, the background is not drawn.
	  - Removed unneeded Refresh() in set_Text
	* Hwnd.cs: Dropped the ErasePending support. No longer needed
	* XplatUIX11.cs:
	  - Created DeriveStyles method to translate from CreateParams to
	    FormBorderStyle and TitleStyle, also handles BorderStyle (which
	    matches FormBorderStyle enum values)
	  - Consolidated SetHwndStyles and CalculateWindowRect border/title
	    style calculations into single DeriveStyles method
	  - Fixed CreateWindow to (finally) use Gravity. This prevents X11
	    from redrawing the whole window on any resize or expose.
	  - Fixed CreateWindow usage of SetWindowValuemask. Before not
	    all styles were applied to our whole/client window appropriately
	  - Removed EraseWindowBackground() and SetWindowBackground() methods
	  - Removed handling of WM_ERASEBKGND message from DefWndProc, we
	    no longer clear/redraw the background through X
	  - Removed handling of erase_pending bit, we have no use for it (or
	    so it seems)
	* XplatUIOSX.cs:
	  - Removed generation and handling of WM_ERASEBKGND message
	  - Removed EraseWindowBackground() and SetWindowBackground() methods
	  - Removed handling of hwnd.ErasePending flag
	* XplatUIWin32.cs:
	  - Removed EraseWindowBackground() and SetWindowBackground() methods
	  - We no longer call EraseWindowBackground on PaintEventStart, we 
	    ignore the fErase flag, erasing is handled in Control in the
	    background handler
	* Button.cs, GroupBox.cs, Label.cs, CheckBox.cs, ProgressBar.cs,
	  LinkLabel.cs, ListControl.cs, TabPage.cs, UpDownBase.cs,
	  TextBoxBase.cs, TextBox.cs, ListView.cs, ButtonBase.cs, 
	  CheckedListBox.cs, MdiClient.cs, Panel.cs, DataGrid.cs, 
	  DataGridTextBox.cs, ScrollBar.cs, ListBox.cs, TrackBar.cs, 
	  TabControl.cs, ScrollableControl.cs, ToolBar.cs, PictureBox.cs,
	  DateTimePicker.cs, StatusBar.cs, MonthCalendar.cs: Setting proper ControlStyles


svn path=/trunk/mcs/; revision=51670
Peter Dennis Bartok vor 20 Jahren
Ursprung
Commit
638b27e47c
37 geänderte Dateien mit 157 neuen und 245 gelöschten Zeilen
  1. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs
  2. 7 4
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
  3. 45 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
  4. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs
  5. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
  6. 7 19
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
  7. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
  8. 3 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
  9. 2 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
  10. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs
  11. 0 12
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
  12. 5 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs
  13. 2 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
  14. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
  15. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
  16. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
  17. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
  18. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
  19. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
  20. 2 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs
  21. 4 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs
  22. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
  23. 1 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
  24. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs
  25. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
  26. 2 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs
  27. 3 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs
  28. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
  29. 3 0
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
  30. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs
  31. 1 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
  32. 1 5
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
  33. 0 11
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
  34. 0 3
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
  35. 0 32
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
  36. 0 31
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
  37. 53 104
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs

@@ -39,6 +39,7 @@ namespace System.Windows.Forms {
 		#region Public Constructors
 		public Button() {
 			dialog_result = DialogResult.None;
+			SetStyle(ControlStyles.StandardDoubleClick, false);
 		}
 		#endregion	// Public Constructors
 

+ 7 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs

@@ -142,10 +142,13 @@ namespace System.Windows.Forms {
 			FontChanged+=new EventHandler(RedrawEvent);
 			SizeChanged+=new EventHandler(RedrawEvent);
 
-			SetStyle(ControlStyles.UserPaint, true);
-			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle(ControlStyles.ResizeRedraw, true);
-			SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+			SetStyle(ControlStyles.ResizeRedraw | 
+				ControlStyles.Opaque | 
+				ControlStyles.UserMouse | 
+				ControlStyles.SupportsTransparentBackColor | 
+				ControlStyles.CacheText |
+				ControlStyles.DoubleBuffer, true);
+			SetStyle(ControlStyles.StandardClick, false);
 		}
 		#endregion	// Public Constructors
 

+ 45 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,48 @@
+2005-10-12  Peter Dennis Bartok  <[email protected]>
+
+	* XplatUI.cs, XplatUIDriver.cs: Removed EraseWindowBackground 
+	  and SetWindowBackground methods
+	* Control.cs:
+	  - Setting proper ControlStyles
+	  - We no longer call XplatUI.SetWindowBackground and XplatUI.
+	    EraseWindowBackground, instead we draw the window background
+	    ourselves in PaintControlBackground. This behaviour is
+	    required to match MS, where, when OnPaintBackground is not
+	    called, the background is not drawn.
+	  - Removed unneeded Refresh() in set_Text
+	* Hwnd.cs: Dropped the ErasePending support. No longer needed
+	* XplatUIX11.cs:
+	  - Created DeriveStyles method to translate from CreateParams to
+	    FormBorderStyle and TitleStyle, also handles BorderStyle (which
+	    matches FormBorderStyle enum values)
+	  - Consolidated SetHwndStyles and CalculateWindowRect border/title
+	    style calculations into single DeriveStyles method
+	  - Fixed CreateWindow to (finally) use Gravity. This prevents X11
+	    from redrawing the whole window on any resize or expose.
+	  - Fixed CreateWindow usage of SetWindowValuemask. Before not
+	    all styles were applied to our whole/client window appropriately
+	  - Removed EraseWindowBackground() and SetWindowBackground() methods
+	  - Removed handling of WM_ERASEBKGND message from DefWndProc, we
+	    no longer clear/redraw the background through X
+	  - Removed handling of erase_pending bit, we have no use for it (or
+	    so it seems)
+	* XplatUIOSX.cs:
+	  - Removed generation and handling of WM_ERASEBKGND message
+	  - Removed EraseWindowBackground() and SetWindowBackground() methods
+	  - Removed handling of hwnd.ErasePending flag
+	* XplatUIWin32.cs:
+	  - Removed EraseWindowBackground() and SetWindowBackground() methods
+	  - We no longer call EraseWindowBackground on PaintEventStart, we 
+	    ignore the fErase flag, erasing is handled in Control in the
+	    background handler
+	* Button.cs, GroupBox.cs, Label.cs, CheckBox.cs, ProgressBar.cs,
+	  LinkLabel.cs, ListControl.cs, TabPage.cs, UpDownBase.cs,
+	  TextBoxBase.cs, TextBox.cs, ListView.cs, ButtonBase.cs, 
+	  CheckedListBox.cs, MdiClient.cs, Panel.cs, DataGrid.cs, 
+	  DataGridTextBox.cs, ScrollBar.cs, ListBox.cs, TrackBar.cs, 
+	  TabControl.cs, ScrollableControl.cs, ToolBar.cs, PictureBox.cs,
+	  DateTimePicker.cs, StatusBar.cs, MonthCalendar.cs: Setting proper ControlStyles
+
 2005-10-12  Jonathan Chambers <[email protected]>
 
 	* PropertyGrids.cs: Get sub properties

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs

@@ -100,6 +100,7 @@ namespace System.Windows.Forms {
 			auto_check = true;
 			check_alignment = ContentAlignment.MiddleLeft;
 			text_alignment = ContentAlignment.MiddleLeft;
+			SetStyle(ControlStyles.StandardDoubleClick, false);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs

@@ -50,6 +50,7 @@ namespace System.Windows.Forms
 			check_onclick = false;
 			three_dcheckboxes = false;
 			listbox_info.item_height = FontHeight + 2;
+			SetStyle (ControlStyles.ResizeRedraw, true);
 		}
 
 		#region events

+ 7 - 19
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

@@ -657,7 +657,9 @@ namespace System.Windows.Forms
 			border_style = BorderStyle.None;
 			background_color = Color.Empty;
 
-			control_style = ControlStyles.Selectable | ControlStyles.StandardClick | ControlStyles.StandardDoubleClick;
+			control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | 
+					ControlStyles.Selectable | ControlStyles.StandardClick | 
+					ControlStyles.StandardDoubleClick;
 
 			parent = null;
 			background_image = null;
@@ -835,11 +837,6 @@ namespace System.Windows.Forms
 
 			for (int i=0; i < parent.child_controls.Count; i++) {
 				child=parent.child_controls[i];
-				if (child.IsHandleCreated) {
-					if (!child.GetStyle (ControlStyles.UserPaint)) {
-						XplatUI.SetWindowBackground(child.window.Handle, child.BackColor);
-					}
-				}
 				if (child.child_controls.Count>0) {
 					SetChildColor(child);
 				}
@@ -893,8 +890,10 @@ namespace System.Windows.Forms
 		// This method exists so controls overriding OnPaintBackground can have default background painting done
 		internal virtual void PaintControlBackground (PaintEventArgs pevent)
 		{
-			if (background_image == null)
+			if (background_image == null) {
+				pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), new Rectangle(pevent.ClipRectangle.X - 1, pevent.ClipRectangle.Y - 1, pevent.ClipRectangle.Width + 2, pevent.ClipRectangle.Height + 2));
 				return;
+			}
 
 			DrawBackgroundImage (pevent.Graphics);
 		}
@@ -1255,9 +1254,6 @@ namespace System.Windows.Forms
 
 			set {
 				background_color=value;
-				if (this.IsHandleCreated && !GetStyle (ControlStyles.UserPaint)) {
-					XplatUI.SetWindowBackground(this.window.Handle, value);
-				}
 				SetChildColor(this);
 				OnBackColorChanged(EventArgs.Empty);
 				Invalidate();
@@ -1992,6 +1988,7 @@ namespace System.Windows.Forms
 		[BindableAttribute(true)]
 		public virtual string Text {
 			get {
+				// Our implementation ignores ControlStyles.CacheText - we always cache
 				return this.text;
 			}
 
@@ -2004,9 +2001,6 @@ namespace System.Windows.Forms
 					text=value;
 					if (IsHandleCreated) {
 						XplatUI.Text(Handle, text);
-					} else {
-						// FIXME: Do we need a Refresh() here?
-						Refresh();
 					}
 					OnTextChanged (EventArgs.Empty);
 				}
@@ -2857,10 +2851,6 @@ namespace System.Windows.Forms
 
 				creator_thread = Thread.CurrentThread;
 
-				if (!GetStyle (ControlStyles.UserPaint)) {
-					XplatUI.SetWindowBackground(window.Handle, this.BackColor);
-				}
-
 				OnHandleCreated(EventArgs.Empty);
 			}
 		}
@@ -3510,8 +3500,6 @@ namespace System.Windows.Forms
 									Graphics.FromHdc (m.WParam), new Rectangle (new Point (0,0),Size));
 							OnPaintBackground (eraseEventArgs);
 						}
-					} else {
-						XplatUI.EraseWindowBackground(m.HWnd, m.WParam);
 					}
 					// The DefWndProc will never have to handle this, we don't ever set hbr on the window
 					m.Result = (IntPtr)1;

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs

@@ -250,7 +250,7 @@ namespace System.Windows.Forms
 			vert_scrollbar.Scroll += new ScrollEventHandler (GridVScrolled);			
 			KeyUp += new KeyEventHandler (OnKeyUpDG);			
 
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+			SetStyle (ControlStyles.UserMouse, true);
 
 		}
 

+ 3 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs

@@ -49,6 +49,9 @@ namespace System.Windows.Forms
 		{
 			isedit = true;
 			grid = null;
+
+			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+			SetStyle (ControlStyles.FixedHeight, true);
 		}
 		#endregion
 

+ 2 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs

@@ -113,7 +113,8 @@ namespace System.Windows.Forms {
 			MouseDown += new MouseEventHandler (MouseDownHandler);			
 			Paint += new PaintEventHandler (PaintHandler);
 			
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+			SetStyle (ControlStyles.FixedHeight, true);
 		}
 		
 		#endregion

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs

@@ -96,9 +96,8 @@ namespace System.Windows.Forms
 			TabStop = false;
 			flat_style = FlatStyle.Standard;
 
-			SetStyle(ControlStyles.ContainerControl, true);
+			SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
 			SetStyle(ControlStyles.Selectable, false);
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
 		}
 
 		#region Public Properties

+ 0 - 12
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs

@@ -57,7 +57,6 @@ namespace System.Windows.Forms {
 		internal bool		visible;
 		internal Rectangle	invalid;
 		internal bool		expose_pending;
-		internal bool		erase_pending;
 		internal bool		nc_expose_pending;
 		internal bool		configure_pending;
 		internal Graphics	client_dc;
@@ -83,7 +82,6 @@ namespace System.Windows.Forms {
 			expose_pending = false;
 			nc_expose_pending = false;
 			client_rectangle = Rectangle.Empty;
-			erase_pending = true;
 			marshal_free_list = new ArrayList(2);
 		}
 
@@ -294,16 +292,6 @@ namespace System.Windows.Forms {
 			}
 		}
 
-		public bool ErasePending {
-			get {
-				return erase_pending;
-			}
-
-			set {
-				erase_pending = value;
-			}
-		}
-
 		public bool ExposePending {
 			get {
 				return expose_pending;

+ 5 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs

@@ -103,9 +103,12 @@ namespace System.Windows.Forms
 			AutoSizeChanged = null;
     			TextAlignChanged = null;
 
-			SetStyle (ControlStyles.ResizeRedraw, true);
 			SetStyle (ControlStyles.Selectable, false);
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+			SetStyle (ControlStyles.ResizeRedraw | 
+				ControlStyles.UserPaint | 
+				ControlStyles.AllPaintingInWmPaint |
+				ControlStyles.SupportsTransparentBackColor |
+				ControlStyles.DoubleBuffer, true);
 			
 			HandleCreated += new EventHandler (OnHandleCreatedLB);
 		}

+ 2 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs

@@ -93,7 +93,8 @@ namespace System.Windows.Forms
 			DisabledLinkColor = ThemeEngine.Current.ColorGrayText;
 			LinkColor = Color.FromArgb (255, 0, 0, 255);
 			VisitedLinkColor = Color.FromArgb (255, 128, 0, 128);
-			SetStyle (ControlStyles.Selectable, true);			
+			SetStyle (ControlStyles.Selectable, false);
+			SetStyle (ControlStyles.Opaque, true);
 		}
 
 		#region Public Properties

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs

@@ -189,7 +189,7 @@ namespace System.Windows.Forms
 			GotFocus += new EventHandler (OnGotFocus);
 			LostFocus += new EventHandler (OnLostFocus);
 			
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+			SetStyle (ControlStyles.UserPaint, false);
 		}
 
 		#region Events

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs

@@ -47,6 +47,7 @@ namespace System.Windows.Forms
 			value_member = new BindingMemberInfo (string.Empty);
 			display_member = string.Empty;
 			data_manager = null;
+			SetStyle (ControlStyles.StandardClick | ControlStyles.UserPaint, false);
 		}
 
 		#region Events

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs

@@ -154,7 +154,7 @@ namespace System.Windows.Forms
 			base.Paint += new PaintEventHandler (ListView_Paint);
 			SizeChanged += new EventHandler (ListView_SizeChanged);
 
-			this.SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+			this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs

@@ -68,6 +68,7 @@ namespace System.Windows.Forms {
 		public MdiClient() {
 			BackColor = SystemColors.AppWorkspace;
 			Dock = DockStyle.Fill;
+			SetStyle (ControlStyles.Selectable, false);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs

@@ -102,8 +102,7 @@ namespace System.Windows.Forms {
 
 		public MonthCalendar () {
 			// set up the control painting
-			SetStyle (ControlStyles.UserPaint, true);
-			SetStyle (ControlStyles.AllPaintingInWmPaint, true);
+			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 			
 			// mouse down timer
 			timer = new Timer ();

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs

@@ -40,7 +40,7 @@ namespace System.Windows.Forms {
 		public Panel () {
 			base.TabStop = false;
 			SetStyle(ControlStyles.Selectable, false);
-			SetStyle(ControlStyles.UserPaint, true);
+			SetStyle (ControlStyles.SupportsTransparentBackColor, true);
 		}
 		#endregion	// Constructors & Destructors
 

+ 2 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs

@@ -50,6 +50,8 @@ namespace System.Windows.Forms {
 			redraw = true;
 			recalc = true;
 			allow_drop = false;
+			SetStyle (ControlStyles.Selectable, false);
+			SetStyle (ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
 		}
 
 		[DefaultValue(PictureBoxSizeMode.Normal)]

+ 4 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs

@@ -120,8 +120,10 @@ namespace System.Windows.Forms
 			base.Paint += new PaintEventHandler (OnPaintPB);
 			base.Resize += new EventHandler (OnResizeTB);
 
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+			SetStyle (ControlStyles.UserPaint | 
+				ControlStyles.Selectable | 
+				ControlStyles.ResizeRedraw | 
+				ControlStyles.Opaque, false);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs

@@ -164,8 +164,7 @@ namespace System.Windows.Forms
 			base.Resize += new EventHandler (OnResizeSB);
 			base.TabStop = false;
                         
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 		}
 
 		#region Internal & Private Properties

+ 1 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs

@@ -198,6 +198,7 @@ namespace System.Windows.Forms {
 		#region Public Constructors
 		public ScrollableControl() {
 			SetStyle(ControlStyles.ContainerControl, true);
+			SetStyle(ControlStyles.AllPaintingInWmPaint, false);
 			auto_scroll = false;
 			auto_hscroll = false;
 			auto_vscroll = false;

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs

@@ -54,7 +54,7 @@ namespace System.Windows.Forms {
 			base.Dock = DockStyle.Bottom;
 			Anchor = AnchorStyles.Top | AnchorStyles.Left;
 			this.TabStop = false;
-			this.SetStyle(ControlStyles.ResizeRedraw, true);
+			this.SetStyle(ControlStyles.UserPaint | ControlStyles.Selectable, false);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs

@@ -60,7 +60,7 @@ namespace System.Windows.Forms {
 		public TabControl ()
 		{
 			tab_pages = new TabPageCollection (this);
-			SetStyle (ControlStyles.UserPaint, true);
+			SetStyle (ControlStyles.UserPaint, false);
 			padding = ThemeEngine.Current.TabControlDefaultPadding;
 			item_size = ThemeEngine.Current.TabControlDefaultItemSize;
 

+ 2 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs

@@ -46,6 +46,8 @@ namespace System.Windows.Forms {
 		public TabPage ()
 		{
 			Visible = true;
+
+			SetStyle (ControlStyles.CacheText, true);
 		}
 
 		public TabPage (string text) : base ()

+ 3 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs

@@ -46,6 +46,9 @@ namespace System.Windows.Forms {
 			this.LostFocus +=new EventHandler(TextBox_LostFocus);
 			this.BackColor = ThemeEngine.Current.ColorWindow;
 			this.ForeColor = ThemeEngine.Current.ColorWindowText;
+
+			SetStyle (ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+			SetStyle (ControlStyles.FixedHeight, true);
 		}
 		#endregion	// Public Constructors
 

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs

@@ -120,8 +120,7 @@ namespace System.Windows.Forms {
 			ResumeLayout ();
 			
 			//SetStyle(ControlStyles.ResizeRedraw, true);
-			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle(ControlStyles.UserPaint, true);
+			SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 
 			canvas_width = ClientSize.Width;
 			canvas_height = ClientSize.Height;

+ 3 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs

@@ -121,6 +121,9 @@ namespace System.Windows.Forms
 			this.MouseMove += new MouseEventHandler (ToolBar_MouseMove);
 			this.MouseUp += new MouseEventHandler (ToolBar_MouseUp);
 			base.Paint += new PaintEventHandler (ToolBar_Paint);
+
+			SetStyle (ControlStyles.UserPaint, false);
+			SetStyle (ControlStyles.FixedHeight, true);
 		}
 		#endregion Constructor
 

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs

@@ -119,8 +119,7 @@ namespace System.Windows.Forms
 			MouseMove += new MouseEventHandler (OnMouseMoveTB);
 			holdclick_timer.Elapsed += new ElapsedEventHandler (OnFirstClickTimer);
 
-			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);			
+			SetStyle (ControlStyles.UserPaint | ControlStyles.Opaque, false);
 		}
 
 		#region Private & Internal Properties

+ 1 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs

@@ -113,8 +113,7 @@ namespace System.Windows.Forms {
 			MouseMove += new MouseEventHandler(MouseMoveHandler);
 			SizeChanged += new EventHandler (SizeChangedHandler);
 
-			SetStyle (ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
-			SetStyle (ControlStyles.UserPaint | ControlStyles.Selectable, true);
+			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 
 			dash = new Pen (SystemColors.ControlLight, 1);
 			dash.DashStyle = DashStyle.Dash;

+ 1 - 5
mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs

@@ -276,11 +276,7 @@ namespace System.Windows.Forms
 			txtView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
 			this.Paint +=new PaintEventHandler(UpDownBase_Paint);
 
-			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
-			SetStyle(ControlStyles.DoubleBuffer, true);
-			SetStyle(ControlStyles.Opaque, true);
-			SetStyle(ControlStyles.ResizeRedraw, true);
-			SetStyle(ControlStyles.UserPaint, true);
+			SetStyle(ControlStyles.FixedHeight, true);
 
 			UpdateEditText();
 		}

+ 0 - 11
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs

@@ -389,10 +389,6 @@ namespace System.Windows.Forms {
 			driver.Exit();
 		}
 
-		internal static void EraseWindowBackground(IntPtr handle, IntPtr wParam) {
-			driver.EraseWindowBackground(handle, wParam);
-		}
-
 		internal static IntPtr GetActive() {
 			#if DriverDebug
 				Console.WriteLine("GetActive(): Called");
@@ -702,13 +698,6 @@ namespace System.Windows.Forms {
 			driver.SetWindowStyle(handle, cp);
 		}
 
-		internal static void SetWindowBackground(IntPtr handle, Color color) {
-			#if DriverDebug
-				Console.WriteLine("SetWindowBackground({0:X}, {1}): Called", handle.ToInt32(), color);
-			#endif
-			driver.SetWindowBackground(handle, color);
-		}
-			
 		internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
 			#if DriverDebug
 				Console.WriteLine("SetZOrder({0:X}, {1:X}, {2}, {3}): Called", handle.ToInt32(), AfterhWnd.ToInt32(), Top, Bottom);

+ 0 - 3
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs

@@ -143,7 +143,6 @@ namespace System.Windows.Forms {
 		internal abstract IntPtr GetParent(IntPtr handle);
 
 		internal abstract void UpdateWindow(IntPtr handle);
-		internal abstract void SetWindowBackground(IntPtr handle, Color color);
 		internal abstract PaintEventArgs PaintEventStart(IntPtr handle, bool client);
 		internal abstract void PaintEventEnd(IntPtr handle, bool client);
 
@@ -213,8 +212,6 @@ namespace System.Windows.Forms {
 
 		internal abstract void SetIcon(IntPtr handle, Icon icon);
 
-		internal abstract void EraseWindowBackground(IntPtr handle, IntPtr wParam);
-
 		internal abstract void ClipboardClose(IntPtr handle);
 		internal abstract IntPtr ClipboardOpen();
 		internal abstract int ClipboardGetID(IntPtr handle, string format);

+ 0 - 32
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs

@@ -1079,10 +1079,6 @@ namespace System.Windows.Forms {
 		internal override IntPtr DefWndProc(ref Message msg) {
 			Hwnd hwnd = Hwnd.ObjectFromHandle (msg.HWnd);
 			switch ((Msg)msg.Msg) {
-				case Msg.WM_ERASEBKGND: {
-					HIViewSetNeedsDisplay (hwnd.whole_window, true);
-					return (IntPtr)1;
-				}
 				case Msg.WM_DESTROY: {
 					if (WindowMapping [hwnd.Handle] != null)
 
@@ -1136,12 +1132,6 @@ namespace System.Windows.Forms {
 			//Like X11 we need not do anything here
 		}
 
-		internal override void EraseWindowBackground(IntPtr handle, IntPtr wParam) {
-			Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
-			HIViewSetNeedsDisplay (hwnd.whole_window, true);
-		}
-
-
 		internal override void Exit() {
 			GetMessageResult = false;
 			ExitToShell ();
@@ -1286,8 +1276,6 @@ namespace System.Windows.Forms {
 		internal override void Invalidate (IntPtr handle, Rectangle rc, bool clear) {
 			Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
 			
-			if (clear)
-				hwnd.erase_pending = true;
 			if (hwnd.visible && HIViewIsVisible (handle)) {
 				MSG msg = new MSG ();
 				msg.hwnd = hwnd.Handle;
@@ -1345,11 +1333,6 @@ namespace System.Windows.Forms {
 				HideCaret();
 			}
 
-			if (hwnd.erase_pending) {
-				NativeWindow.WndProc (hwnd.client_window, Msg.WM_ERASEBKGND, IntPtr.Zero, IntPtr.Zero);
-				hwnd.erase_pending = false;
-			}
-
 			hwnd.client_dc  = Graphics.FromHwnd (hwnd.client_window);
 			paint_event = new PaintEventArgs(hwnd.client_dc, hwnd.invalid);
 			
@@ -1576,21 +1559,6 @@ namespace System.Windows.Forms {
 			return true;
 		}
 		
-		internal override void SetWindowBackground(IntPtr handle, Color color) {
-			Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
-			
-			if (WindowMapping [hwnd.Handle] != null) {
-				RGBColor backColor = new RGBColor ();
-				backColor.red = (short)(color.R * 257); 
-				backColor.green = (short)(color.G * 257);
-				backColor.blue = (short)(color.B * 257);
-
-				CheckError (SetWindowContentColor ((IntPtr) WindowMapping [hwnd.Handle], ref backColor));
-			} else {
-				WindowBackgrounds [hwnd] = color;
-			}
-		}
-		
 		internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
 			Hwnd	hwnd;
 

+ 0 - 31
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs

@@ -1040,10 +1040,6 @@ namespace System.Windows.Forms {
 			Win32UpdateWindow(handle);
 		}
 
-		internal override void SetWindowBackground(IntPtr handle, Color color) {
-			Win32SetWindowLong(handle, WindowLong.GWL_USERDATA, (uint)color.ToArgb());
-		}
-
 		[MonoTODO("FIXME - Add support for internal table of windows/DCs for cleanup; handle client=false to draw in NC area")]
 		internal override PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
 			IntPtr		hdc;
@@ -1064,13 +1060,7 @@ namespace System.Windows.Forms {
 
 				hwnd.user_data = (object)ps;
 
-				// FIXME: Figure out why the rectangle is always 0 size
 				clip_rect = new Rectangle(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top);
-//				clip_rect = new Rectangle(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
-
-				if (ps.fErase != 0) {
-					EraseWindowBackground(handle, hdc);
-				}
 			} else {
 				hdc = Win32GetDC(handle);
 				// FIXME: Add the DC to internal list
@@ -1757,27 +1747,6 @@ namespace System.Windows.Forms {
 			Win32SendMessage(hwnd, Msg.WM_SETICON, (IntPtr)1, icon.Handle);	// 1 = large icon (0 would be small)
 		}
 
-		internal override void EraseWindowBackground(IntPtr hWnd, IntPtr hDc) {
-			IntPtr          hbr;
-			LOGBRUSH        lb;
-			uint            argb;
-			RECT            rect;
-
-			//msg.wParam
-			argb = Win32GetWindowLong(hWnd, WindowLong.GWL_USERDATA);
-			lb = new LOGBRUSH();
-
-			lb.lbColor.B = (byte)((argb & 0xff0000)>>16);
-			lb.lbColor.G = (byte)((argb & 0xff00)>>8);
-			lb.lbColor.R = (byte)(argb & 0xff);
-
-			lb.lbStyle = LogBrushStyle.BS_SOLID;
-			hbr = Win32CreateBrushIndirect(ref lb);
-			Win32GetClientRect(hWnd, out rect);
-			Win32FillRect(hDc, ref rect, hbr);
-			Win32DeleteObject(hbr);
-		}
-
 		internal override void ClipboardClose(IntPtr handle) {
 			if (handle != clip_magic) {
 				throw new ArgumentException("handle is not a valid clipboard handle");

+ 53 - 104
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

@@ -563,36 +563,54 @@ namespace System.Windows.Forms {
 			XSendEvent(DisplayHandle, window, false, EventMask.NoEventMask, ref xev);
 		}
 
-		private void SetHwndStyles(Hwnd hwnd, CreateParams cp) {
-			hwnd.border_style = FormBorderStyle.None;
-			if ((cp.ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
-				if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
-					if ((cp.Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
-						hwnd.border_style = FormBorderStyle.SizableToolWindow;
-					} else {
-						hwnd.border_style = FormBorderStyle.FixedToolWindow;
-					}
-				} else if ((cp.ExStyle & (int)WindowStyles.WS_EX_DLGMODALFRAME) != 0) {
-					hwnd.border_style = FormBorderStyle.FixedDialog;
-				} else if ((cp.ExStyle & (int)WindowStyles.WS_THICKFRAME) != 0) {
-					hwnd.border_style = FormBorderStyle.Sizable;
+
+		private void DeriveStyles(IntPtr handle, int Style, int ExStyle, out FormBorderStyle border_style, out TitleStyle title_style) {
+			Control		control;
+
+			control = Control.FromHandle(handle);
+
+			if ( !(control is Form)) {
+				if (control != null) {
+					border_style = (FormBorderStyle)control.border_style;
 				} else {
-					hwnd.border_style = FormBorderStyle.FixedSingle;
+					border_style = FormBorderStyle.None;
 				}
+				title_style = TitleStyle.None;
 			} else {
-				hwnd.border_style = FormBorderStyle.Fixed3D;
-			}
-
+				title_style = TitleStyle.None;
+				if ((Style & (int)WindowStyles.WS_CAPTION) != 0) {
+					if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+						title_style = TitleStyle.Tool;
+					} else {
+						title_style = TitleStyle.Normal;
+					}
+				}
 
-			if ((cp.Style & (int)WindowStyles.WS_CAPTION) != 0) {
-				if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
-					hwnd.title_style = TitleStyle.Tool;
+				border_style = FormBorderStyle.None;
+				if ((ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
+					if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+						if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
+							border_style = FormBorderStyle.SizableToolWindow;
+						} else {
+							border_style = FormBorderStyle.FixedToolWindow;
+						}
+					} else if ((ExStyle & (int)WindowStyles.WS_EX_DLGMODALFRAME) != 0) {
+						border_style = FormBorderStyle.FixedDialog;
+					} else if ((ExStyle & (int)WindowStyles.WS_THICKFRAME) != 0) {
+						border_style = FormBorderStyle.Sizable;
+					} else {
+						border_style = FormBorderStyle.FixedSingle;
+					}
 				} else {
-					hwnd.title_style = TitleStyle.Normal;
+					border_style = FormBorderStyle.Fixed3D;
 				}
 			}
 		}
 
+		private void SetHwndStyles(Hwnd hwnd, CreateParams cp) {
+			DeriveStyles(hwnd.Handle, cp.Style, cp.ExStyle, out hwnd.border_style, out hwnd.title_style);
+		}
+
 		private void SetWMStyles(Hwnd hwnd, CreateParams cp) {
 			MotifWmHints		mwmHints;
 			MotifFunctions		functions;
@@ -1546,34 +1564,7 @@ namespace System.Windows.Forms {
 			FormBorderStyle	border_style;
 			TitleStyle	title_style;
 
-			title_style = TitleStyle.None;
-			if ((Style & (int)WindowStyles.WS_CAPTION) != 0) {
-				if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
-					title_style = TitleStyle.Tool;
-				} else {
-					title_style = TitleStyle.Normal;
-				}
-			}
-
-			border_style = FormBorderStyle.None;
-			if ((ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
-				if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
-					if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
-						border_style = FormBorderStyle.SizableToolWindow;
-					} else {
-						border_style = FormBorderStyle.FixedToolWindow;
-					}
-				} else if ((ExStyle & (int)WindowStyles.WS_EX_DLGMODALFRAME) != 0) {
-					border_style = FormBorderStyle.FixedDialog;
-				} else if ((ExStyle & (int)WindowStyles.WS_THICKFRAME) != 0) {
-					border_style = FormBorderStyle.Sizable;
-				} else {
-					border_style = FormBorderStyle.FixedSingle;
-				}
-			} else {
-				border_style = FormBorderStyle.Fixed3D;
-			}
-
+			DeriveStyles(handle, Style, ExStyle, out border_style, out title_style);
 			WindowRect = Hwnd.GetWindowRectangle(border_style, MenuHandle, title_style, ClientRect);
 
 			return true;
@@ -1732,8 +1723,6 @@ namespace System.Windows.Forms {
 
 			hwnd = new Hwnd();
 
-			SetHwndStyles(hwnd, cp);
-
 			Attributes = new XSetWindowAttributes();
 			X = cp.X;
 			Y = cp.Y;
@@ -1759,9 +1748,15 @@ namespace System.Windows.Forms {
 				}
 			}
 
+			ValueMask = SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity;
+
+			Attributes.bit_gravity = Gravity.NorthWestGravity;
+			Attributes.win_gravity = Gravity.NorthWestGravity;
+
 			// Save what's under the toolwindow
 			if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
 				Attributes.save_under = true;
+				ValueMask |= SetWindowValuemask.SaveUnder;
 			}
 
 
@@ -1769,12 +1764,10 @@ namespace System.Windows.Forms {
 			if ((cp.Style & ((int)WindowStyles.WS_POPUP)) != 0) {
 				if ((cp.Style & (int)WindowStyles.WS_CAPTION) == 0) {
 					Attributes.override_redirect = true;
+					ValueMask |= SetWindowValuemask.OverrideRedirect;
 				}
 			}
 
-			Attributes.bit_gravity = Gravity.NorthWestGravity;
-			Attributes.win_gravity = Gravity.NorthWestGravity;
-
 			hwnd.x = X;
 			hwnd.y = Y;
 			hwnd.width = Width;
@@ -1785,15 +1778,14 @@ namespace System.Windows.Forms {
 			ClientWindow = IntPtr.Zero;
 
 			lock (XlibLock) {
-				WholeWindow = XCreateWindow(DisplayHandle, ParentHandle, X, Y, Width, Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, IntPtr.Zero, SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity | SetWindowValuemask.SaveUnder | SetWindowValuemask.OverrideRedirect, ref Attributes);
+				WholeWindow = XCreateWindow(DisplayHandle, ParentHandle, X, Y, Width, Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, IntPtr.Zero, ValueMask, ref Attributes);
 				if (WholeWindow != IntPtr.Zero) {
-					if (CustomVisual == IntPtr.Zero || CustomColormap == IntPtr.Zero) {
-						ValueMask = SetWindowValuemask.Nothing;
-					} else {
+					ValueMask &= ~(SetWindowValuemask.OverrideRedirect | SetWindowValuemask.SaveUnder);
+
+					if (CustomVisual != IntPtr.Zero && CustomColormap != IntPtr.Zero) {
 						ValueMask = SetWindowValuemask.ColorMap;
 						Attributes.colormap = CustomColormap;
 					}
-
 					ClientWindow = XCreateWindow(DisplayHandle, WholeWindow, ClientRect.X, ClientRect.Y, ClientRect.Width, ClientRect.Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, CustomVisual, ValueMask, ref Attributes);
 				}
 			}
@@ -1805,6 +1797,8 @@ namespace System.Windows.Forms {
 			hwnd.WholeWindow = WholeWindow;
 			hwnd.ClientWindow = ClientWindow;
 
+			SetHwndStyles(hwnd, cp);
+
 			#if DriverDebug
 				Console.WriteLine("Created window {0:X} / {1:X} parent {2:X}", ClientWindow.ToInt32(), WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32() : 0);
 			#endif
@@ -2093,16 +2087,6 @@ namespace System.Windows.Forms {
 		}
 
 		internal override IntPtr DefWndProc(ref Message msg) {
-			switch((Msg)msg.Msg) {
-				case Msg.WM_ERASEBKGND: {
-					Hwnd	hwnd;
-
-					hwnd = Hwnd.ObjectFromHandle(msg.HWnd);
-					XClearArea(DisplayHandle, hwnd.client_window, hwnd.invalid.X, hwnd.invalid.Y, hwnd.invalid.Width, hwnd.invalid.Height, false);
-
-					return (IntPtr)1;
-				}
-			}
 			return IntPtr.Zero;
 		}
 
@@ -2241,16 +2225,6 @@ namespace System.Windows.Forms {
 			// We do nothing; On X11 SetModal is used to create modal dialogs, on Win32 this function is used (see comment there)
 		}
 
-		internal override void EraseWindowBackground(IntPtr handle, IntPtr wParam) {
-			Hwnd	hwnd;
-
-			hwnd = Hwnd.ObjectFromHandle(handle);
-
-			lock (XlibLock) {
-				XClearArea (DisplayHandle, hwnd.client_window, hwnd.invalid.Left, hwnd.invalid.Top, hwnd.invalid.Width, hwnd.invalid.Height, false);
-			}
-		}
-
 		internal override void Exit() {
 			GetMessageResult = false;
 		}
@@ -2939,7 +2913,6 @@ namespace System.Windows.Forms {
 			xevent.ExposeEvent.window = hwnd.client_window;
 
 			if (clear) {
-				hwnd.erase_pending = true;
 				xevent.ExposeEvent.x = hwnd.X;
 				xevent.ExposeEvent.y = hwnd.Y;
 				xevent.ExposeEvent.width = hwnd.Width;
@@ -2996,12 +2969,6 @@ namespace System.Windows.Forms {
 			}
 
 			if (client) {
-				if (hwnd.erase_pending) {
-					// In our implementation WM_ERASEBKGND always returns 1; otherwise we'd check the result and only call clear if it returned 0
-					NativeWindow.WndProc(hwnd.client_window, Msg.WM_ERASEBKGND, IntPtr.Zero, IntPtr.Zero);
-					hwnd.erase_pending = false;
-				}
-
 				hwnd.client_dc = Graphics.FromHwnd (hwnd.client_window);
 				hwnd.client_dc.SetClip(hwnd.invalid);
 				paint_event = new PaintEventArgs(hwnd.client_dc, hwnd.invalid);
@@ -3388,24 +3355,6 @@ namespace System.Windows.Forms {
 			return true;
 		}
 
-		internal override void SetWindowBackground(IntPtr handle, Color color) {
-			XColor	xcolor;
-			Hwnd	hwnd;
-
-			hwnd = Hwnd.ObjectFromHandle(handle);
-			xcolor = new XColor();
-
-			xcolor.red = (ushort)(color.R * 257);
-			xcolor.green = (ushort)(color.G * 257);
-			xcolor.blue = (ushort)(color.B * 257);
-
-			lock (XlibLock) {
-				XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
-				XSetWindowBackground(DisplayHandle, hwnd.client_window, xcolor.pixel);
-				XClearWindow(DisplayHandle, hwnd.client_window);
-			}
-		}
-
 		internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
 			Hwnd		hwnd;
 			Rectangle	client_rect;