From f2a29fcd5ff21db5881d3775b8005a8385ab3205 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Tue, 17 Oct 2023 12:35:24 +0200 Subject: [PATCH] Mac: Fix setting background of cells on Sonoma --- src/Eto.Mac/Forms/Cells/CustomCellHandler.cs | 2 +- src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs | 4 ++-- src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs | 2 +- src/Eto.Mac/Forms/Controls/GridViewHandler.cs | 2 +- src/Eto.Mac/Forms/Controls/MacImageTextView.cs | 4 ++-- src/Eto.Mac/Forms/Controls/TreeViewHandler.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Eto.Mac/Forms/Cells/CustomCellHandler.cs b/src/Eto.Mac/Forms/Cells/CustomCellHandler.cs index 557e17e1b..06dbffb1d 100644 --- a/src/Eto.Mac/Forms/Cells/CustomCellHandler.cs +++ b/src/Eto.Mac/Forms/Cells/CustomCellHandler.cs @@ -59,7 +59,7 @@ public override void DrawRect(CGRect dirtyRect) if (DrawsBackground && BackgroundColor != null && BackgroundColor.AlphaComponent > 0) { BackgroundColor.Set(); - NSGraphics.RectFill(dirtyRect); + NSGraphics.RectFill(Bounds); } base.DrawRect(dirtyRect); } diff --git a/src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs b/src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs index 2cc588ec6..bbb3b797f 100644 --- a/src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs +++ b/src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs @@ -156,13 +156,13 @@ public override void DrawRect(CGRect dirtyRect) var nscontext = NSGraphicsContext.CurrentContext; var isFirstResponder = Window?.FirstResponder == this; + var cellFrame = Bounds; if (DrawsBackground) { var context = nscontext.CGContext; context.SetFillColor(BackgroundColor.ToCG()); - context.FillRect(dirtyRect); + context.FillRect(cellFrame); } - var cellFrame = Bounds; var handler = Handler; if (handler == null) diff --git a/src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs b/src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs index ff14fbd48..aec19ae9c 100644 --- a/src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs +++ b/src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs @@ -122,7 +122,7 @@ public override void DrawRect(CGRect dirtyRect) if (BackgroundColor != null && BackgroundColor.AlphaComponent > 0) { BackgroundColor.Set(); - NSGraphics.RectFill(dirtyRect); + NSGraphics.RectFill(Bounds); } base.DrawRect(dirtyRect); } diff --git a/src/Eto.Mac/Forms/Controls/GridViewHandler.cs b/src/Eto.Mac/Forms/Controls/GridViewHandler.cs index 8a487a23c..fdd83c86a 100644 --- a/src/Eto.Mac/Forms/Controls/GridViewHandler.cs +++ b/src/Eto.Mac/Forms/Controls/GridViewHandler.cs @@ -34,7 +34,7 @@ public override void DrawBackground(CGRect clipRect) if (backgroundColor != Colors.Transparent) { backgroundColor.ToNSUI().Set(); - NSGraphics.RectFill(clipRect); + NSGraphics.RectFill(Bounds); } else base.DrawBackground(clipRect); diff --git a/src/Eto.Mac/Forms/Controls/MacImageTextView.cs b/src/Eto.Mac/Forms/Controls/MacImageTextView.cs index 2fb3e81c5..1c096ecb1 100644 --- a/src/Eto.Mac/Forms/Controls/MacImageTextView.cs +++ b/src/Eto.Mac/Forms/Controls/MacImageTextView.cs @@ -78,16 +78,16 @@ NSTextField CreateTextFieldInternal() public override void DrawRect(CGRect dirtyRect) { + var bounds = Bounds; if (BetterBackgroundColor != null) { BetterBackgroundColor.SetFill(); - NSGraphics.RectFill(dirtyRect); + NSGraphics.RectFill(bounds); } if (_image != null) { var context = NSGraphicsContext.CurrentContext; - var bounds = Bounds; var imageRect = new CGRect(0, bounds.Y, _imageSize.Width, _imageSize.Height); imageRect.Y += (bounds.Height - _imageSize.Height) / 2; diff --git a/src/Eto.Mac/Forms/Controls/TreeViewHandler.cs b/src/Eto.Mac/Forms/Controls/TreeViewHandler.cs index 6158f184a..9f965e361 100644 --- a/src/Eto.Mac/Forms/Controls/TreeViewHandler.cs +++ b/src/Eto.Mac/Forms/Controls/TreeViewHandler.cs @@ -269,7 +269,7 @@ public override void DrawBackground(CGRect clipRect) if (backgroundColor != Colors.Transparent) { backgroundColor.ToNSUI().Set(); - NSGraphics.RectFill(clipRect); + NSGraphics.RectFill(Bounds); return; } }