From 19107cec4b8fee6e1dbf315280cefab302d6685c Mon Sep 17 00:00:00 2001
From: Vitor K <vitor-kiguchi@hotmail.com>
Date: Tue, 25 Jul 2023 09:51:46 -0300
Subject: [PATCH] citra-qt: update the separate window titles to use full_name
 and show Primary/Secondary identifier (#6712)

* citra-qt: update the separate window titles to use full_name and Primary/Secondary window identifier

* build_fullname: remove trailing space
---
 CMakeModules/GenerateBuildInfo.cmake | 4 +---
 src/citra_qt/bootmanager.cpp         | 4 ----
 src/citra_qt/main.cpp                | 8 ++++++--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/CMakeModules/GenerateBuildInfo.cmake b/CMakeModules/GenerateBuildInfo.cmake
index 824ae1f9b..1c12e2919 100644
--- a/CMakeModules/GenerateBuildInfo.cmake
+++ b/CMakeModules/GenerateBuildInfo.cmake
@@ -57,9 +57,7 @@ if (DEFINED ENV{CI})
             set(BUILD_VERSION ${CMAKE_MATCH_1})
         endif()
         if (BUILD_VERSION)
-            # This leaves a trailing space on the last word, but we actually want that
-            # because of how it's styled in the title bar.
-            set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
+            set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION}")
         else()
             set(BUILD_FULLNAME "")
         endif()
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 10963d224..157ecea41 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -387,10 +387,6 @@ GRenderWindow::GRenderWindow(QWidget* parent_, EmuThread* emu_thread_, Core::Sys
                              bool is_secondary_)
     : QWidget(parent_), EmuWindow(is_secondary_), emu_thread(emu_thread_), system{system_} {
 
-    setWindowTitle(QStringLiteral("Citra %1 | %2-%3")
-                       .arg(QString::fromUtf8(Common::g_build_name),
-                            QString::fromUtf8(Common::g_scm_branch),
-                            QString::fromUtf8(Common::g_scm_desc)));
     setAttribute(Qt::WA_AcceptTouchEvents);
     auto layout = new QHBoxLayout(this);
     layout->setContentsMargins(0, 0, 0, 0);
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 8452aea78..7eb2e4b7a 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -2783,9 +2783,13 @@ void GMainWindow::UpdateWindowTitle() {
     const QString full_name = QString::fromUtf8(Common::g_build_fullname);
 
     if (game_title.isEmpty()) {
-        setWindowTitle(tr("Citra %1").arg(full_name));
+        setWindowTitle(QStringLiteral("Citra %1").arg(full_name));
     } else {
-        setWindowTitle(tr("Citra %1| %2").arg(full_name, game_title));
+        setWindowTitle(QStringLiteral("Citra %1 | %2").arg(full_name, game_title));
+        render_window->setWindowTitle(
+            QStringLiteral("Citra %1 | %2 | %3").arg(full_name, game_title, tr("Primary Window")));
+        secondary_window->setWindowTitle(QStringLiteral("Citra %1 | %2 | %3")
+                                             .arg(full_name, game_title, tr("Secondary Window")));
     }
 }