forked from AuroraMiddleware/gtk
gtkwidget: Avoid doubly coordinate conversion when emulating press
We are poking again into the event propagation machinery, which expects events in toplevel coordinates. Since we can't fetch the original event back at this point, translate the coordinates back to the toplevel so the emulated press ends up in the right place. https://gitlab.gnome.org/GNOME/gtk/issues/1159 Closes: #1159
This commit is contained in:
parent
64313f4a4b
commit
de30a74cdf
@ -2523,12 +2523,20 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
||||
{
|
||||
GtkWidget *event_widget, *next_child, *parent;
|
||||
GdkEvent *press;
|
||||
gdouble x, y;
|
||||
|
||||
event_widget = gtk_get_event_target ((GdkEvent *) event);
|
||||
|
||||
if (event_widget == widget)
|
||||
return;
|
||||
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
gtk_widget_translate_coordinatesf (event_widget,
|
||||
gtk_widget_get_toplevel (event_widget),
|
||||
x, y,
|
||||
&x, &y);
|
||||
gdk_event_set_coords (event, x, y);
|
||||
|
||||
if (event->any.type == GDK_TOUCH_BEGIN ||
|
||||
event->any.type == GDK_TOUCH_UPDATE ||
|
||||
event->any.type == GDK_TOUCH_END)
|
||||
|
Loading…
Reference in New Issue
Block a user