qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 13/20] decorate application name


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 13/20] decorate application name
Date: Fri, 27 Jun 2008 17:38:16 -0300

Signed-off-by: Glauber Costa <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]