From dca768b9a8b3c053bb0b5865772b24ff8e95caa8 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Mon, 16 Jan 2023 17:20:21 +0100 Subject: [PATCH 1/3] feat: Enable Rule CS0649 --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 3620896f34..eac5870f96 100644 --- a/.editorconfig +++ b/.editorconfig @@ -137,6 +137,9 @@ space_within_single_line_array_initializer_braces = true #Net Analyzer dotnet_analyzer_diagnostic.category-Performance.severity = none #error - Uncomment when all violations are fixed. +# CS0649: Field 'field' is never assigned to, and will always have its default value 'value' +dotnet_diagnostic.CS0649.severity = error + # CS1591: Missing XML comment for publicly visible type or member dotnet_diagnostic.CS1591.severity = suggestion From 9bb1b2375502d56379d230d8a95ad453ad230058 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Tue, 17 Jan 2023 08:57:24 +0100 Subject: [PATCH 2/3] feat: Address Rule CS0649 https://github.com/AvaloniaUI/Avalonia/discussions/9990#discussioncomment-4701870 --- src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs | 4 ++-- src/Avalonia.X11/X11Window.Xim.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs b/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs index 899288b4a8..7d97c7cd36 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs @@ -34,7 +34,7 @@ namespace Avalonia.FreeDesktop.DBusIme private bool _connecting; private string? _currentName; private DBusCallQueue _queue; - private bool _controlActive, _windowActive; + private bool _windowActive; private bool? _imeActive; private Rect _logicalRect; private PixelRect? _lastReportedRect; @@ -189,7 +189,7 @@ namespace Avalonia.FreeDesktop.DBusIme if(!IsConnected) return; - var active = _windowActive && _controlActive; + var active = _windowActive && IsActive; if (active != _imeActive) { _imeActive = active; diff --git a/src/Avalonia.X11/X11Window.Xim.cs b/src/Avalonia.X11/X11Window.Xim.cs index 10aece7f2e..8446d35cc6 100644 --- a/src/Avalonia.X11/X11Window.Xim.cs +++ b/src/Avalonia.X11/X11Window.Xim.cs @@ -13,7 +13,7 @@ namespace Avalonia.X11 class XimInputMethod : ITextInputMethodImpl, IX11InputMethodControl { private readonly X11Window _parent; - private bool _controlActive, _windowActive, _imeActive; + private bool _windowActive, _imeActive; private Rect? _queuedCursorRect; private ITextInputMethodClient? _client; @@ -70,7 +70,7 @@ namespace Avalonia.X11 private void UpdateActive() { - var active = _windowActive && _controlActive; + var active = _windowActive && IsActive; if(_parent._xic == IntPtr.Zero) return; if (active != _imeActive) From 6189f52c1f5ae6e887b46b9f0a879d7a0bc9a2a2 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Wed, 25 Jan 2023 18:20:55 +0100 Subject: [PATCH 3/3] fix: GpuInterop Build --- samples/GpuInterop/D3DDemo/D3D11DemoControl.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/GpuInterop/D3DDemo/D3D11DemoControl.cs b/samples/GpuInterop/D3DDemo/D3D11DemoControl.cs index c7ee2bb9a4..8b1347e1d8 100644 --- a/samples/GpuInterop/D3DDemo/D3D11DemoControl.cs +++ b/samples/GpuInterop/D3DDemo/D3D11DemoControl.cs @@ -2,21 +2,17 @@ using System; using System.Diagnostics; using System.Linq; using System.Numerics; -using System.Threading.Tasks; using Avalonia; using Avalonia.Platform; using Avalonia.Rendering.Composition; using SharpDX; -using SharpDX.Direct2D1; using SharpDX.Direct3D11; using SharpDX.DXGI; using SharpDX.Mathematics.Interop; using Buffer = SharpDX.Direct3D11.Buffer; -using DeviceContext = SharpDX.Direct2D1.DeviceContext; using DxgiFactory1 = SharpDX.DXGI.Factory1; using Matrix = SharpDX.Matrix; using D3DDevice = SharpDX.Direct3D11.Device; -using DxgiResource = SharpDX.DXGI.Resource; using FeatureLevel = SharpDX.Direct3D.FeatureLevel; using Vector3 = SharpDX.Vector3; @@ -80,7 +76,10 @@ public class D3D11DemoControl : DrawingSurfaceDemoBase if (pixelSize == default) return; if (pixelSize != _lastSize) + { + _lastSize = pixelSize; Resize(pixelSize); + } using (_swapchain.BeginDraw(pixelSize, out var renderView)) {