translate coordinates from the window they were received on to the event
2007-05-23 Kristian Rietveld <kris@imendio.com> * gtk/gtktooltip.c (find_widget_under_pointer): translate coordinates from the window they were received on to the event widget's window; correct for no-window widgets after that, bail out on failure. This makes the coordinates given by GtkWidget::query-tooltip truly relative to widget->window. (#435188). * gtk/gtkwidget.c (gtk_widget_class_init): update docs for GtkWidget::query-tooltip. svn path=/trunk/; revision=17896
This commit is contained in:
parent
858c08aea6
commit
5e59105ea3
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-05-23 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtktooltip.c (find_widget_under_pointer): translate coordinates
|
||||
from the window they were received on to the event widget's window;
|
||||
correct for no-window widgets after that, bail out on failure. This
|
||||
makes the coordinates given by GtkWidget::query-tooltip truly relative
|
||||
to widget->window. (#435188).
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_class_init): update docs for
|
||||
GtkWidget::query-tooltip.
|
||||
|
||||
2007-05-22 Behdad Esfahbod <behdad@gnome.org>
|
||||
|
||||
* gtk/gtkprintcontext.c (gtk_print_context_finalize),
|
||||
|
@ -463,6 +463,32 @@ find_widget_under_pointer (GdkWindow *window,
|
||||
child_loc.y = *y;
|
||||
|
||||
gdk_window_get_user_data (window, (void **)&event_widget);
|
||||
|
||||
while (window && window != event_widget->window)
|
||||
{
|
||||
gint px, py;
|
||||
|
||||
gdk_window_get_position (window, &px, &py);
|
||||
child_loc.x += px;
|
||||
child_loc.y += py;
|
||||
|
||||
window = gdk_window_get_parent (window);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_NO_WINDOW (event_widget))
|
||||
{
|
||||
child_loc.x += event_widget->allocation.x;
|
||||
child_loc.y += event_widget->allocation.y;
|
||||
}
|
||||
|
||||
/* Failing to find widget->window can happen for e.g. a detached handle box;
|
||||
* chaining ::query-tooltip up to its parent probably makes little sense,
|
||||
* and users better implement tooltips on handle_box->child.
|
||||
* so we simply ignore the event for tooltips here.
|
||||
*/
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
if (GTK_IS_CONTAINER (event_widget))
|
||||
{
|
||||
window_to_alloc (event_widget,
|
||||
|
@ -1514,9 +1514,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
* GtkWidget::query-tooltip:
|
||||
* @widget: the object which received the signal
|
||||
* @x: the x coordinate of the cursor position where the request has been
|
||||
* emitted, relative to the widget's allocation
|
||||
* emitted, relative to widget->window
|
||||
* @y: the y coordinate of the cursor position where the request has been
|
||||
* emitted, relative to the widget's allocation
|
||||
* emitted, relative to widget->window
|
||||
* @keyboard_mode: %TRUE if the tooltip was trigged using the keyboard
|
||||
* @tooltip: a #GtkTooltip
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user