Skip to content

Commit

Permalink
Automated JetBrains cleanup
Browse files Browse the repository at this point in the history
Co-authored-by:  <[email protected]>
  • Loading branch information
github-actions[bot] committed Dec 15, 2024
1 parent d2db200 commit 51b89aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
28 changes: 14 additions & 14 deletions src/Consolonia.Core/Infrastructure/ConsoleWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ 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;
private bool _disposedValue;
private IInputRoot _inputRoot;
private CancellationTokenSource _resizeCancellationTokenSource;

private bool _accessKeysAlwaysOn;
private IDisposable _accessKeysAlwaysOnDisposable;

public ConsoleWindow()
{
_myKeyboardDevice = AvaloniaLocator.Current.GetService<IKeyboardDevice>();
Expand All @@ -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<bool> args)
{
if (args.Sender != _inputRoot) return;
if (args.GetNewValue<bool>()) return;

_inputRoot.ShowAccessKeys = true;
if (_accessKeysAlwaysOn)
_accessKeysAlwaysOnDisposable =
AccessText.ShowAccessKeyProperty.Changed.SubscribeAction(OnShowAccessKeyPropertyChanged);
}

public PixelBuffer PixelBuffer { get; set; }
Expand All @@ -65,7 +57,7 @@ private void OnShowAccessKeyPropertyChanged(AvaloniaPropertyChangedEventArgs<boo
public void SetInputRoot(IInputRoot inputRoot)
{
_inputRoot = inputRoot;
if(_accessKeysAlwaysOn)
if (_accessKeysAlwaysOn)
_inputRoot.ShowAccessKeys = true;
}

Expand Down Expand Up @@ -314,6 +306,14 @@ public void Dispose()
GC.SuppressFinalize(this);
}

private void OnShowAccessKeyPropertyChanged(AvaloniaPropertyChangedEventArgs<bool> args)
{
if (args.Sender != _inputRoot) return;
if (args.GetNewValue<bool>()) return;

_inputRoot.ShowAccessKeys = true;
}

private void ConsoleOnMouseEvent(RawPointerEventType type, Point point, Vector? wheelDelta,
RawInputModifiers modifiers)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Consolonia.Core/Infrastructure/DefaultNetConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Infrastructure/IConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public interface IConsole : IDisposable
/// This is true if console supports composing multiple emojis together (like: 👨‍👩‍👧‍👦).
/// </summary>
bool SupportsComplexEmoji { get; }

bool SupportsAltSolo { get; }

void SetTitle(string title);
Expand Down
4 changes: 2 additions & 2 deletions src/Consolonia.PlatformSupport/CursesConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public CursesConsole()
StartEventLoop();
}

public override bool SupportsAltSolo => false;

private void StartEventLoop()
{
//todo: cleanup
Expand All @@ -140,8 +142,6 @@ private void StartEventLoop()
});
}

public override bool SupportsAltSolo => false;

public override void PauseIO(Task task)
{
base.PauseIO(task);
Expand Down

0 comments on commit 51b89aa

Please sign in to comment.