mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
[Quick Accent] fix showing toolbar in the corner position (#22736)
* [Quick Accent] fix showing toolbar in the corner position * [Quick Accent] set horizontal allignment according to toolbar position * [Quick Accent] fix spelling mistake
This commit is contained in:
@@ -285,6 +285,11 @@ public class PowerAccent : IDisposable
|
|||||||
return Calculation.GetRawCoordinatesFromPosition(position, screen, window);
|
return Calculation.GetRawCoordinatesFromPosition(position, screen, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Position GetToolbarPosition()
|
||||||
|
{
|
||||||
|
return _settingService.Position;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_keyboardListener.UnInitHook();
|
_keyboardListener.UnInitHook();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Border
|
<Border
|
||||||
|
x:Name="gridBorder"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Background="{DynamicResource SecondaryBackgroundBrush}"
|
Background="{DynamicResource SecondaryBackgroundBrush}"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Unicode;
|
using System.Unicode;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using PowerAccent.Core.Services;
|
||||||
using PowerToys.PowerAccentKeyboardService;
|
using PowerToys.PowerAccentKeyboardService;
|
||||||
using Point = PowerAccent.Core.Point;
|
using Point = PowerAccent.Core.Point;
|
||||||
using Size = PowerAccent.Core.Size;
|
using Size = PowerAccent.Core.Size;
|
||||||
@@ -69,6 +70,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
|||||||
characters.SelectedIndex = 0;
|
characters.SelectedIndex = 0;
|
||||||
this.UpdateLayout(); // Required for filling the actual width/height before positioning.
|
this.UpdateLayout(); // Required for filling the actual width/height before positioning.
|
||||||
SetWindowPosition();
|
SetWindowPosition();
|
||||||
|
SetWindowAlignment();
|
||||||
Show();
|
Show();
|
||||||
Microsoft.PowerToys.Telemetry.PowerToysTelemetry.Log.WriteEvent(new PowerAccent.Core.Telemetry.PowerAccentShowAccentMenuEvent());
|
Microsoft.PowerToys.Telemetry.PowerToysTelemetry.Log.WriteEvent(new PowerAccent.Core.Telemetry.PowerAccentShowAccentMenuEvent());
|
||||||
}
|
}
|
||||||
@@ -91,6 +93,17 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
|||||||
this.Top = position.Y;
|
this.Top = position.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetWindowAlignment()
|
||||||
|
{
|
||||||
|
gridBorder.HorizontalAlignment = _powerAccent.GetToolbarPosition() switch
|
||||||
|
{
|
||||||
|
Position.Left or Position.TopLeft or Position.BottomLeft => HorizontalAlignment.Left,
|
||||||
|
Position.Right or Position.TopRight or Position.BottomRight => HorizontalAlignment.Right,
|
||||||
|
Position.Center or Position.Top or Position.Bottom => HorizontalAlignment.Center,
|
||||||
|
_ => HorizontalAlignment.Center
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
protected override void OnClosed(EventArgs e)
|
||||||
{
|
{
|
||||||
_powerAccent.Dispose();
|
_powerAccent.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user