From eb4605cf17d0fe3538c202db47f785717ca067d3 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 27 Sep 2022 08:19:26 +0100 Subject: [PATCH] fix some compile warnings. --- src/Web/Avalonia.Web/AvaloniaView.cs | 6 ++---- src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs | 1 + src/Web/Avalonia.Web/BrowserTopLevelImpl.cs | 1 + src/Web/Avalonia.Web/Interop/CanvasHelper.cs | 1 + src/Web/Avalonia.Web/Storage/WriteableStream.cs | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Web/Avalonia.Web/AvaloniaView.cs b/src/Web/Avalonia.Web/AvaloniaView.cs index ad45c6a5a2..73da939110 100644 --- a/src/Web/Avalonia.Web/AvaloniaView.cs +++ b/src/Web/Avalonia.Web/AvaloniaView.cs @@ -13,6 +13,7 @@ using SkiaSharp; namespace Avalonia.Web { + [System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings public partial class AvaloniaView : ITextInputMethodImpl { private readonly BrowserTopLevelImpl _topLevelImpl; @@ -31,8 +32,7 @@ namespace Avalonia.Web private GRGlInterface? _glInterface; private const SKColorType ColorType = SKColorType.Rgba8888; - private bool _useGL; - private bool _inputElementFocused; + private bool _useGL; private ITextInputMethodClient? _client; private static int _canvasCount; @@ -399,7 +399,6 @@ namespace Avalonia.Web if (_client != null) { InputHelper.ShowElement(_inputElement); - _inputElementFocused = true; InputHelper.FocusElement(_inputElement); var surroundingText = _client.SurroundingText; @@ -410,7 +409,6 @@ namespace Avalonia.Web } else { - _inputElementFocused = false; HideIme(); } } diff --git a/src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs b/src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs index e50c11acd6..02d9b01319 100644 --- a/src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs +++ b/src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs @@ -6,6 +6,7 @@ using Avalonia.Media; namespace Avalonia.Web { + [System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings public class BrowserSingleViewLifetime : ISingleViewApplicationLifetime { public AvaloniaView? View; diff --git a/src/Web/Avalonia.Web/BrowserTopLevelImpl.cs b/src/Web/Avalonia.Web/BrowserTopLevelImpl.cs index c514101d53..047b462a64 100644 --- a/src/Web/Avalonia.Web/BrowserTopLevelImpl.cs +++ b/src/Web/Avalonia.Web/BrowserTopLevelImpl.cs @@ -16,6 +16,7 @@ using Avalonia.Rendering.Composition; namespace Avalonia.Web { + [System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings internal class BrowserTopLevelImpl : ITopLevelImplWithTextInputMethod, ITopLevelImplWithNativeControlHost, ITopLevelImplWithStorageProvider { private Size _clientSize; diff --git a/src/Web/Avalonia.Web/Interop/CanvasHelper.cs b/src/Web/Avalonia.Web/Interop/CanvasHelper.cs index 1e93d11c34..66a1d421b7 100644 --- a/src/Web/Avalonia.Web/Interop/CanvasHelper.cs +++ b/src/Web/Avalonia.Web/Interop/CanvasHelper.cs @@ -6,6 +6,7 @@ namespace Avalonia.Web.Interop; internal record GLInfo(int ContextId, uint FboId, int Stencils, int Samples, int Depth); +[System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings internal static partial class CanvasHelper { diff --git a/src/Web/Avalonia.Web/Storage/WriteableStream.cs b/src/Web/Avalonia.Web/Storage/WriteableStream.cs index 4dce5a4c6c..100b7ccfed 100644 --- a/src/Web/Avalonia.Web/Storage/WriteableStream.cs +++ b/src/Web/Avalonia.Web/Storage/WriteableStream.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; namespace Avalonia.Web.Storage; +[System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings // Loose wrapper implementaion of a stream on top of FileAPI FileSystemWritableFileStream internal sealed class JSWriteableStream : Stream {