[AlwaysOnTop] Round corners on Windows 11 (#19109)

* check window corners

* draw rounded rectangle

* draw rounded corners

* switch between rounded and not rounded rects

* added enabled corners setting

* update corner
This commit is contained in:
Seraphima Zykova
2022-07-01 17:56:45 +02:00
committed by GitHub
parent 35bb4280d0
commit d201ae4335
14 changed files with 175 additions and 28 deletions

View File

@@ -18,14 +18,15 @@ public:
void Show();
void Hide();
void SetBorderRect(RECT windowRect, COLORREF color, int thickness);
void SetBorderRect(RECT windowRect, COLORREF color, int thickness, int radius);
private:
bool CreateRenderTargets(const RECT& clientRect);
struct DrawableRect
{
D2D1_RECT_F rect;
std::optional<D2D1_RECT_F> rect;
std::optional<D2D1_ROUNDED_RECT> roundedRect;
D2D1_COLOR_F borderColor;
int thickness;
};
@@ -33,7 +34,8 @@ private:
static ID2D1Factory* GetD2DFactory();
static IDWriteFactory* GetWriteFactory();
static D2D1_COLOR_F ConvertColor(COLORREF color);
static D2D1_RECT_F ConvertRect(RECT rect);
static D2D1_ROUNDED_RECT ConvertRect(RECT rect, int thickness, int radius);
static D2D1_RECT_F ConvertRect(RECT rect, int thickness);
void Render();
HWND m_window = nullptr;