summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2004-07-02 00:08:28 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2004-07-02 00:08:28 +0000
commita63e6f0986dc4b0dedc83e5143e697bfd88ea277 (patch)
tree5d4e00d826301515e723bf3819acc674fa51dc90
parent885fda6955ca7180a4a18d2ee314b7f94983a9dc (diff)
downloadmdk-a63e6f0986dc4b0dedc83e5143e697bfd88ea277.tar.gz
mdk-a63e6f0986dc4b0dedc83e5143e697bfd88ea277.tar.bz2
(write_char_): scroll on output and cursor placement.
-rw-r--r--mixgtk/mixgtk_device.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index 885c19c..1b3a78a 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_device.c :
* actual types for mixgtk devices
* ------------------------------------------------------------------
- * $Id: mixgtk_device.c,v 1.23 2004/06/30 14:07:53 jao Exp $
+ * $Id: mixgtk_device.c,v 1.24 2004/07/02 00:08:28 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -90,7 +90,11 @@ write_char_ (struct mixgtk_device_t *dev, const mix_word_t *block)
{
enum {MAX_BLOCK = 16, BUFF_SIZE = MAX_BLOCK * 5 + 2};
static gchar BUFFER[BUFF_SIZE];
+
guint k, j;
+ GtkTextIter end;
+ GtkTextBuffer *buffer;
+ GtkTextMark *mark;
for (k = 0; k < SIZES_[dev->device.type]; k++)
for (j = 1; j < 6; j++)
@@ -102,9 +106,13 @@ write_char_ (struct mixgtk_device_t *dev, const mix_word_t *block)
BUFFER[5 * k] = '\n';
BUFFER[5 * k + 1] = '\0';
- gtk_text_buffer_insert_at_cursor
- (gtk_text_view_get_buffer (GTK_TEXT_VIEW (dev->widget)), BUFFER, -1);
-
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dev->widget));
+ gtk_text_buffer_get_end_iter (buffer, &end);
+ gtk_text_buffer_place_cursor (buffer, &end);
+ gtk_text_buffer_insert_at_cursor (buffer, BUFFER, -1);
+ mark = gtk_text_buffer_get_insert (buffer);
+ gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (dev->widget), mark, 0,
+ TRUE, 0, 0);
}
static const gchar *