ui: Improved borderless window resizing and moving
This commit is contained in:
parent
7da8a5b1d8
commit
7799bbb57a
@ -99,8 +99,8 @@
|
|||||||
POINT cursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
POINT cursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||||
|
|
||||||
const POINT border{
|
const POINT border{
|
||||||
static_cast<LONG>((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F),
|
static_cast<LONG>((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 1.5F),
|
||||||
static_cast<LONG>((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F)
|
static_cast<LONG>((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 1.5F)
|
||||||
};
|
};
|
||||||
|
|
||||||
RECT window;
|
RECT window;
|
||||||
@ -120,6 +120,9 @@
|
|||||||
RegionTop * (cursor.y < (window.top + border.y)) |
|
RegionTop * (cursor.y < (window.top + border.y)) |
|
||||||
RegionBottom * (cursor.y >= (window.bottom - border.y));
|
RegionBottom * (cursor.y >= (window.bottom - border.y));
|
||||||
|
|
||||||
|
if (result != 0 && (ImGui::IsItemHovered() || ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId)))
|
||||||
|
break;
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case RegionLeft:
|
case RegionLeft:
|
||||||
return HTLEFT;
|
return HTLEFT;
|
||||||
@ -139,7 +142,7 @@
|
|||||||
return HTBOTTOMRIGHT;
|
return HTBOTTOMRIGHT;
|
||||||
case RegionClient:
|
case RegionClient:
|
||||||
default:
|
default:
|
||||||
if ((cursor.y < (window.top + titleBarHeight)) && !(ImGui::IsAnyItemHovered() || ImGui::IsAnyItemFocused()))
|
if ((cursor.y < (window.top + titleBarHeight * 2)) && !(ImGui::IsAnyItemHovered() || ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId)))
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user