WindowPlacement struct name

This commit is contained in:
glax 2024-04-15 22:06:55 +02:00
parent c445cbb6af
commit 1b83eea25f
3 changed files with 7 additions and 7 deletions

View File

@ -5,11 +5,11 @@ namespace OBSBlur.Window;
public struct WindowInfo public struct WindowInfo
{ {
internal IntPtr WindowHandle { get; init; } internal IntPtr WindowHandle { get; init; }
public WINDOWPLACEMENT WindowPlacement { get; init; } public WindowPlacement WindowPlacement { get; init; }
public string WindowTitle { get; init; } public string WindowTitle { get; init; }
public Process ProcessInfo { get; init; } public Process ProcessInfo { get; init; }
public WindowInfo(IntPtr windowHandle, string windowTitle, Process processInfo, WINDOWPLACEMENT windowPlacement) public WindowInfo(IntPtr windowHandle, string windowTitle, Process processInfo, WindowPlacement windowPlacement)
{ {
this.WindowHandle = windowHandle; this.WindowHandle = windowHandle;
this.ProcessInfo = processInfo; this.ProcessInfo = processInfo;

View File

@ -25,7 +25,7 @@ public class WindowManager : IDisposable
private bool GetWindowInfo(IntPtr windowHandle, IntPtr lParam) private bool GetWindowInfo(IntPtr windowHandle, IntPtr lParam)
{ {
WINDOWPLACEMENT windowPlacement = new (); WindowPlacement windowPlacement = new ();
GetWindowPlacement(windowHandle, ref windowPlacement); GetWindowPlacement(windowHandle, ref windowPlacement);
Rectangle n = windowPlacement.NormalPosition; Rectangle n = windowPlacement.NormalPosition;
//Do not add if Window is not a drawable //Do not add if Window is not a drawable
@ -55,7 +55,7 @@ public class WindowManager : IDisposable
[DllImport("user32.dll")] [DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowPlacement(IntPtr windowHandle, ref WINDOWPLACEMENT lpwndpl); public static extern bool GetWindowPlacement(IntPtr windowHandle, ref WindowPlacement lpwndpl);
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern uint GetWindowThreadProcessId(IntPtr windowHandle, out uint lpdwProcessId); private static extern uint GetWindowThreadProcessId(IntPtr windowHandle, out uint lpdwProcessId);

View File

@ -7,7 +7,7 @@ namespace OBSBlur.Window;
/// </summary> /// </summary>
[Serializable] [Serializable]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct WINDOWPLACEMENT public struct WindowPlacement
{ {
/// <summary> /// <summary>
/// The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT). /// The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT).
@ -45,11 +45,11 @@ public struct WINDOWPLACEMENT
/// <summary> /// <summary>
/// Gets the default (empty) value. /// Gets the default (empty) value.
/// </summary> /// </summary>
public static WINDOWPLACEMENT Default public static WindowPlacement Default
{ {
get get
{ {
WINDOWPLACEMENT result = new WINDOWPLACEMENT(); WindowPlacement result = new WindowPlacement();
result.Length = Marshal.SizeOf( result ); result.Length = Marshal.SizeOf( result );
return result; return result;
} }