-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Settings]restore window size and position (#13912)
- Loading branch information
1 parent
5910836
commit db90802
Showing
6 changed files
with
185 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/settings-ui/PowerToys.Settings/Helpers/NativeMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace PowerToys.Settings.Helpers | ||
{ | ||
public static class NativeMethods | ||
{ | ||
internal const int SW_SHOWNORMAL = 1; | ||
internal const int SW_SHOWMAXIMIZED = 3; | ||
|
||
[DllImport("user32.dll")] | ||
internal static extern bool SetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl); | ||
|
||
[DllImport("user32.dll")] | ||
internal static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace PowerToys.Settings.Helpers | ||
{ | ||
[Serializable] | ||
[StructLayout(LayoutKind.Sequential)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")] | ||
public struct POINT | ||
{ | ||
public int X { get; set; } | ||
|
||
public int Y { get; set; } | ||
|
||
public POINT(int x, int y) | ||
{ | ||
X = x; | ||
Y = y; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace PowerToys.Settings.Helpers | ||
{ | ||
[Serializable] | ||
[StructLayout(LayoutKind.Sequential)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")] | ||
public struct RECT | ||
{ | ||
public int Left { get; set; } | ||
|
||
public int Top { get; set; } | ||
|
||
public int Right { get; set; } | ||
|
||
public int Bottom { get; set; } | ||
|
||
public RECT(int left, int top, int right, int bottom) | ||
{ | ||
Left = left; | ||
Top = top; | ||
Right = right; | ||
Bottom = bottom; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/settings-ui/PowerToys.Settings/Helpers/WINDOWPLACEMENT.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace PowerToys.Settings.Helpers | ||
{ | ||
[Serializable] | ||
[StructLayout(LayoutKind.Sequential)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")] | ||
public struct WINDOWPLACEMENT | ||
{ | ||
public int Length { get; set; } | ||
|
||
public int Flags { get; set; } | ||
|
||
public int ShowCmd { get; set; } | ||
|
||
public POINT MinPosition { get; set; } | ||
|
||
public POINT MaxPosition { get; set; } | ||
|
||
public RECT NormalPosition { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters