mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[QuickAccent]Fix positioning on scaled desktop (#21200)
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<CsWinRTIncludes>PowerToys.PowerAccentKeyboardService</CsWinRTIncludes>
|
<CsWinRTIncludes>PowerToys.PowerAccentKeyboardService</CsWinRTIncludes>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class PowerAccent : IDisposable
|
|||||||
{
|
{
|
||||||
_keyboardListener.SetShowToolbarEvent(new PowerToys.PowerAccentKeyboardService.ShowToolbar((LetterKey letterKey) =>
|
_keyboardListener.SetShowToolbarEvent(new PowerToys.PowerAccentKeyboardService.ShowToolbar((LetterKey letterKey) =>
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
ShowToolbar(letterKey);
|
ShowToolbar(letterKey);
|
||||||
});
|
});
|
||||||
@@ -44,7 +44,7 @@ public class PowerAccent : IDisposable
|
|||||||
|
|
||||||
_keyboardListener.SetHideToolbarEvent(new PowerToys.PowerAccentKeyboardService.HideToolbar((InputType inputType) =>
|
_keyboardListener.SetHideToolbarEvent(new PowerToys.PowerAccentKeyboardService.HideToolbar((InputType inputType) =>
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
SendInputAndHideToolbar(inputType);
|
SendInputAndHideToolbar(inputType);
|
||||||
});
|
});
|
||||||
@@ -52,7 +52,7 @@ public class PowerAccent : IDisposable
|
|||||||
|
|
||||||
_keyboardListener.SetNextCharEvent(new PowerToys.PowerAccentKeyboardService.NextChar((TriggerKey triggerKey) =>
|
_keyboardListener.SetNextCharEvent(new PowerToys.PowerAccentKeyboardService.NextChar((TriggerKey triggerKey) =>
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
ProcessNextChar(triggerKey);
|
ProcessNextChar(triggerKey);
|
||||||
});
|
});
|
||||||
@@ -176,7 +176,8 @@ public class PowerAccent : IDisposable
|
|||||||
public Point GetDisplayCoordinates(Size window)
|
public Point GetDisplayCoordinates(Size window)
|
||||||
{
|
{
|
||||||
(Point Location, Size Size, double Dpi) activeDisplay = WindowsFunctions.GetActiveDisplay();
|
(Point Location, Size Size, double Dpi) activeDisplay = WindowsFunctions.GetActiveDisplay();
|
||||||
Rect screen = new Rect(activeDisplay.Location, activeDisplay.Size) / activeDisplay.Dpi;
|
double primaryDPI = Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth;
|
||||||
|
Rect screen = new Rect(activeDisplay.Location, activeDisplay.Size) / primaryDPI;
|
||||||
Position position = _settingService.Position;
|
Position position = _settingService.Position;
|
||||||
|
|
||||||
/* Debug.WriteLine("Dpi: " + activeDisplay.Dpi); */
|
/* Debug.WriteLine("Dpi: " + activeDisplay.Dpi); */
|
||||||
|
|||||||
Reference in New Issue
Block a user