summaryrefslogtreecommitdiff
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-05-06 11:20:17 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-05-26 08:41:03 +0200
commit4eeaa3a88557c7540a75f7ca2cb1171c57d56db9 (patch)
tree3bf6a997ca54400b7ff1213791c0c886416b0bca /ui/gtk.c
parent746b86703003b4a6e5323b51b324f591dcd1a84b (diff)
downloadqemu-4eeaa3a88557c7540a75f7ca2cb1171c57d56db9.tar.gz
qemu-4eeaa3a88557c7540a75f7ca2cb1171c57d56db9.tar.bz2
qemu-4eeaa3a88557c7540a75f7ca2cb1171c57d56db9.zip
gtk: update gd_update_caption
Adapt to recent changes, handle multiple windows. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index f8048138fe..7d6a20dee8 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -271,11 +271,20 @@ static void gd_update_cursor(VirtualConsole *vc)
static void gd_update_caption(GtkDisplayState *s)
{
const char *status = "";
+ gchar *prefix;
gchar *title;
const char *grab = "";
bool is_paused = !runstate_is_running();
+ int i;
- if (gd_is_grab_active(s)) {
+ if (qemu_name) {
+ prefix = g_strdup_printf("QEMU (%s)", qemu_name);
+ } else {
+ prefix = g_strdup_printf("QEMU");
+ }
+
+ if (s->ptr_owner != NULL &&
+ s->ptr_owner->window == NULL) {
grab = _(" - Press Ctrl+Alt+G to release grab");
}
@@ -287,15 +296,24 @@ static void gd_update_caption(GtkDisplayState *s)
is_paused);
s->external_pause_update = false;
- if (qemu_name) {
- title = g_strdup_printf("QEMU (%s)%s%s", qemu_name, status, grab);
- } else {
- title = g_strdup_printf("QEMU%s%s", status, grab);
- }
-
+ title = g_strdup_printf("%s%s%s", prefix, status, grab);
gtk_window_set_title(GTK_WINDOW(s->window), title);
-
g_free(title);
+
+ for (i = 0; i < s->nb_vcs; i++) {
+ VirtualConsole *vc = &s->vc[i];
+
+ if (!vc->window) {
+ continue;
+ }
+ title = g_strdup_printf("%s: %s%s%s", prefix, vc->label,
+ vc == s->kbd_owner ? " +kbd" : "",
+ vc == s->ptr_owner ? " +ptr" : "");
+ gtk_window_set_title(GTK_WINDOW(vc->window), title);
+ g_free(title);
+ }
+
+ g_free(prefix);
}
static void gd_update_windowsize(VirtualConsole *vc)
@@ -915,7 +933,6 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
VirtualConsole *vc = gd_vc_find_current(s);
- char *title;
if (vc->type == GD_VC_GFX) {
/* temporary: needs more work to get grabs etc correct */
@@ -926,17 +943,11 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
vc->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_reparent(vc->tab_item, vc->window);
- if (qemu_name) {
- title = g_strdup_printf("QEMU (%s): %s", qemu_name, vc->label);
- } else {
- title = g_strdup_printf("QEMU: %s", vc->label);
- }
- gtk_window_set_title(GTK_WINDOW(vc->window), title);
- g_free(title);
-
g_signal_connect(vc->window, "delete-event",
G_CALLBACK(gd_tab_window_close), vc);
gtk_widget_show_all(vc->window);
+
+ gd_update_caption(s);
}
}