Fix the find_widget_under_pointer() code to build with GSEAL_ENABLE

This commit is contained in:
Michael Natterer
2009-11-11 21:00:14 +01:00
parent 5707f04066
commit 0715c58c13

View File

@ -1074,7 +1074,7 @@ child_location_foreach (GtkWidget *child,
struct ChildLocation *child_loc = data; struct ChildLocation *child_loc = data;
/* Ignore invisible widgets */ /* Ignore invisible widgets */
if (! GTK_WIDGET_DRAWABLE (child)) if (! gtk_widget_is_drawable (child))
return; return;
/* (child_loc->x, child_loc->y) are relative to /* (child_loc->x, child_loc->y) are relative to
@ -1086,20 +1086,24 @@ child_location_foreach (GtkWidget *child,
child_loc->x, child_loc->y, child_loc->x, child_loc->y,
&x, &y)) &x, &y))
{ {
GtkAllocation child_allocation;
gtk_widget_get_allocation (child, &child_allocation);
#ifdef DEBUG_TOOLTIP #ifdef DEBUG_TOOLTIP
g_print ("candidate: %s alloc=[(%d,%d) %dx%d] (%d, %d)->(%d, %d)\n", g_print ("candidate: %s alloc=[(%d,%d) %dx%d] (%d, %d)->(%d, %d)\n",
gtk_widget_get_name (child), gtk_widget_get_name (child),
child->allocation.x, child_allocation.x,
child->allocation.y, child_allocation.y,
child->allocation.width, child_allocation.width,
child->allocation.height, child_allocation.height,
child_loc->x, child_loc->y, child_loc->x, child_loc->y,
x, y); x, y);
#endif /* DEBUG_TOOLTIP */ #endif /* DEBUG_TOOLTIP */
/* (x, y) relative to child's allocation. */ /* (x, y) relative to child's allocation. */
if (x >= 0 && x < child->allocation.width if (x >= 0 && x < child_allocation.width
&& y >= 0 && y < child->allocation.height) && y >= 0 && y < child_allocation.height)
{ {
if (GTK_IS_CONTAINER (child)) if (GTK_IS_CONTAINER (child))
{ {
@ -1138,22 +1142,28 @@ window_to_alloc (GtkWidget *dest_widget,
gint *dest_x, gint *dest_x,
gint *dest_y) gint *dest_y)
{ {
GtkAllocation dest_allocation;
gtk_widget_get_allocation (dest_widget, &dest_allocation);
/* Translate from window relative to allocation relative */ /* Translate from window relative to allocation relative */
if (! GTK_WIDGET_NO_WINDOW (dest_widget) && dest_widget->parent) if (gtk_widget_get_has_window (dest_widget) &&
gtk_widget_get_parent (dest_widget))
{ {
gint wx, wy; gint wx, wy;
gdk_window_get_position (gtk_widget_get_window (dest_widget), &wx, &wy); gdk_window_get_position (gtk_widget_get_window (dest_widget), &wx, &wy);
/* Offset coordinates if widget->window is smaller than /* Offset coordinates if widget->window is smaller than
* widget->allocation. * widget->allocation.
*/ */
src_x += wx - dest_widget->allocation.x; src_x += wx - dest_allocation.x;
src_y += wy - dest_widget->allocation.y; src_y += wy - dest_allocation.y;
} }
else else
{ {
src_x -= dest_widget->allocation.x; src_x -= dest_allocation.x;
src_y -= dest_widget->allocation.y; src_y -= dest_allocation.y;
} }
if (dest_x) if (dest_x)