public static IEnumerator UpdateWeirdOffset(UDDMonitor monitor, UwcWindow window) { WinNative.SetCursorPos(0, 0); WinNative.SetWindowPos(window.handle, 0, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOSIZE); int size = Marshal.SizeOf(typeof(RECT)); WinNative.SetThreadDpiAwarenessContext(PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE); RECT rect = new RECT(); RECT frame = new RECT(); WinNative.GetWindowRect(window.handle, ref rect); WinNative.DwmGetWindowAttribute(window.handle, DWMWINDOWATTRIBUTE.ExtendedFrameBounds, out frame, size); //rect should be `0, 0, 1280, 1024` //frame should be `7, 0, 1273, 1017` RECT border = new RECT(); border.Left = frame.Left - rect.Left; border.Top = frame.Top - rect.Top; border.Right = rect.Right - frame.Right; border.Bottom = rect.Bottom - frame.Bottom; Debug.Log(border.Left); yield return(new WaitForSeconds(0.1f)); WinNative.MoveOverWindow(window.handle, new Point(0, 0), true); WinNative.POINT curCursorPos = new WinNative.POINT(); WinNative.GetCursorPos(ref curCursorPos); //window.weirdOffset = Math.Abs(curCursorPos.x); yield break; while (true) { RECT yay = new RECT(); WinNative.GetWindowRect(window.handle, ref yay); Debug.Log(yay.Left); yield return(null); } //Debug.Log(window.weirdOffset); }