* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
- * Modified by the Sylpheed Team and others 2001. Interesting
+ * Modified by the Sylpheed Team and others 2001. Interesting
* parts are marked using comment block following this one.
- * This modification is based on the GtkSText of GTK 1.2.8
+ * This modification is based on the GtkText of GTK 1.2.10
*/
-/* SYLPHEED:
- * comment here
+/* SYLPHEED:
+ * comment here
*/
#ifdef HAVE_CONFIG_H
#include <gtk/gtksignal.h>
#include <gtkstext.h>
-/* SYLPHEED:
+#include "compose.h"
+
+/* SYLPHEED:
* compile time settings
*/
#define INITIAL_BUFFER_SIZE 1024
/* SYLPHEED:
* cursor timer
*/
-static void gtk_stext_enable_blink (GtkSText *text);
+static void gtk_stext_enable_blink (GtkSText *text);
static void gtk_stext_disable_blink (GtkSText *text);
/* #define DEBUG_GTK_STEXT */
{
(GtkTextFunction)gtk_stext_move_beginning_of_line, /* a */
(GtkTextFunction)gtk_stext_move_backward_character, /* b */
- (GtkTextFunction)gtk_editable_copy_clipboard, /* c */
+ NULL, /* c */
+/* (GtkTextFunction)gtk_editable_copy_clipboard, /* c */
(GtkTextFunction)gtk_stext_delete_forward_character, /* d */
(GtkTextFunction)gtk_stext_move_end_of_line, /* e */
(GtkTextFunction)gtk_stext_move_forward_character, /* f */
NULL, /* s */
NULL, /* t */
(GtkTextFunction)gtk_stext_delete_line, /* u */
- (GtkTextFunction)gtk_editable_paste_clipboard, /* v */
+ NULL, /* v */
+/* (GtkTextFunction)gtk_editable_paste_clipboard, /* v */
(GtkTextFunction)gtk_stext_delete_backward_word, /* w */
- (GtkTextFunction)gtk_editable_cut_clipboard, /* x */
+ NULL, /* x */
+/* (GtkTextFunction)gtk_editable_cut_clipboard, /* x */
NULL, /* y */
NULL, /* z */
};
/* SYLPHEED:
* timer for blinking cursor
*/
- text->cursor_visible = FALSE; /* don't know whether gtktext stores this somewhere */
- text->cursor_timer_on = TRUE;
- text->cursor_off_ms = 500;
- text->cursor_on_ms = 500;
- text->cursor_timer_id = 0;
+ text->cursor_visible = FALSE; /* don't know whether gtktext stores this somewhere */
+ text->cursor_timer_on = TRUE;
+ text->cursor_off_ms = 500;
+ text->cursor_on_ms = 500;
+ text->cursor_timer_id = 0;
text->cursor_idle_time_timer_id = 0;
- text->wrap_rmargin = 0;
- text->cursor_type = STEXT_CURSOR_LINE;
- text->persist_column = 0;
+ text->wrap_rmargin = 0;
+ text->cursor_type = GTK_STEXT_CURSOR_LINE;
+ text->persist_column = 0;
init_properties (text);
"vadjustment", vadj,
NULL);
+ /* SYLPHEED:
+ * force widget name to be GtkText so it silently adapts
+ * the GtkText widget's style...
+ */
+ gtk_widget_set_name(text, "GtkText");
+ gtk_widget_ensure_style(text);
+
return text;
}
draw_cursor (text, FALSE);
}
+/* SYLPHEED */
+void
+gtk_stext_compact_buffer (GtkSText *text)
+{
+ g_return_if_fail (text != NULL);
+ g_return_if_fail (GTK_IS_STEXT (text));
+ move_gap (text, gtk_stext_get_length(text));
+}
+
void
gtk_stext_insert (GtkSText *text,
GdkFont *font,
}
/* SYLPHEED:
- * cursor timer
+ * cursor timer
*/
- gtk_stext_disable_blink(text);
-
+ gtk_stext_disable_blink (text);
+
GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
break;
case GDK_Page_Up: scroll_int (text, -text->vadj->page_increment); break;
case GDK_Page_Down: scroll_int (text, +text->vadj->page_increment); break;
- case GDK_Up:
- scroll_int (text, -KEY_SCROLL_PIXELS);
- break;
+ case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
case GDK_Return:
if (event->state & GDK_CONTROL_MASK)
}
extend_start = (text->point.index == editable->selection_start_pos);
- gtk_stext_disable_blink(text);
+ /* SYLPHEED: cursor */
+ gtk_stext_disable_blink (text);
+ }
+ else
+ {
+ gtk_stext_enable_blink (text);
}
/* SYLPHEED:
* cursor
*/
- if (!extend_selection)
- gtk_stext_enable_blink(text);
-
if (event->keyval != GDK_Up && event->keyval != GDK_Down) {
reset_persist_col_pos(text);
}
switch (event->keyval)
{
case GDK_Home:
- if (event->state & GDK_CONTROL_MASK)
- move_cursor_buffer_ver (text, -1);
+ if (event->state & GDK_CONTROL_MASK) {
+ if (text->wrap_rmargin == 0) {
+ /* SYLPHEED: old behaviour */
+ move_cursor_buffer_ver (text, -1);
+ }
+ else {
+ /* SYLPHEED: contrived, but "trusty" */
+ move_cursor_buffer_ver(text, -1);
+ move_cursor_to_display_row_start(text);
+ }
+ }
else {
if (text->wrap_rmargin > 0) {
/* SYLPHEED: line start */
}
break;
case GDK_End:
- if (event->state & GDK_CONTROL_MASK)
- move_cursor_buffer_ver (text, +1);
+ if (event->state & GDK_CONTROL_MASK) {
+ /* SYLPHEED: a little bit contrived... */
+ if (text->wrap_rmargin == 0) {
+ /* old behaviour */
+ move_cursor_buffer_ver (text, +1);
+ }
+ else {
+ move_cursor_buffer_ver(text, +1);
+ move_cursor_to_display_row_end(text);
+ }
+ }
else {
if (text->wrap_rmargin > 0) {
/* SYLPHEED: line end */
break;
case GDK_Down:
move_cursor_to_display_row_down(text);
-// move_cursor_ver (text, +1);
+/* move_cursor_ver (text, +1); */
break;
case GDK_Left:
if (event->state & GDK_CONTROL_MASK)
}
break;
case GDK_Delete:
- {
- if (event->state & GDK_CONTROL_MASK) {
- gtk_stext_delete_forward_word (text);
- }
- else if (event->state & GDK_SHIFT_MASK)
- {
- extend_selection = FALSE;
- gtk_editable_cut_clipboard (editable);
- }
- else {
- gtk_stext_delete_forward_character (text);
- }
- }
+ if (event->state & GDK_CONTROL_MASK)
+ gtk_stext_delete_forward_word (text);
+ else if (event->state & GDK_SHIFT_MASK)
+ {
+ extend_selection = FALSE;
+ gtk_editable_cut_clipboard (editable);
+ }
+ else
+ gtk_stext_delete_forward_character (text);
break;
case GDK_Tab:
position = text->point.index;
#endif
draw_cursor (GTK_STEXT(widget), TRUE);
+ /* SYLPHEED: cursor */
GTK_STEXT(widget)->cursor_visible = TRUE;
- gtk_stext_enable_blink(GTK_STEXT(widget));
+ gtk_stext_enable_blink (GTK_STEXT(widget));
return FALSE;
}
}
/* dumb */
-static gboolean range_intersect(gint x1, gint x2, gint y1, gint y2)
+static gboolean range_intersect(guint x1, guint x2, guint y1, guint y2)
{
- gint tmp;
+ guint tmp;
if (x1 > x2) { tmp = x1; x1 = x2; x2 = tmp; }
if (y1 > y2) { tmp = y1; y1 = y2; y1 = tmp; }
if (y1 < x1) { tmp = x1; x1 = y1; y1 = tmp; tmp = x2; x2 = y2; y2 = tmp; }
int new_index;
int col;
GtkSPropertyMark mark;
-
- /* make sure the back display lines are in the cache */
- fetch_lines_backward(text);
-
+
mark = find_this_line_start_mark(text, text->cursor_mark.index, &text->cursor_mark);
/* top of buffer */
if (mark.index == 0) {
- XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
- return;
+ XDEBUG ( ("%s(%d) top of buffer", __FILE__, __LINE__) );
}
- /* we need to previous DISPLAY row not the previous BUFFER line, so we go one line back,
- * and iterate over the lines until we have a LineParams that matches the original */
-
+ /* we need previous DISPLAY row not the previous BUFFER line, so we go to start
+ * of paragraph, and iterate over the lines until we have a LineParams that matches
+ * the original */
lp = CACHE_DATA(text->current_line);
col = (text->cursor_mark.index - lp.start.index);
data.start = lp.start.index;
data.end = lp.end.index;
/* get the previous line */
- if (mark.index - 1 > 0) {
+ if (mark.index != 0) {
decrement_mark(&mark);
- XDEBUG( ("%s(%d) mark decrement", __FILE__, __LINE__) );
- if (mark.index - 1 > 0) {
+ if (mark.index != 0) {
GtkSPropertyMark smark = mark;
XDEBUG( ("%s(%d) finding line start mark", __FILE__, __LINE__) );
mark = find_this_line_start_mark(text, smark.index -1, &smark);
LineParams lp;
} fdrf;
+#if defined(AHX_DEBUG)
+static void print_line(GtkSText *text, guint start, guint end)
+{
+ gchar *buf = alloca(2048), *walk = buf;
+
+ memset(buf, 0, 2048);
+ for (; start <= end; start++) {
+ *walk++ = GTK_STEXT_INDEX(text, start);
+ }
+ XDEBUG( ("%s", buf) );
+}
+#endif
+
static gint forward_display_row_fetcher(GtkSText *text,
LineParams *lp,
fdrf *data)
__FILE__, __LINE__, data->start, data->end, lp->start.index, lp->end.index) );
data->lp = *lp;
data->completed = TRUE;
+ print_line(text, lp->start.index, lp->end.index);
return TRUE;
}
else if (range_intersect(data->start, data->end, lp->start.index, lp->end.index)) {
GtkSPropertyMark mark;
fdrf data = { FALSE, FALSE };
- fetch_lines_forward(text, 1);
mark = find_this_line_start_mark(text, text->cursor_mark.index, &text->cursor_mark);
lp = CACHE_DATA(text->current_line);
col = (text->cursor_mark.index - lp.start.index);
new_index = data.lp.end.index;
}
/* and move the cursor */
+ XDEBUG( ("%s(%d) - FW set pos %d", __FILE__, __LINE__, new_index) );
gtk_stext_set_position_X(GTK_EDITABLE(text), new_index);
}
}
gtk_stext_kill_word (GtkEditable *editable,
gint direction)
{
- if (editable->selection_start_pos != editable->selection_end_pos) {
+ if (editable->selection_start_pos != editable->selection_end_pos)
gtk_editable_delete_selection (editable);
- }
else
{
gint old_pos = editable->current_pos;
max_display_pixels = text->wrap_rmargin * ch_width;
}
- if (GTK_EDITABLE (text)->editable || !text->word_wrap)
+ /* SYLPHEED - we don't draw ugly word wrapping thing
+ * if our wrap margin is set */
+ if (!text->wrap_rmargin &&
+ ((GTK_EDITABLE (text)->editable || !text->word_wrap)))
max_display_pixels -= LINE_WRAP_ROOM;
lp.wraps = 0;
/* If whole line is one word, revert to char wrapping */
if (lp.end.index == lp.start.index)
{
+ /* SYLPHEED: don't wrap URLs */
+ if (gtkut_stext_is_uri_string(text, lp.end.index,
+ gtk_stext_get_length(text)))
+ {
+ lp.end = saved_mark;
+ lp.displayable_chars = saved_characters + 1;
+ lp.wraps = 0;
+ goto no_url_wrap;
+ }
+
lp.end = saved_mark;
lp.displayable_chars = saved_characters;
decrement_mark (&lp.end);
lp.displayable_chars += 1;
}
+no_url_wrap:
lp.font_ascent = MAX (font->ascent, lp.font_ascent);
lp.font_descent = MAX (font->descent, lp.font_descent);
lp.pixel_width += ch_width;
pixel_width = gdk_text_width_wc (gc_values.font,
buffer.wc, len);
else
- pixel_width = gdk_text_width (gc_values.font,
+ pixel_width = gdk_text_width (gc_values.font,
buffer.ch, len);
}
else
GTK_WIDGET_DRAWABLE (text) && text->line_start_cache)
{
GdkFont* font;
- gint pixel_width, pixel_height;
- GdkGC *gc;
+ gint pixel_width;
+ gint pixel_height;
g_assert(text->cursor_mark.property);
- gc = gdk_gc_new(text->text_area);
- g_assert(gc);
- gdk_gc_copy(gc, text->gc);
-
font = MARK_CURRENT_FONT(text, &text->cursor_mark);
- /* SYLPHEED:
- * changed the cursor to a real block (TM)
- */
- if (text->cursor_type == STEXT_CURSOR_BLOCK) {
- if (text->use_wchar)
- pixel_width = gdk_char_width_wc(font, text->cursor_char);
- else
- pixel_width = gdk_char_width(font, text->cursor_char);
- pixel_width -= 1;
- pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line));
-
- draw_bg_rect (text, &text->cursor_mark,
- text->cursor_pos_x,
- text->cursor_pos_y - (pixel_height + 1),
- pixel_width + 1,
- pixel_height + 1,
- FALSE);
- }
- else {
- draw_bg_rect (text, &text->cursor_mark,
- text->cursor_pos_x - 1,
- text->cursor_pos_y - text->cursor_char_offset - font->ascent,
- 2, font->descent + font->ascent + 1, FALSE);
-
- }
-
+ /* SYLPHEED:
+ * changed the cursor to a real block (TM)
+ */
+ if (text->cursor_type == GTK_STEXT_CURSOR_BLOCK)
+ {
+ if (text->cursor_char)
+ {
+ if (text->use_wchar)
+ pixel_width = gdk_char_width_wc (font, text->cursor_char);
+ else
+ pixel_width = gdk_char_width (font, (guchar)text->cursor_char);
+ }
+ else
+ {
+ pixel_width = gdk_char_width (font, 'W');
+ }
+
+ pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line));
+
+ draw_bg_rect (text, &text->cursor_mark,
+ text->cursor_pos_x,
+ text->cursor_pos_y - (pixel_height + 1),
+ pixel_width,
+ pixel_height + 1,
+ FALSE);
+ }
+ else
+ {
+ draw_bg_rect (text, &text->cursor_mark,
+ text->cursor_pos_x,
+ text->cursor_pos_y - text->cursor_char_offset - font->ascent,
+ 2, font->descent + font->ascent + 1, FALSE);
+ }
+
if (text->cursor_char)
{
if (font->type == GDK_FONT_FONT)
gdk_gc_set_font (text->gc, font);
-
+
gdk_gc_set_foreground (text->gc, MARK_CURRENT_FORE (text, &text->cursor_mark));
-
- gdk_draw_text_wc (text->text_area, font,
- text->gc,
- text->cursor_pos_x,
- text->cursor_pos_y - text->cursor_char_offset,
- &text->cursor_char,
- 1);
+
+ if (text->use_wchar)
+ gdk_draw_text_wc (text->text_area, font,
+ text->gc,
+ text->cursor_pos_x,
+ text->cursor_pos_y - text->cursor_char_offset,
+ &text->cursor_char,
+ 1);
+ else
+ {
+ guchar ch = text->cursor_char;
+ gdk_draw_text (text->text_area, font,
+ text->gc,
+ text->cursor_pos_x,
+ text->cursor_pos_y - text->cursor_char_offset,
+ (gchar *)&ch,
+ 1);
+ }
}
-
- gdk_gc_copy(text->gc, gc);
- gdk_gc_unref(gc);
}
}
draw_cursor (GtkSText* text, gint absolute)
{
GtkEditable *editable = (GtkEditable *)text;
- gint pixel_width, pixel_height;
TDEBUG (("in draw_cursor\n"));
GTK_WIDGET_DRAWABLE (text) && text->line_start_cache)
{
GdkFont* font;
- GdkGC* gc;
+ gint pixel_width;
+ gint pixel_height;
g_assert (text->cursor_mark.property);
- gc = gdk_gc_new(text->text_area);
- g_assert (gc);
- gdk_gc_copy(gc, text->gc);
- font = MARK_CURRENT_FONT (text, &text->cursor_mark);
- if (text->cursor_type == STEXT_CURSOR_BLOCK) {
- /* SYLPHEED:
- * changed the cursor to a real block (TM)
- */
- if (text->use_wchar) {
- pixel_width = gdk_char_width_wc(font, text->cursor_char);
- }
- else {
- pixel_width = gdk_char_width(font, text->cursor_char);
- }
- pixel_width -= 1;
-
- pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line));
- gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
- gdk_gc_set_function(text->gc, GDK_INVERT);
- gdk_draw_rectangle(text->text_area, text->gc, TRUE,
- text->cursor_pos_x,
- text->cursor_pos_y - pixel_height,
- pixel_width,
- pixel_height);
- }
- else {
- gdk_gc_set_line_attributes(text->gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
- gdk_gc_set_foreground(text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
- gdk_draw_line(text->text_area, text->gc, text->cursor_pos_x,
- text->cursor_pos_y + font->descent - text->cursor_char_offset,
- text->cursor_pos_x,
- text->cursor_pos_y - text->cursor_char_offset - font->ascent );
-
- }
- gdk_gc_copy(text->gc, gc);
- gdk_gc_unref(gc);
+ font = MARK_CURRENT_FONT (text, &text->cursor_mark);
+
+ /* SYLPHEED:
+ * change the cursor to a real block (TM)
+ */
+ if (text->cursor_type == GTK_STEXT_CURSOR_BLOCK)
+ {
+ if (text->cursor_char)
+ {
+ if (text->use_wchar)
+ pixel_width = gdk_char_width_wc (font, text->cursor_char);
+ else
+ pixel_width = gdk_char_width (font, (guchar)text->cursor_char);
+ }
+ else
+ {
+ pixel_width = gdk_char_width (font, 'W');
+ }
+
+ pixel_height = LINE_HEIGHT(CACHE_DATA(text->current_line));
+
+ gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
+ gdk_gc_set_function (text->gc, GDK_INVERT);
+ gdk_draw_rectangle (text->text_area, text->gc, TRUE,
+ text->cursor_pos_x,
+ text->cursor_pos_y - pixel_height,
+ pixel_width,
+ pixel_height);
+ gdk_gc_set_function (text->gc, GDK_COPY);
+ }
+ else
+ {
+ gdk_gc_set_line_attributes(text->gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
+ gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
+
+ gdk_draw_line (text->text_area, text->gc, text->cursor_pos_x + 1,
+ text->cursor_pos_y + font->descent - text->cursor_char_offset,
+ text->cursor_pos_x + 1,
+ text->cursor_pos_y - text->cursor_char_offset - font->ascent);
+ }
}
}
* cursor timer
*/
-static gint stext_blink_timer_proc(GtkSText *text)
+static gint
+stext_blink_timer_proc (GtkSText *text)
{
- if (text->cursor_state_on) {
- text->cursor_state_on = FALSE;
- undraw_cursor(text, TRUE);
- /* kill this timer... */
- gtk_timeout_remove(text->cursor_timer_id);
- text->cursor_timer_id = gtk_timeout_add(text->cursor_off_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text);
- }
- else {
- text->cursor_state_on = TRUE;
- draw_cursor(text, TRUE);
- /* kill this timer... */
- gtk_timeout_remove(text->cursor_timer_id);
- text->cursor_timer_id = gtk_timeout_add(text->cursor_on_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text);
- }
- return TRUE;
+ if (text->cursor_state_on)
+ {
+ text->cursor_state_on = FALSE;
+ undraw_cursor (text, TRUE);
+ /* kill this timer... */
+ gtk_timeout_remove (text->cursor_timer_id);
+ text->cursor_timer_id = gtk_timeout_add (text->cursor_off_ms,
+ (GtkFunction) stext_blink_timer_proc,
+ (gpointer) text);
+ }
+ else
+ {
+ text->cursor_state_on = TRUE;
+ draw_cursor (text, TRUE);
+ /* kill this timer... */
+ gtk_timeout_remove (text->cursor_timer_id);
+ text->cursor_timer_id = gtk_timeout_add (text->cursor_on_ms,
+ (GtkFunction) stext_blink_timer_proc,
+ (gpointer) text);
+ }
+
+ return TRUE;
}
-static gint stext_idle_timer_proc(GtkSText *text)
+static gint
+stext_idle_timer_proc (GtkSText *text)
{
- /* make sure the cursor timer is off */
- if (text->cursor_timer_id) {
- gtk_timeout_remove(text->cursor_timer_id);
- text->cursor_timer_id = 0;
- }
- /* assuming it's always on when calling this function ... */
- text->cursor_state_on = TRUE;
- text->cursor_timer_id = gtk_timeout_add(text->cursor_on_ms, (GtkFunction) stext_blink_timer_proc, (gpointer) text);
- /* make sure we kill the timer (could perhaps make this function return FALSE (not documented in
- * the current docs). should check the source. */
- gtk_idle_remove( text->cursor_idle_time_timer_id );
- text->cursor_idle_time_timer_id = 0;
- return TRUE;
+ /* make sure the cursor timer is off */
+ if (text->cursor_timer_id)
+ {
+ gtk_timeout_remove (text->cursor_timer_id);
+ text->cursor_timer_id = 0;
+ }
+
+ /* assuming it's always on when calling this function ... */
+ text->cursor_state_on = TRUE;
+ text->cursor_timer_id = gtk_timeout_add (text->cursor_on_ms,
+ (GtkFunction) stext_blink_timer_proc,
+ (gpointer) text);
+ /* make sure we kill the timer (could perhaps make this function return
+ FALSE (not documented in the current docs). should check the source. */
+ gtk_idle_remove (text->cursor_idle_time_timer_id);
+ text->cursor_idle_time_timer_id = 0;
+
+ return TRUE;
}
-static void gtk_stext_enable_blink (GtkSText *text)
+static void
+gtk_stext_enable_blink (GtkSText *text)
{
- if (text->cursor_timer_on) {
- gtk_stext_disable_blink(text);
- text->cursor_idle_time_timer_id = gtk_idle_add((GtkFunction) stext_idle_timer_proc, (gpointer) text);
- }
+ if (text->cursor_timer_on)
+ {
+ gtk_stext_disable_blink (text);
+ text->cursor_idle_time_timer_id = gtk_idle_add ((GtkFunction) stext_idle_timer_proc,
+ (gpointer) text);
+ }
}
-static void gtk_stext_disable_blink (GtkSText *text)
+static void
+gtk_stext_disable_blink (GtkSText *text)
{
- if (text->cursor_timer_on) {
- if (text->cursor_idle_time_timer_id) {
- gtk_idle_remove( text->cursor_idle_time_timer_id );
- text->cursor_idle_time_timer_id = 0;
- }
- if (text->cursor_timer_id) {
- gtk_timeout_remove( text->cursor_timer_id );
- text->cursor_timer_id = 0;
- }
- draw_cursor(text, TRUE);
- }
+ if (text->cursor_timer_on)
+ {
+ if (text->cursor_idle_time_timer_id)
+ {
+ gtk_idle_remove (text->cursor_idle_time_timer_id);
+ text->cursor_idle_time_timer_id = 0;
+ }
+ if (text->cursor_timer_id)
+ {
+ gtk_timeout_remove (text->cursor_timer_id);
+ text->cursor_timer_id = 0;
+ }
+ draw_cursor(text, TRUE);
+ }
}
-void gtk_stext_set_blink(GtkSText *text, gboolean blinkin_on)
+void
+gtk_stext_set_blink (GtkSText *text, gboolean blinking_on)
{
- if (text->cursor_timer_on != blinkin_on) {
- if (text->cursor_timer_on) {
- /* text widget already created? */
- if (text->cursor_visible) {
- gtk_stext_disable_blink(text);
- }
- text->cursor_timer_on = FALSE;
- }
- else {
- if (text->cursor_visible) {
- gtk_stext_enable_blink(text);
- }
- text->cursor_timer_on = TRUE;
- }
+ if (text->cursor_timer_on != blinking_on)
+ {
+ if (text->cursor_timer_on)
+ {
+ /* text widget already created? */
+ if (text->cursor_visible)
+ {
+ gtk_stext_disable_blink (text);
+ }
+ text->cursor_timer_on = FALSE;
}
+ else
+ {
+ if (text->cursor_visible)
+ {
+ gtk_stext_enable_blink (text);
+ }
+ text->cursor_timer_on = TRUE;
+ }
+ }
}