aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2009-03-25 10:56:36 +0000
committerkraxel <kraxel>2009-03-25 10:56:36 +0000
commita6ec4d8f20651b072819461705a393a11aeaf2d5 (patch)
treefec34d538d2e18a3ba4c2c0aa2f3792640cf48f7
parentb39d11eb76f38d876b31a15cce24f9aa2f964eca (diff)
downloadqemu-gtk-a6ec4d8f20651b072819461705a393a11aeaf2d5.tar.gz
fix build on older vte versions
-rw-r--r--qemu-gtk.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/qemu-gtk.c b/qemu-gtk.c
index ae2a1ae..c3db100 100644
--- a/qemu-gtk.c
+++ b/qemu-gtk.c
@@ -19,6 +19,12 @@
#define APPNAME "qemu-gtk"
+#ifdef VTE_CHECK_VERSION
+# if VTE_CHECK_VERSION(0, 16, 15)
+# define HAVE_BLINK_MODE 1
+# endif
+#endif
+
/* ------------------------------------------------------------------ */
static GKeyFile *config;
@@ -53,11 +59,23 @@ static void config_write(void)
if (-1 == fd)
return;
write(fd, data, len);
+ fsync(fd);
close(fd);
}
/* ------------------------------------------------------------------ */
+static void vte_set_blink(GtkWidget *vte, gboolean blink)
+{
+#ifdef HAVE_BLINK_MODE
+ VteTerminalCursorBlinkMode bl =
+ blink ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF;
+ vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(vte), bl);
+#else
+ vte_terminal_set_cursor_blinks(VTE_TERMINAL(vte), blink);
+#endif
+}
+
static void vtes_set_font(struct qemu_window *win)
{
struct qemu_conn *term;
@@ -98,23 +116,19 @@ static void vtes_set_colors(struct qemu_window *win)
static void vtes_set_blink(struct qemu_window *win)
{
struct qemu_conn *term;
- VteTerminalCursorBlinkMode bl =
- win->tty_blink ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF;
if (win->monitor.vte)
- vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(win->monitor.vte), bl);
+ vte_set_blink(win->monitor.vte, win->tty_blink);
if (win->gdb_vte)
- vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(win->gdb_vte), bl);
+ vte_set_blink(win->gdb_vte, win->tty_blink);
for (term = win->terms; term != NULL; term = term->next)
- vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(term->vte), bl);
+ vte_set_blink(term->vte, win->tty_blink);
}
static void vte_configure(struct qemu_window *win, GtkWidget *vte)
{
GdkColor fg = {0,0,0,0};
GdkColor bg = {0,0,0,0};
- VteTerminalCursorBlinkMode bl =
- win->tty_blink ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF;
vte_terminal_set_scrollback_lines(VTE_TERMINAL(vte), 4096);
vte_terminal_set_backspace_binding(VTE_TERMINAL(vte),
@@ -125,7 +139,7 @@ static void vte_configure(struct qemu_window *win, GtkWidget *vte)
vte_terminal_set_color_foreground(VTE_TERMINAL(vte), &fg);
vte_terminal_set_color_background(VTE_TERMINAL(vte), &bg);
vte_terminal_set_font_from_string(VTE_TERMINAL(vte), win->tty_font);
- vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(vte), bl);
+ vte_set_blink(vte, win->tty_blink);
}
static void tabs_configure(struct qemu_window *win)