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
commit1717e3813c205054e8dc186188828f735c52331f (patch)
treea290ed7c61c48c5916dccee913037c21ba37aa77
parentcfb23331a994f47ae41d062eb98a98fa5b810024 (diff)
downloadmdk-1717e3813c205054e8dc186188828f735c52331f.tar.gz
mdk-1717e3813c205054e8dc186188828f735c52331f.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 *