GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: added method to WindowsApiFacade for getting location of window
Larsf7c07ed81200
diff --git a/LarsWM/WindowsApi/WindowsApiFacade.cs b/LarsWM/WindowsApi/WindowsApiFacade.csindex 8083bdf5..99db4920 100644--- a/LarsWM/WindowsApi/WindowsApiFacade.cs+++ b/LarsWM/WindowsApi/WindowsApiFacade.cs@@ -5,6 +5,7 @@ using System.Linq;using System.Text;using static LarsWM.WindowsApi.WindowsApiService;using static LarsWM.UserConfig.UserConfigService;+using LarsWM.WindowsApi.DataTypes;namespace LarsWM.WindowsApi{@@ -80,6 +81,17 @@ namespace LarsWM.WindowsApireturn buffer.ToString();}++ /// <summary>+ /// Get dimensions of the bounding rectangle of the specified window.+ /// </summary>+ public static WindowRect GetLocationOfWindow(Window window)+ {+ WindowRect rect = new WindowRect();+ GetWindowRect(window.Hwnd, ref rect);+ return rect;+ }+public static bool HasWindowStyle(IntPtr hwnd, WS style){var styles = unchecked((WS)GetWindowLongPtr(hwnd, (int)(GWL_STYLE)).ToInt64());diff --git a/LarsWM/WindowsApi/WindowsApiService.cs b/LarsWM/WindowsApi/WindowsApiService.csindex f6426484..f0da90c2 100644--- a/LarsWM/WindowsApi/WindowsApiService.cs+++ b/LarsWM/WindowsApi/WindowsApiService.cs@@ -1,4 +1,5 @@-using System;+using LarsWM.WindowsApi.DataTypes;+using System;using System.Collections.Generic;using System.Runtime.InteropServices;using System.Text;@@ -140,5 +141,8 @@ namespace LarsWM.WindowsApi[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName,int nMaxCount);++ [DllImport("user32.dll")]+ public static extern bool GetWindowRect(IntPtr hwnd, ref WindowRect rectangle);}}