From b5321df7f1afa793f25d95fbb98cc0fc0eccd19a Mon Sep 17 00:00:00 2001 From: glax Date: Tue, 16 Apr 2024 20:58:41 +0200 Subject: [PATCH] Remove unnecessary variable --- OBSBlur/OBS/Blur.cs | 2 +- OBSBlur/Window/WindowInfo.cs | 9 +++------ OBSBlur/Window/WindowManager.cs | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/OBSBlur/OBS/Blur.cs b/OBSBlur/OBS/Blur.cs index fda55b7..7ba12c1 100644 --- a/OBSBlur/OBS/Blur.cs +++ b/OBSBlur/OBS/Blur.cs @@ -206,7 +206,7 @@ public class Blur { uint i = 0; - string prnt = $"Z-order changed\n{"Z",3} | {"hWnd",8} | {"PID",8} | {"Name",17} | {"Window Title",-17} | {"Vis",-8} | {"State",-13} | BBox\n"; + string prnt = $"Z-order changed\n{"Z",3} | {"hWnd",8} | {"PID",8} | {"Name",17} | {"Window Title",-17} | {"State",-13} | BBox\n"; foreach (IntPtr windowHandle in neworder) { WindowInfo windowInfo = _windowManager.WindowInfos.FirstOrDefault(w => w.WindowHandle == windowHandle); diff --git a/OBSBlur/Window/WindowInfo.cs b/OBSBlur/Window/WindowInfo.cs index 4ff27c9..a993f51 100644 --- a/OBSBlur/Window/WindowInfo.cs +++ b/OBSBlur/Window/WindowInfo.cs @@ -5,17 +5,15 @@ namespace OBSBlur.Window; public struct WindowInfo { internal IntPtr WindowHandle { get; init; } - public bool IsVisible { get; init; } public ShowWindowCommands WindowCommands { get; init; } public Rectangle WindowRectangle { get; init; } public string WindowTitle { get; init; } public Process ProcessInfo { get; init; } - public WindowInfo(IntPtr windowHandle, string windowTitle, Process processInfo, bool isWindowVisible, ShowWindowCommands windowCommands, Rectangle windowRectangle) + public WindowInfo(IntPtr windowHandle, string windowTitle, Process processInfo, ShowWindowCommands windowCommands, Rectangle windowRectangle) { this.WindowHandle = windowHandle; this.ProcessInfo = processInfo; - this.IsVisible = isWindowVisible; this.WindowCommands = windowCommands; this.WindowRectangle = windowRectangle; this.WindowTitle = windowTitle; @@ -29,7 +27,6 @@ public struct WindowInfo public bool Equals(WindowInfo other) { return WindowHandle == other.WindowHandle && - IsVisible == other.IsVisible && WindowCommands == other.WindowCommands && WindowRectangle == other.WindowRectangle && WindowTitle.Equals(other.WindowTitle) && @@ -39,7 +36,7 @@ public struct WindowInfo public override int GetHashCode() { - return HashCode.Combine(WindowHandle, IsVisible, WindowTitle, ProcessInfo); + return HashCode.Combine(WindowHandle, WindowTitle, ProcessInfo); } public override string ToString() @@ -47,6 +44,6 @@ public struct WindowInfo const int cutoffStr = 17; string processNameStr = ProcessInfo.ProcessName.Substring(0, Math.Min(cutoffStr, ProcessInfo.ProcessName.Length)); string windowTitleStr = WindowTitle.Substring(0, Math.Min(cutoffStr, WindowTitle.Length)); - return $"{WindowHandle,8} | {ProcessInfo.Id,8} | {processNameStr,cutoffStr} | {windowTitleStr,-cutoffStr} | {(IsVisible ? "visible" : "hidden"),-8} | {WindowCommands,-13} | {WindowRectangle}"; + return $"{WindowHandle,8} | {ProcessInfo.Id,8} | {processNameStr,cutoffStr} | {windowTitleStr,-cutoffStr} | {WindowCommands,-13} | {WindowRectangle}"; } } \ No newline at end of file diff --git a/OBSBlur/Window/WindowManager.cs b/OBSBlur/Window/WindowManager.cs index 5dc6156..2557a83 100644 --- a/OBSBlur/Window/WindowManager.cs +++ b/OBSBlur/Window/WindowManager.cs @@ -80,7 +80,7 @@ public partial class WindowManager : IDisposable Rectangle rect; GetWindowRect(windowHandle, out rect); - _windows.Add(new WindowInfo(windowHandle, windowTitle, processInfo, isVisible, placement.ShowCmd, rect)); + _windows.Add(new WindowInfo(windowHandle, windowTitle, processInfo, placement.ShowCmd, rect)); return true; }