With the callback below the tooltip removes itself when the mouse leaves a word and pops up when I move to a different word (what I wanted) . It didn't with the previous bare-bone version. Any idea why? However, the callback is still called when the mouse moves. In this version tracing also goes to the window title bar. static gboolean querytooltipcb (GtkWidget * w, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data ) { printf ( "querytooltip(%d): x=%d y=%d kbm=%d tip=%d\n" , counter , x , y , keyboard_mode ? 1 : 0, (int)tooltip ) ; char text [ 2000 ] ; int x1 ; int y1 ; GtkTextIter iter ; gtk_text_view_window_to_buffer_coords((GtkTextView *)w, GTK_TEXT_WINDOW_WIDGET, x , y , &x1 , &y1 ); gtk_text_view_get_iter_at_location ( (GtkTextView *)w , &iter , x1 , y1 ) ; GtkTextIter startiter = iter ; GtkTextIter enditer = iter ; if ( gtk_text_iter_starts_word ( &iter ) ) { gtk_text_iter_forward_word_end ( &enditer ) ; } else if ( gtk_text_iter_inside_word ( &iter ) ) { gtk_text_iter_forward_word_end ( &enditer ) ; gtk_text_iter_backward_word_start ( &startiter ) ; } else if ( gtk_text_iter_ends_word ( &iter ) ) { gtk_text_iter_backward_word_start ( &startiter ) ; } else { sprintf ( text , "Not in word, Hi #%d (%d,%d)\n" , counter , x , y ) ; gtk_window_set_title (GTK_WINDOW (window), text ); counter++; return false ; } GtkTextBuffer * buf = (GtkTextBuffer *)data ; TCHAR * word = gtk_text_buffer_get_text ( buf , &startiter , &enditer , false ) ; gtk_tooltip_set_text ( tooltip, word ); sprintf ( text , "Word=%s Hello #%d (%d,%d)\n" , word , counter , x , y ) ; gtk_window_set_title (GTK_WINDOW (window), text ); counter++; return TRUE ; } Ken --- On Thu, 20/5/10, Tadej Borovšak <tadeboro@xxxxxxxxx> wrote:
|
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list