I have an application for which the user can open context menus inside a tree view. To get the current path after a right mouse click I use
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), event_button->x, event_button->y, &path, NULL, NULL, NULL)
, (event_button is of type GdkEventButton, which has been passed to the function)
which always reliably returns the correct path. I have ported my application to GTK4 now, where it is no longer possible to directly access the elements of an event. So I thought the way to go would be getting the coordinates by using
gdk_event_get_coords (event, &x_win, &y_win)
(x_win and y_win are of type double)
and then
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), (gint) x_win, (gint) y_win, &path, NULL, NULL, NULL)
.
However, with the coordinates received by gdk_event_get_coords
I always end up with the following path inside the tree view (x_win delivers the value as expected). How can I retrieve the same values as in GTK3?