From 2fa1ed250656c38c4ad72525dd13a030de4bf061 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Tue, 29 Feb 2000 21:43:45 +0000 Subject: Don't show the tooltip if the text is being editted or isn't clipped. 2000-02-29 Iain Holmes * widgets/e-text/e-text.c: Don't show the tooltip if the text is being editted or isn't clipped. Remove the tooltip when editting starts. * widgets/e-text/Makefile.am: Build the test program svn path=/trunk/; revision=1994 --- widgets/text/e-text.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'widgets/text') diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 8bb19728c1..daa607007e 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -1830,8 +1830,14 @@ _do_tooltip (gpointer data) gint x, y, pointer_x, pointer_y, scr_w, scr_h, tip_w, tip_h; int i; + if (text->editing) + return FALSE; + lines = text->lines; + if (lines->length <= lines->ellipsis_length) + return FALSE; + scr_w = gdk_screen_width (); scr_h = gdk_screen_height (); gdk_window_get_pointer (NULL, &pointer_x, &pointer_y, NULL); @@ -1938,6 +1944,14 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) break; case GDK_BUTTON_PRESS: /* Fall Through */ case GDK_BUTTON_RELEASE: + text->tooltip_count --; + if ( text->tooltip_count == 0 && text->clip) { + gtk_timeout_remove (text->tooltip_timeout); + if (text->tooltip_window) { + gtk_widget_destroy (text->tooltip_window); + text->tooltip_window = NULL; + } + } if ((!text->editing) && text->editable && event->type == GDK_BUTTON_RELEASE @@ -1991,9 +2005,10 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_ENTER_NOTIFY: - if ( text->tooltip_count == 0 ) + if ( text->tooltip_count == 0 && text->clip) { text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text); - text->tooltip_count ++; + text->tooltip_count ++; + } text->pointer_in = TRUE; if (text->editing) { if ( text->default_cursor_shown ) { @@ -2004,7 +2019,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) break; case GDK_LEAVE_NOTIFY: text->tooltip_count --; - if ( text->tooltip_count == 0 ) { + if ( text->tooltip_count == 0 && text->clip) { gtk_timeout_remove (text->tooltip_timeout); if (text->tooltip_window) { gtk_widget_destroy (text->tooltip_window); -- cgit