Release v0.2.1: support remote input, safe updates and high-DPI windows
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "core.h"
|
||||
#include <algorithm>
|
||||
namespace ks
|
||||
{
|
||||
inline RECT fitWindowRect(RECT desired, RECT work)
|
||||
{
|
||||
LONG width = std::clamp<LONG>(desired.right - desired.left, 1, std::max<LONG>(1, work.right - work.left));
|
||||
LONG height = std::clamp<LONG>(desired.bottom - desired.top, 1, std::max<LONG>(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};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user