From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCKju-00035T-0U for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCKjr-00033a-Ij for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:12 -0400 Received: from [199.232.76.173] (port=51159 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCKjr-00033P-2s for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:11 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55963) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCKjr-000818-CM for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:11 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m5RKeAHN014592 for ; Fri, 27 Jun 2008 16:40:10 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKe9pA005969 for ; Fri, 27 Jun 2008 16:40:09 -0400 Received: from localhost.localdomain (vpn-4-80.str.redhat.com [10.32.4.80]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKdadl004563 for ; Fri, 27 Jun 2008 16:40:08 -0400 From: Glauber Costa Date: Fri, 27 Jun 2008 17:38:16 -0300 Message-Id: <1214599103-13846-14-git-send-email-gcosta@redhat.com> In-Reply-To: <1214599103-13846-13-git-send-email-gcosta@redhat.com> References: <1214599103-13846-1-git-send-email-gcosta@redhat.com> <1214599103-13846-2-git-send-email-gcosta@redhat.com> <1214599103-13846-3-git-send-email-gcosta@redhat.com> <1214599103-13846-4-git-send-email-gcosta@redhat.com> <1214599103-13846-5-git-send-email-gcosta@redhat.com> <1214599103-13846-6-git-send-email-gcosta@redhat.com> <1214599103-13846-7-git-send-email-gcosta@redhat.com> <1214599103-13846-8-git-send-email-gcosta@redhat.com> <1214599103-13846-9-git-send-email-gcosta@redhat.com> <1214599103-13846-10-git-send-email-gcosta@redhat.com> <1214599103-13846-11-git-send-email-gcosta@redhat.com> <1214599103-13846-12-git-send-email-gcosta@redhat.com> <1214599103-13846-13-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 13/20] decorate application name Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Glauber Costa --- accel.h | 10 ++++++++++ sdl.c | 7 +++++-- vl.c | 12 ++++++++++++ vnc.c | 6 ++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/accel.h b/accel.h index 99f4742..9755a9b 100644 --- a/accel.h +++ b/accel.h @@ -47,6 +47,15 @@ static inline void accel_cpu_interrupt(CPUState *env) current_accel->cpu_interrupt(env); } +static inline char *accel_get_name(void) +{ + if (current_accel && current_accel->name) + return current_accel->name; + return NULL; +} + +void decorate_app_name(void); + static inline void accel_start(void) { /* The top accelerator in the list gets tried first, but if it fails, @@ -56,6 +65,7 @@ static inline void accel_start(void) if (tmp->acc && tmp->acc->start && (!(tmp->acc->start())) ) { tmp->active = 1; current_accel = tmp->acc; + decorate_app_name(); break; } tmp = tmp->next; diff --git a/sdl.c b/sdl.c index bac60ea..5720b7f 100644 --- a/sdl.c +++ b/sdl.c @@ -218,9 +218,12 @@ static void sdl_process_key(SDL_KeyboardEvent *ev) kbd_put_keycode(keycode & 0x7f); } +extern char qemu_app_name[]; + static void sdl_update_caption(void) { char buf[1024]; + char qemu_app_namei[512] = "QEMU"; const char *status = ""; if (!vm_running) @@ -233,9 +236,9 @@ static void sdl_update_caption(void) } if (qemu_name) - snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status); + snprintf(buf, sizeof(buf), "%s (%s)%s", qemu_app_name, qemu_name, status); else - snprintf(buf, sizeof(buf), "QEMU%s", status); + snprintf(buf, sizeof(buf), "%s%s", qemu_app_name, status); SDL_WM_SetCaption(buf, "QEMU"); } diff --git a/vl.c b/vl.c index fd26b92..688fc3a 100644 --- a/vl.c +++ b/vl.c @@ -241,8 +241,20 @@ struct drive_opt { static CPUState *cur_cpu; static CPUState *next_cpu; static int event_pending = 1; + QEMUAccel *current_accel; QEMUCont *head = NULL; +char qemu_app_name[20] = "QEMU"; + +void decorate_app_name(void) +{ + char *name = accel_get_name(); + + if (!name) + sprintf(qemu_app_name, "QEMU"); + else + sprintf(qemu_app_name, "QEMU/%s", name); +} #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) diff --git a/vnc.c b/vnc.c index 31118ee..b55ed19 100644 --- a/vnc.c +++ b/vnc.c @@ -1265,6 +1265,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) return 0; } +extern char qemu_app_name[]; + static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) { char pad[3] = { 0, 0, 0 }; @@ -1315,9 +1317,9 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) vnc_write(vs, pad, 3); /* padding */ if (qemu_name) - size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name); + size = snprintf(buf, sizeof(buf), "%s (%s)", qemu_app_name, qemu_name); else - size = snprintf(buf, sizeof(buf), "QEMU"); + size = snprintf(buf, sizeof(buf), "%s", qemu_app_name); vnc_write_u32(vs, size); vnc_write(vs, buf, size); -- 1.5.5.1