From 50c0e6a45dd333af478c33d2c5bf44b4fcf1195c Mon Sep 17 00:00:00 2001 From: Lucas Eriksson Date: Wed, 27 Jun 2018 20:16:49 +0200 Subject: [PATCH] ui: Set window title to 'XQEMU (Revision: )' --- Makefile | 2 +- ui/sdl2.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d71dd5bea4..00270c96b3 100644 --- a/Makefile +++ b/Makefile @@ -442,7 +442,7 @@ qemu-version.h: FORCE pkgvers="$(PKGVERSION)"; \ else \ if test -d .git; then \ - pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\ + pkgvers=$$(git rev-parse --short HEAD 2>/dev/null | tr -d '\n');\ if ! git diff-index --quiet HEAD &>/dev/null; then \ pkgvers="$${pkgvers}-dirty"; \ fi; \ diff --git a/ui/sdl2.c b/ui/sdl2.c index 83b917fa37..9b7c6ab434 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu-version.h" #include "ui/console.h" #include "ui/input.h" #include "ui/sdl2.h" @@ -135,6 +136,8 @@ static void sdl_update_caption(struct sdl2_console *scon) char win_title[1024]; char icon_title[1024]; const char *status = ""; + const char *project_name = "XQEMU"; + const char *hash_indicator = "Revision"; if (!runstate_is_running()) { status = " [Stopped]"; @@ -149,12 +152,16 @@ static void sdl_update_caption(struct sdl2_console *scon) } if (qemu_name) { - snprintf(win_title, sizeof(win_title), "QEMU (%s-%d)%s", qemu_name, + snprintf(win_title, sizeof(win_title), "%s (%s: %s) (%s-%d)%s", + project_name, hash_indicator, QEMU_PKGVERSION, qemu_name, scon->idx, status); - snprintf(icon_title, sizeof(icon_title), "QEMU (%s)", qemu_name); + snprintf(icon_title, sizeof(icon_title), "%s (%s: %s) (%s)", + project_name, hash_indicator, QEMU_PKGVERSION, qemu_name); } else { - snprintf(win_title, sizeof(win_title), "QEMU%s", status); - snprintf(icon_title, sizeof(icon_title), "QEMU"); + snprintf(win_title, sizeof(win_title), "%s (%s: %s)%s", + project_name, hash_indicator, QEMU_PKGVERSION, status); + snprintf(icon_title, sizeof(icon_title), "%s (%s: %s)", + project_name, hash_indicator, QEMU_PKGVERSION); } if (scon->real_window) {