mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Merge pull request #423 from lances101/bugfix-271-positioning
Bugfix #271 positioning
This commit is contained in:
@@ -260,34 +260,21 @@ namespace Wox
|
||||
|
||||
private double GetWindowsLeft()
|
||||
{
|
||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
if (UserSettingStorage.Instance.RememberLastLaunchLocation)
|
||||
{
|
||||
var origScreen = Screen.FromRectangle(new Rectangle((int)Left, (int)Top, (int)ActualWidth, (int)ActualHeight));
|
||||
var coordX = (Left - origScreen.WorkingArea.Left) / (origScreen.WorkingArea.Width - ActualWidth);
|
||||
UserSettingStorage.Instance.WindowLeft = (screen.WorkingArea.Width - ActualWidth) * coordX + screen.WorkingArea.Left;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserSettingStorage.Instance.WindowLeft = (screen.WorkingArea.Width - ActualWidth) / 2 + screen.WorkingArea.Left;
|
||||
}
|
||||
if (UserSettingStorage.Instance.RememberLastLaunchLocation) return UserSettingStorage.Instance.WindowLeft;
|
||||
|
||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var dipPoint = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0);
|
||||
UserSettingStorage.Instance.WindowLeft = (dipPoint.X - ActualWidth)/2;
|
||||
return UserSettingStorage.Instance.WindowLeft;
|
||||
}
|
||||
|
||||
private double GetWindowsTop()
|
||||
{
|
||||
if (UserSettingStorage.Instance.RememberLastLaunchLocation) return UserSettingStorage.Instance.WindowTop;
|
||||
|
||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
if (UserSettingStorage.Instance.RememberLastLaunchLocation)
|
||||
{
|
||||
var origScreen = Screen.FromRectangle(new Rectangle((int)Left, (int)Top, (int)ActualWidth, (int)ActualHeight));
|
||||
var coordY = (Top - origScreen.WorkingArea.Top) / (origScreen.WorkingArea.Height - ActualHeight);
|
||||
UserSettingStorage.Instance.WindowTop = (screen.WorkingArea.Height - ActualHeight) * coordY + screen.WorkingArea.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserSettingStorage.Instance.WindowTop = (screen.WorkingArea.Height - tbQuery.ActualHeight) / 4 + screen.WorkingArea.Top;
|
||||
}
|
||||
var dipPoint = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height);
|
||||
UserSettingStorage.Instance.WindowTop = (dipPoint.Y - tbQuery.ActualHeight)/4;
|
||||
return UserSettingStorage.Instance.WindowTop;
|
||||
}
|
||||
|
||||
@@ -534,6 +521,8 @@ namespace Wox
|
||||
|
||||
private void HideWox()
|
||||
{
|
||||
UserSettingStorage.Instance.WindowLeft = Left;
|
||||
UserSettingStorage.Instance.WindowTop = Top;
|
||||
if (IsInContextMenuMode)
|
||||
{
|
||||
BackToResultMode();
|
||||
|
||||
Reference in New Issue
Block a user