Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat(domain): add `WindowService` method for getting placement information of a handle

Lars Berger30fe8332b153
diff --git a/GlazeWM.Domain/Windows/WindowService.cs b/GlazeWM.Domain/Windows/WindowService.cs
index 224a4731..697e1ae5 100644
--- a/GlazeWM.Domain/Windows/WindowService.cs
+++ b/GlazeWM.Domain/Windows/WindowService.cs
@@ -66,17 +66,27 @@ namespace GlazeWM.Domain.Windows
/// </summary>
public WindowRect GetLocationOfHandle(IntPtr handle)
{
- WindowRect rect = new WindowRect();
+ var rect = new WindowRect();
GetWindowRect(handle, ref rect);
return rect;
}
+ /// <summary>
+ /// Get info about the placement of the specified window.
+ /// </summary>
+ public WindowPlacement GetPlacementOfHandle(IntPtr handle)
+ {
+ var windowPlacement = new WindowPlacement();
+ GetWindowPlacement(handle, ref windowPlacement);
+ return windowPlacement;
+ }
+
/// <summary>
/// Get title bar text of the specified window.
/// </summary>
public string GetTitleOfHandle(IntPtr handle)
{
- int titleLength = GetWindowTextLength(handle);
+ var titleLength = GetWindowTextLength(handle);
if (titleLength == 0)
return String.Empty;