Skip to content

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

feat: created WindowsApiService class with some extern methods for interacting with windows api

Lars07577758bd6c
diff --git a/LarsWM/WindowsApi/WindowsApiService.cs b/LarsWM/WindowsApi/WindowsApiService.cs
new file mode 100644
index 00000000..8abbd992
--- /dev/null
+++ b/LarsWM/WindowsApi/WindowsApiService.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace LarsWM.WindowsApi
+{
+ class WindowsApiService
+ {
+ public enum SWP : uint
+ {
+ SWP_SHOWWINDOW = 0x0040,
+ SWP_HIDEWINDOW = 0x0080,
+ SWP_NOZORDER = 0x0004,
+ SWP_NOREDRAW = 0x0008,
+ SWP_NOACTIVATE = 0x0010,
+ SWP_NOMOVE = 0x0002,
+ SWP_NOSIZE = 0x0001,
+ SWP_FRAMECHANGED = 0x0020,
+ SWP_NOCOPYBITS = 0x0100,
+ SWP_NOOWNERZORDER = 0x0200,
+ SWP_DEFERERASE = 0x2000,
+ SWP_NOSENDCHANGING = 0x0400,
+ SWP_ASYNCWINDOWPOS = 0x4000
+ }
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr BeginDeferWindowPos(int nNumWindows);
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr DeferWindowPos(IntPtr hWinPosInfo, IntPtr hWnd,
+ [Optional] IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP uFlags);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool EndDeferWindowPos(IntPtr hWinPosInfo);
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr GetForegroundWindow();
+
+ [DllImport("user32.dll")]
+ public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
+
+ [DllImport("user32.dll")]
+ public static extern bool SetFocus(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ public static extern bool ShowWindow(IntPtr hWnd, int X);
+ }
+}