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
This commit is contained in:
Kristian Rietveld 2007-02-16 20:10:48 +00:00 committed by Kristian Rietveld
parent ee6b709ffd
commit 31e8b394cc
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2007-02-16 Kristian Rietveld <kris@imendio.com>
* tests/testtooltips.c (query_tooltip_text_view_cb): also handle
keyboard tooltips. (#408325, Matthias Clasen).
2007-02-16 Xan Lopez <xan@gnome.org>
* gtk/gtkcombobox.c (gtk_combo_box_expose_event): Cleanup the logic

View File

@ -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");