Browse Source

Merge pull request #9991 from workgroupengineering/features/Analyzers/CS0649

feat: Enable Rule CS0649
pull/10104/head
Max Katz 3 years ago
committed by GitHub
parent
commit
b57fef4559
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .editorconfig
  2. 7
      samples/GpuInterop/D3DDemo/D3D11DemoControl.cs
  3. 4
      src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs
  4. 4
      src/Avalonia.X11/X11Window.Xim.cs

3
.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

7
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))
{

4
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;

4
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)

Loading…
Cancel
Save