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/e-text/Makefile.am | 13 +++++++++++++ widgets/e-text/e-text.c | 21 ++++++++++++++++++--- widgets/text/e-text.c | 21 ++++++++++++++++++--- 3 files changed, 49 insertions(+), 6 deletions(-) (limited to 'widgets') diff --git a/widgets/e-text/Makefile.am b/widgets/e-text/Makefile.am index ec7795f283..d0ee56e5e1 100644 --- a/widgets/e-text/Makefile.am +++ b/widgets/e-text/Makefile.am @@ -11,3 +11,16 @@ libetext_a_SOURCES = \ e-text-event-processor.h \ e-text-event-processor-emacs-like.c \ e-text-event-processor-emacs-like.h + +noinst_PROGRAMS = \ + e-text-test + +e_text_test_SOURCES = \ + e-text-test.c + +e_text_test_LDADD = \ + libetext.a \ + $(EXTRA_GNOME_LIBS) \ + $(top_builddir)/e-util/libeutil.la + +e_text_test_LDFLAGS = `gnome-config --libs gdk_pixbuf` diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index 8bb19728c1..daa607007e 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-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); 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 v1.2.3