mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
ui: Limit window title length
This commit is contained in:
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -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
|
||||
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
Submodule lib/external/pattern_language updated: b2fba62966...78b4e491e7
@@ -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