#pragma once #include "core.h" #include namespace ks { inline RECT fitWindowRect(RECT desired, RECT work) { LONG width = std::clamp(desired.right - desired.left, 1, std::max(1, work.right - work.left)); LONG height = std::clamp(desired.bottom - desired.top, 1, std::max(1, work.bottom - work.top)); LONG x = std::clamp(desired.left, work.left, work.right - width); LONG y = std::clamp(desired.top, work.top, work.bottom - height); return {x, y, x + width, y + height}; } }