From 51b89aac0f694d8368fbe9a2e1ed47022a892e0c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2024 01:10:20 +0000 Subject: [PATCH] Automated JetBrains cleanup Co-authored-by: <+@users.noreply.github.com> --- .../Infrastructure/ConsoleWindow.cs | 28 +++++++++---------- .../Infrastructure/DefaultNetConsole.cs | 4 +-- .../Infrastructure/IConsole.cs | 1 + .../CursesConsole.cs | 4 +-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs index 627e0471..c8363f00 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs @@ -23,6 +23,8 @@ namespace Consolonia.Core.Infrastructure { public class ConsoleWindow : IWindowImpl { + private readonly bool _accessKeysAlwaysOn; + private readonly IDisposable _accessKeysAlwaysOnDisposable; private readonly IKeyboardDevice _myKeyboardDevice; private readonly TimeSpan _resizeDelay = TimeSpan.FromMilliseconds(100); [NotNull] internal readonly IConsole Console; @@ -30,9 +32,6 @@ public class ConsoleWindow : IWindowImpl private IInputRoot _inputRoot; private CancellationTokenSource _resizeCancellationTokenSource; - private bool _accessKeysAlwaysOn; - private IDisposable _accessKeysAlwaysOnDisposable; - public ConsoleWindow() { _myKeyboardDevice = AvaloniaLocator.Current.GetService(); @@ -45,16 +44,9 @@ public ConsoleWindow() Handle = null!; PixelBuffer = new PixelBuffer(Console.Size); _accessKeysAlwaysOn = !Console.SupportsAltSolo; - if(_accessKeysAlwaysOn) - _accessKeysAlwaysOnDisposable = AccessText.ShowAccessKeyProperty.Changed.SubscribeAction(OnShowAccessKeyPropertyChanged); - } - - private void OnShowAccessKeyPropertyChanged(AvaloniaPropertyChangedEventArgs args) - { - if (args.Sender != _inputRoot) return; - if (args.GetNewValue()) return; - - _inputRoot.ShowAccessKeys = true; + if (_accessKeysAlwaysOn) + _accessKeysAlwaysOnDisposable = + AccessText.ShowAccessKeyProperty.Changed.SubscribeAction(OnShowAccessKeyPropertyChanged); } public PixelBuffer PixelBuffer { get; set; } @@ -65,7 +57,7 @@ private void OnShowAccessKeyPropertyChanged(AvaloniaPropertyChangedEventArgs args) + { + if (args.Sender != _inputRoot) return; + if (args.GetNewValue()) return; + + _inputRoot.ShowAccessKeys = true; + } + private void ConsoleOnMouseEvent(RawPointerEventType type, Point point, Vector? wheelDelta, RawInputModifiers modifiers) { diff --git a/src/Consolonia.Core/Infrastructure/DefaultNetConsole.cs b/src/Consolonia.Core/Infrastructure/DefaultNetConsole.cs index 667e0068..3437cd57 100644 --- a/src/Consolonia.Core/Infrastructure/DefaultNetConsole.cs +++ b/src/Consolonia.Core/Infrastructure/DefaultNetConsole.cs @@ -47,14 +47,14 @@ public DefaultNetConsole() StartInputReading(); } + public override bool SupportsAltSolo => false; + protected override void Dispose(bool disposing) { base.Dispose(disposing); RaiseFocusEvent(false); } - public override bool SupportsAltSolo => false; - public override void PauseIO(Task task) { base.PauseIO(task); diff --git a/src/Consolonia.Core/Infrastructure/IConsole.cs b/src/Consolonia.Core/Infrastructure/IConsole.cs index fa67fb1f..d4975340 100644 --- a/src/Consolonia.Core/Infrastructure/IConsole.cs +++ b/src/Consolonia.Core/Infrastructure/IConsole.cs @@ -20,6 +20,7 @@ public interface IConsole : IDisposable /// This is true if console supports composing multiple emojis together (like: ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ). /// bool SupportsComplexEmoji { get; } + bool SupportsAltSolo { get; } void SetTitle(string title); diff --git a/src/Consolonia.PlatformSupport/CursesConsole.cs b/src/Consolonia.PlatformSupport/CursesConsole.cs index 80a0204a..74aee766 100644 --- a/src/Consolonia.PlatformSupport/CursesConsole.cs +++ b/src/Consolonia.PlatformSupport/CursesConsole.cs @@ -115,6 +115,8 @@ public CursesConsole() StartEventLoop(); } + public override bool SupportsAltSolo => false; + private void StartEventLoop() { //todo: cleanup @@ -140,8 +142,6 @@ private void StartEventLoop() }); } - public override bool SupportsAltSolo => false; - public override void PauseIO(Task task) { base.PauseIO(task);