mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
ui: Limit window title length
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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 += " (*)";
|
||||
|
||||
Reference in New Issue
Block a user