mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
tooltip: query tooltip on widget under pointer only
When changing the tooltip text or markup of widget A, we simulate a motion event on that widget to update the display. But if there is an active tooltip on widget B, then the current code belives we moved the pointer from B to A thus hides/shows the tooltip of B alternatively. Instead, simulate the motion event on the widget currently under the pointer. This will avoid flickering if we keep the pointer over widget B. Fixes #6674 Closes #6674
This commit is contained in:
parent
de5b6764bc
commit
d665274eb1
@ -366,9 +366,10 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
|||||||
GdkSeat *seat;
|
GdkSeat *seat;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double x, y;
|
double px, py;
|
||||||
graphene_point_t p;
|
int x, y;
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
|
GtkWidget *target_widget;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
@ -381,7 +382,7 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
|||||||
else
|
else
|
||||||
device = NULL;
|
device = NULL;
|
||||||
if (device)
|
if (device)
|
||||||
surface = gdk_device_get_surface_at_position (device, &x, &y);
|
surface = gdk_device_get_surface_at_position (device, &px, &py);
|
||||||
else
|
else
|
||||||
surface = NULL;
|
surface = NULL;
|
||||||
if (!surface)
|
if (!surface)
|
||||||
@ -395,10 +396,12 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
|||||||
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
|
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!gtk_widget_compute_point (toplevel, widget, &GRAPHENE_POINT_INIT (x, y), &p))
|
x = round (px);
|
||||||
graphene_point_init (&p, x, y);
|
y = round (py);
|
||||||
|
|
||||||
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, p.x, p.y);
|
target_widget = _gtk_widget_find_at_coords (surface, x, y, &x, &y);
|
||||||
|
|
||||||
|
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, target_widget, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user