Center tab labels and unify dock cursor resolution
This commit is contained in:
@@ -482,6 +482,7 @@ void Application::RenderFrame() {
|
||||
}
|
||||
ApplyHostCaptureRequests(m_shellFrame.result);
|
||||
UpdateLastStatus(m_shellFrame.result);
|
||||
ApplyCurrentCursor();
|
||||
AppendUIEditorShellInteraction(
|
||||
drawList,
|
||||
m_shellFrame,
|
||||
@@ -520,6 +521,29 @@ float Application::PixelsToDips(float pixels) const {
|
||||
return dpiScale > 0.0f ? pixels / dpiScale : pixels;
|
||||
}
|
||||
|
||||
LPCWSTR Application::ResolveCurrentCursorResource() const {
|
||||
switch (Widgets::ResolveUIEditorDockHostCursorKind(
|
||||
m_shellFrame.workspaceInteractionFrame.dockHostFrame.layout)) {
|
||||
case Widgets::UIEditorDockHostCursorKind::ResizeEW:
|
||||
return IDC_SIZEWE;
|
||||
case Widgets::UIEditorDockHostCursorKind::ResizeNS:
|
||||
return IDC_SIZENS;
|
||||
case Widgets::UIEditorDockHostCursorKind::Arrow:
|
||||
default:
|
||||
return IDC_ARROW;
|
||||
}
|
||||
}
|
||||
|
||||
bool Application::ApplyCurrentCursor() const {
|
||||
const HCURSOR cursor = LoadCursorW(nullptr, ResolveCurrentCursorResource());
|
||||
if (cursor == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SetCursor(cursor);
|
||||
return true;
|
||||
}
|
||||
|
||||
UIPoint Application::ConvertClientPixelsToDips(LONG x, LONG y) const {
|
||||
return UIPoint(
|
||||
PixelsToDips(static_cast<float>(x)),
|
||||
@@ -877,6 +901,13 @@ LRESULT CALLBACK Application::WndProc(HWND hwnd, UINT message, WPARAM wParam, LP
|
||||
|
||||
Application* application = GetApplicationFromWindow(hwnd);
|
||||
switch (message) {
|
||||
case WM_SETCURSOR:
|
||||
if (application != nullptr &&
|
||||
LOWORD(lParam) == HTCLIENT &&
|
||||
application->ApplyCurrentCursor()) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
if (application != nullptr && lParam != 0) {
|
||||
application->OnDpiChanged(
|
||||
|
||||
Reference in New Issue
Block a user