qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PATCH 03/25] gtk: cleanup CONFIG_VTE ifdef a bit.
Date: Wed, 21 May 2014 10:43:39 +0200	[thread overview]
Message-ID: <1400661841-16031-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1400661841-16031-1-git-send-email-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 45 ++++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 776e72d..068a39b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -108,8 +108,8 @@ static const int modifier_keycode[] = {
 typedef struct VirtualConsole
 {
     GtkWidget *menu_item;
-    GtkWidget *terminal;
 #if defined(CONFIG_VTE)
+    GtkWidget *terminal;
     CharDriverState *chr;
 #endif
 } VirtualConsole;
@@ -1124,13 +1124,12 @@ static gboolean gd_focus_out_event(GtkWidget *widget,
 
 /** Virtual Console Callbacks **/
 
+#if defined(CONFIG_VTE)
 static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
-#if defined(CONFIG_VTE)
     VirtualConsole *vc = chr->opaque;
 
     vte_terminal_feed(VTE_TERMINAL(vc->terminal), (const char *)buf, len);
-#endif
     return len;
 }
 
@@ -1151,12 +1150,6 @@ static CharDriverState *gd_vc_handler(ChardevVC *unused)
     return chr;
 }
 
-void early_gtk_display_init(void)
-{
-    register_vc_handler(gd_vc_handler);
-}
-
-#if defined(CONFIG_VTE)
 static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size,
                          gpointer user_data)
 {
@@ -1165,12 +1158,10 @@ static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size,
     qemu_chr_be_write(vc->chr, (uint8_t  *)text, (unsigned int)size);
     return TRUE;
 }
-#endif
 
 static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group,
                           GtkWidget *view_menu)
 {
-#if defined(CONFIG_VTE)
     const char *label;
     char buffer[32];
     char path[32];
@@ -1212,10 +1203,23 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
         vc->chr->init(vc->chr);
     }
 
-#endif /* CONFIG_VTE */
     return group;
 }
 
+static void gd_vcs_init(GtkDisplayState *s, GSList *group,
+                        GtkWidget *view_menu)
+{
+    int i;
+
+    for (i = 0; i < nb_vcs; i++) {
+        VirtualConsole *vc = &s->vc[i];
+
+        group = gd_vc_init(s, vc, i, group, view_menu);
+        s->nb_vcs++;
+    }
+}
+#endif /* CONFIG_VTE */
+
 /** Window Creation **/
 
 static void gd_connect_signals(GtkDisplayState *s)
@@ -1316,7 +1320,6 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
     GSList *group = NULL;
     GtkWidget *view_menu;
     GtkWidget *separator;
-    int i;
 
     view_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
@@ -1378,12 +1381,9 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s, GtkAccelGroup *accel_g
     gtk_accel_map_add_entry("<QEMU>/View/VGA", GDK_KEY_1, HOTKEY_MODIFIERS);
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->vga_item);
 
-    for (i = 0; i < nb_vcs; i++) {
-        VirtualConsole *vc = &s->vc[i];
-
-        group = gd_vc_init(s, vc, i, group, view_menu);
-        s->nb_vcs++;
-    }
+#if defined(CONFIG_VTE)
+    gd_vcs_init(s, group, view_menu);
+#endif
 
     separator = gtk_separator_menu_item_new();
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), separator);
@@ -1512,3 +1512,10 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 
     global_state = s;
 }
+
+void early_gtk_display_init(void)
+{
+#if defined(CONFIG_VTE)
+    register_vc_handler(gd_vc_handler);
+#endif
+}
-- 
1.8.3.1

  parent reply	other threads:[~2014-05-21  8:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21  8:43 [Qemu-devel] [PATCH 00/25] qemu gtk ui overhaul Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 01/25] gtk: zap scrolled_window Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 02/25] gtk: zap vte size requests Gerd Hoffmann
2014-05-21  8:43 ` Gerd Hoffmann [this message]
2014-05-21  8:43 ` [Qemu-devel] [PATCH 04/25] gtk: Add a scrollbar for text consoles Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 05/25] gtk: remove page numbering assumtions from the code Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 06/25] gtk: VirtualConsole restruction Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 07/25] gtk: move vga state into VirtualGfxConsole Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 08/25] gtk: support multiple gfx displays Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 09/25] gtk: use device type as label Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 10/25] gtk: simplify resize Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 11/25] gtk: allow moving tabs to windows and back Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 12/25] gtk: add tab to trace events Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 13/25] gtk: add gd_grab trace event Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 14/25] gtk: keep track of grab owner Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 15/25] gtk: skip keyboard grab when hover autograb is active Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 16/25] gtk: update gd_update_caption Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 17/25] gtk: fix grab checks Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 18/25] gtk: update all windows on mouse mode changes Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 19/25] gtk: detached window pointer grabs Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 20/25] gtk: enable untabify for gfx Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 21/25] gtk: Add handling for the xfree86 keycodes Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 22/25] gtk: zap unused global_state Gerd Hoffmann
2014-05-21  8:43 ` [Qemu-devel] [PATCH 23/25] gtk: window sizing overhaul Gerd Hoffmann
2014-05-21  8:44 ` [Qemu-devel] [PATCH 24/25] gtk: workaround gtk2 vte resize issue Gerd Hoffmann
2014-05-21  8:44 ` [Qemu-devel] [PATCH 25/25] gtk: factor out gtk3 grab into the new gd_grab_devices function Gerd Hoffmann
2014-05-21 20:52 ` [Qemu-devel] [PATCH 00/25] qemu gtk ui overhaul Stefan Weil
2014-05-22  6:24   ` Gerd Hoffmann
2014-05-22  6:58     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400661841-16031-4-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).