2005-10-12 Peter Dennis Bartok <pbartok@novell.com>
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Thu, 13 Oct 2005 00:30:42 +0000 (00:30 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Thu, 13 Oct 2005 00:30:42 +0000 (00:30 -0000)
* 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

37 files changed:
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index 3014a8567e56c727217240cbd73d5def97911811..fee2af3d6fe3dfbc081b54e3a84dc49737a78f54 100644 (file)
@@ -39,6 +39,7 @@ namespace System.Windows.Forms {
                #region Public Constructors
                public Button() {
                        dialog_result = DialogResult.None;
+                       SetStyle(ControlStyles.StandardDoubleClick, false);
                }
                #endregion      // Public Constructors
 
index 401ddc8e975e375625a56d327e935e81093dfcba..6654f34cf43a61135b6f00fedcd0a1c66ee7d908 100644 (file)
@@ -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
 
index 1e8bd8ab8d135e8bc9423e057f788f98e1b83727..13e936f78db96a57ec34b06bcff03cd982f69a9e 100644 (file)
@@ -1,3 +1,48 @@
+2005-10-12  Peter Dennis Bartok  <pbartok@novell.com>
+
+       * 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 <jonathan.chambers@ansys.com>
 
        * PropertyGrids.cs: Get sub properties
index 9970a408de8d34d872ec8203b9a400d68fe476b7..4f76fa7ddcc47f6e8ba6640ce49dcb88feace679 100644 (file)
@@ -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
 
index 4838b21b065be83c66a455ecde7c6f346305cd55..2a1d8f48fe9b93b98d108043f8530ffc40a970e1 100644 (file)
@@ -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
index e4bf0dbedd42e413e57545ebf0be04e152de0ee0..e61bee46e5790f1002874d8abf3de03dc9cb09e8 100644 (file)
@@ -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;
index bce4358d06ceb6478a75c5ff38486409da0c81d3..932e81686d4577a3a178d8d2e5dde466f9e9bbc2 100644 (file)
@@ -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);
 
                }
 
index d68a09d96a57c7edc656254043db3166b440f8cd..d7b88104bc5b8967cad2467cfda03365ea391156 100644 (file)
@@ -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
 
index 50d65ffeabf825b519df979739b3193c6644a863..f0a7a8d7c551761e3d83e949e1ac326921f7bf16 100644 (file)
@@ -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
index a5b0a4b4b38ee1058baa9d7b96d2b7db75d225e1..49a7aa6564f83abdde9285e99ec4c5ada57a3c44 100644 (file)
@@ -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
index dd1780ff15702973a5f9010c3adde29c5d75a30f..a49d2b17b2faa60e832c3805fb14dcb4de058f30 100644 (file)
@@ -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;
index d1e91cd5f742ea9eb521dc055268d86149409ba4..d4a796149c342dd43fe2322afac33add0e97a4d6 100644 (file)
@@ -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);
                }
index 10742d4ddda1431c37efb4255d268c0241e5b831..87901277d1e958dab4a718d0d048ee0174c731e0 100644 (file)
@@ -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
index 864f73f5ee0ae93570246e197578dc0cc97be175..3f1b5462adc062d14d5de8a32a36613dec47ba01 100644 (file)
@@ -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
index 3264cc0f01d65cf027fd1cb4834a6b66771aea43..41b0249798b75ab51fd134528850d6a220b6e270 100644 (file)
@@ -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
index 3036a64cc7ea86bbba2059e922a58d695e4f26ae..855bbd3ba6469a9efd57f949435f96feef7c0fe2 100644 (file)
@@ -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
 
index c9fec5873c8b10b273e0f59013e2593968a60c02..753b33bf7fd9fc6c583f442a8b9a837d8cad0c58 100644 (file)
@@ -68,6 +68,7 @@ namespace System.Windows.Forms {
                public MdiClient() {
                        BackColor = SystemColors.AppWorkspace;
                        Dock = DockStyle.Fill;
+                       SetStyle (ControlStyles.Selectable, false);
                }
                #endregion      // Public Constructors
 
index b8e99c4358a0abcb2779800f9f5a8203a79847e4..46acb29aa490fbe7d2f6db5fe2729e69e0016075 100644 (file)
@@ -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 ();
index 0089f129901be7771eba42a7b134afa1ea519b66..5a0de672a41f45a154b552004af953bc7a7cd578 100644 (file)
@@ -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
 
index b63057af8da253c9a7da9cb5887720f11387816e..28c7382be0646f786e8e379f897bd890c8e987ae 100644 (file)
@@ -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)]
index e524b12cf3e74199cef3852235f4d26e1c4dcaf5..0fa380b92eb7b9c0bae43e65747c57b1d23625cf 100644 (file)
@@ -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
 
index bda2ba62560ac6259e969d3a1e865b1ed4f64291..8dab1dfe0da151161ee29bca542193314f226275 100644 (file)
@@ -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
index 4c9706b5b9106c454b92b9977efdaac6806ace95..95f335c03df77b57dbd550688557edd71264a821 100644 (file)
@@ -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;
index 534c4c936806952114f4f6b6bbc798754bc11826..b7a7d75bd9892d3c3920d8fcb04f2b746cf949f6 100644 (file)
@@ -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
 
index bb86be9e52468c17ff2766c126bac92f958e3ccb..37adeb6c43c816de21698b1edf6d8967006df8e5 100644 (file)
@@ -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;
 
index ed8ec9e025f4281d6bca2f445bbe037f161942a6..35cfeb242b0436b8e2d0951ebb5f559eb10e90a3 100644 (file)
@@ -46,6 +46,8 @@ namespace System.Windows.Forms {
                public TabPage ()
                {
                        Visible = true;
+
+                       SetStyle (ControlStyles.CacheText, true);
                }
 
                public TabPage (string text) : base ()
index bbfa31f249d02148db0c718b661d39925dab9fd1..c70349cf3c0b984360b0610dbfd81b4d02c1b1a7 100644 (file)
@@ -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
 
index fa343d99b00eb44232e489a1f089391c01da5b55..3a630e89d1d652d0a48ff5474f2726f2281a916b 100644 (file)
@@ -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;
index 553b3506aa2804831721422f437278a14f62f646..fb47c5f9470a5fab5d06e6d4e8c3383079b2a36a 100644 (file)
@@ -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
 
index 028b4093ed7a7504abed15e2ec803e69b98965f3..efa102854f2129cde1c712c77b2a50b71e94c505 100644 (file)
@@ -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
index 2258d37fdd585bf6a3fbd55850a52a1f0deab964..888cb2c29c6a3000faef91fd3fe6c07f715dfe2f 100644 (file)
@@ -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;
index 80dba836c6aff137cc6485f841030eb37d74e95e..cc71a16d4d77ab5c052b6397f7c83ec6d56cbe5a 100644 (file)
@@ -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();
                }
index 4e78edfe77d10b921e4480cf5f1d058fe569cb35..004d84d7321236b359b61f5cf6934c387001d7e7 100644 (file)
@@ -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);
index b87b7b7ab979b7a6aa4656d46eb7134000def885..e3a9c1050f339ab1d87ca9ee26f71e039543cdd2 100644 (file)
@@ -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);
index 15ea7940dcc4ba23e508bf9f0cd3d044f7340cef..9d8a56e8b6c044f6f2869b865d6f8f7ee5578edd 100644 (file)
@@ -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;
 
index b0bce2745164c7518cdbc5bbccf86b60bba507bd..4dd1bd66e81ef9e13589f03151a53dcd94cfdc66 100644 (file)
@@ -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");
index 588cc26b430c873306bf4f00bd1d4dd6c06dabff..263c3175cd390d339456911ffc3c3c77a6c63462 100644 (file)
@@ -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;