1
0
mirror of synced 2024-09-23 19:18:24 +02:00

ui: Limit window title length

This commit is contained in:
WerWolv 2022-11-04 15:19:24 +01:00
parent 48e9d3b4e9
commit 291da649c1
4 changed files with 6 additions and 6 deletions

4
.gitattributes vendored
View File

@ -1,3 +1 @@
lib/external/** linguist-vendored
lib/libimhex-rs/imgui-rs/** linguist-vendored
lib/libimhex-rs/imgui-sys/** linguist-vendored
lib/external/** linguist-vendored

@ -1 +1 @@
Subproject commit b2fba629663eab215f7a9bd4f5e1e944f0c4c36e
Subproject commit 78b4e491e7c6033947e0d81e2361dc0881084e6d

View File

@ -343,6 +343,8 @@ namespace hex {
void Window::drawTitleBar() {
if (!ImHexApi::System::isBorderlessWindowModeEnabled()) return;
auto startX = ImGui::GetCursorPosX();
auto buttonSize = ImVec2(g_titleBarHeight * 1.5F, g_titleBarHeight - 1);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
@ -382,7 +384,7 @@ namespace hex {
ImGui::PopStyleColor(5);
ImGui::PopStyleVar();
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(this->m_windowTitle.c_str()).x) / 2);
ImGui::SetCursorPosX(std::max(startX, (ImGui::GetWindowWidth() - ImGui::CalcTextSize(this->m_windowTitle.c_str()).x) / 2));
ImGui::TextUnformatted(this->m_windowTitle.c_str());
}

View File

@ -121,7 +121,7 @@ namespace hex {
if (ImHexApi::Provider::isValid()) {
auto provider = ImHexApi::Provider::get();
if (!windowTitle.empty() && provider != nullptr) {
title += " - " + windowTitle;
title += " - " + hex::limitStringLength(windowTitle, 32);
if (provider->isDirty())
title += " (*)";