Skip to content

Commit 9902e8f

Browse files
authored
dependencies: update to Avalonia 11.0.4 (#1383)
Update from Avalonia 11.0.0-preview6 to 11.0.4 and fix the codes using APIs removed since 11.0.0 release.
2 parents e076f58 + cd0a34c commit 9902e8f

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

src/shared/Core/Core.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
<Reference Include="System.Net.Http" />
1515
<Reference Include="System.Web" />
1616
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.54.0" />
17-
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview6" />
17+
<PackageReference Include="Avalonia.Win32" Version="11.0.4" />
1818
</ItemGroup>
1919

2020
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
21-
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
21+
<PackageReference Include="Avalonia.Desktop" Version="11.0.4" />
2222
</ItemGroup>
2323

2424
<ItemGroup>
2525
<PackageReference Include="Microsoft.Identity.Client" Version="4.54.0" />
2626
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.28.0" />
2727
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
28-
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
29-
<PackageReference Include="Avalonia.Skia" Version="11.0.0-preview6" />
30-
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview6" />
28+
<PackageReference Include="Avalonia" Version="11.0.4" />
29+
<PackageReference Include="Avalonia.Skia" Version="11.0.4" />
30+
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
3131
</ItemGroup>
3232

3333
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
34-
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
34+
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.4" />
3535
</ItemGroup>
3636

3737
</Project>

src/shared/Core/UI/AvaloniaUi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ private static void SetParentExternal(Window window, IntPtr parentHandle)
124124
return;
125125
}
126126

127-
IntPtr ourHandle = window.PlatformImpl.Handle.Handle;
127+
IntPtr ourHandle = window.TryGetPlatformHandle()!.Handle;
128128

129129
// Get the desktop scaling factor from our window instance so we
130130
// can calculate rects correctly for both our window, and the parent window.
131-
double scaling = window.PlatformImpl.DesktopScaling;
131+
double scaling = window.RenderScaling;
132132

133133
// Get our window rect
134134
var ourRect = new PixelRect(

src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Avalonia.Controls;
66
using Avalonia.Data;
77
using Avalonia.Input;
8-
using Avalonia.Input.Platform;
98
using Avalonia.Interactivity;
109
using Avalonia.Markup.Xaml;
1110
using GitCredentialManager;
@@ -22,8 +21,6 @@ public partial class SixDigitInput : UserControl, IFocusable
2221
(o, v) => o.Text = v,
2322
defaultBindingMode: BindingMode.TwoWay);
2423

25-
private PlatformHotkeyConfiguration _keyMap;
26-
private IClipboard _clipboard;
2724
private bool _ignoreTextBoxUpdate;
2825
private TextBox[] _textBoxes;
2926
private string _text;
@@ -37,8 +34,6 @@ private void InitializeComponent()
3734
{
3835
AvaloniaXamlLoader.Load(this);
3936

40-
_keyMap = AvaloniaLocator.Current.GetService<PlatformHotkeyConfiguration>();
41-
_clipboard = AvaloniaLocator.Current.GetService<IClipboard>();
4237
_textBoxes = new[]
4338
{
4439
this.FindControl<TextBox>("one"),
@@ -89,7 +84,7 @@ public void SetFocus()
8984
{
9085
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
9186
if (!PlatformUtils.IsMacOS())
92-
KeyboardDevice.Instance.SetFocusedElement(_textBoxes[0], NavigationMethod.Tab, KeyModifiers.None);
87+
_textBoxes[0].Focus(NavigationMethod.Tab, KeyModifiers.None);
9388
}
9489

9590
private void SetUpTextBox(TextBox textBox)
@@ -99,7 +94,7 @@ private void SetUpTextBox(TextBox textBox)
9994
void OnPreviewKeyDown(object sender, KeyEventArgs e)
10095
{
10196
// Handle paste
102-
if (_keyMap.Paste.Any(x => x.Matches(e)))
97+
if (TopLevel.GetTopLevel(this)?.PlatformSettings?.HotkeyConfiguration.Paste.Any(x => x.Matches(e)) ?? false)
10398
{
10499
OnPaste();
105100
e.Handled = true;
@@ -166,8 +161,7 @@ void OnPreviewKeyDown(object sender, KeyEventArgs e)
166161

167162
private void OnPaste()
168163
{
169-
string text = _clipboard.GetTextAsync().GetAwaiter().GetResult();
170-
Text = text;
164+
Text = TopLevel.GetTopLevel(this)?.Clipboard?.GetTextAsync().GetAwaiter().GetResult();
171165
}
172166

173167
private bool MoveNext() => MoveFocus(true);
@@ -177,7 +171,7 @@ private void OnPaste()
177171
private bool MoveFocus(bool next)
178172
{
179173
// Get currently focused text box
180-
if (FocusManager.Instance.Current is TextBox textBox)
174+
if (TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() is TextBox textBox)
181175
{
182176
int textBoxIndex = Array.IndexOf(_textBoxes, textBox);
183177
if (textBoxIndex > -1)
@@ -186,7 +180,7 @@ private bool MoveFocus(bool next)
186180
? Math.Min(_textBoxes.Length - 1, textBoxIndex + 1)
187181
: Math.Max(0, textBoxIndex - 1);
188182

189-
KeyboardDevice.Instance.SetFocusedElement(_textBoxes[nextIndex], NavigationMethod.Tab, KeyModifiers.None);
183+
_textBoxes[nextIndex].Focus(NavigationMethod.Tab, KeyModifiers.None);
190184
return true;
191185
}
192186
}

src/shared/GitHub/UI/Views/SelectAccountView.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</StackPanel>
4444

4545
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
46-
<ListBox Items="{Binding Accounts}"
46+
<ListBox ItemsSource="{Binding Accounts}"
4747
SelectedItem="{Binding SelectedAccount}"
4848
Margin="20,0,20,10"
4949
MaxHeight="200"

0 commit comments

Comments
 (0)