diff options
author | Kristian Rietveld <kris@imendio.com> | 2007-02-16 20:10:48 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2007-02-16 20:10:48 +0000 |
commit | 31e8b394cc0e4e84afbeb48d5e9084fec9322974 (patch) | |
tree | 76a0278e3d6551ec149e9110901975c7dac5dec8 /tests/testtooltips.c | |
parent | ee6b709ffd0e6809e9b04eeced99dc475fb7ed94 (diff) | |
download | gdk-pixbuf-31e8b394cc0e4e84afbeb48d5e9084fec9322974.tar.gz |
also handle keyboard tooltips. (#408325, Matthias Clasen).
2007-02-16 Kristian Rietveld <kris@imendio.com>
* tests/testtooltips.c (query_tooltip_text_view_cb): also handle
keyboard tooltips. (#408325, Matthias Clasen).
svn path=/trunk/; revision=17313
Diffstat (limited to 'tests/testtooltips.c')
-rw-r--r-- | tests/testtooltips.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/testtooltips.c b/tests/testtooltips.c index f0a062e76..7c3c98a62 100644 --- a/tests/testtooltips.c +++ b/tests/testtooltips.c @@ -62,14 +62,25 @@ query_tooltip_text_view_cb (GtkWidget *widget, GtkTooltip *tooltip, gpointer data) { - gint bx, by, trailing; GtkTextTag *tag = data; GtkTextIter iter; GtkTextView *text_view = GTK_TEXT_VIEW (widget); - gtk_text_view_window_to_buffer_coords (text_view, GTK_TEXT_WINDOW_TEXT, - x, y, &bx, &by); - gtk_text_view_get_iter_at_position (text_view, &iter, &trailing, bx, by); + if (keyboard_tip) + { + gint offset; + + g_object_get (text_view->buffer, "cursor-position", &offset, NULL); + gtk_text_buffer_get_iter_at_offset (text_view->buffer, &iter, offset); + } + else + { + gint bx, by, trailing; + + gtk_text_view_window_to_buffer_coords (text_view, GTK_TEXT_WINDOW_TEXT, + x, y, &bx, &by); + gtk_text_view_get_iter_at_position (text_view, &iter, &trailing, bx, by); + } if (gtk_text_iter_has_tag (&iter, tag)) gtk_tooltip_set_markup (tooltip, "Tooltip on text tag"); |