cellarea: Fix cell editing
authorMatthias Clasen <mclasen@redhat.com>
Sat, 28 Mar 2020 18:56:26 +0000 (14:56 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 28 Mar 2020 18:56:26 +0000 (14:56 -0400)
We need to translate the event coordinates to
widget-relative coordinates. This broke when
we stopped translating event coordinates in-place.

gtk/gtkcellarea.c

index 157c3bc5ed6cad22c1a5c455d53fa8baa9dcacbe..a4351d14c3aafe107fdb5a997edf6248bde6bc16 100644 (file)
@@ -1042,12 +1042,19 @@ gtk_cell_area_real_event (GtkCellArea          *area,
           GtkCellRenderer *renderer = NULL;
           GtkCellRenderer *focus_renderer;
           GdkRectangle     alloc_area;
-          gdouble          event_x, event_y;
+          double event_x, event_y;
+          int x, y;
+          GtkNative *native;
 
           /* We may need some semantics to tell us the offset of the event
            * window we are handling events for (i.e. GtkTreeView has a bin_window) */
           gdk_event_get_position (event, &event_x, &event_y);
 
+          native = gtk_widget_get_native (widget);
+          gtk_widget_translate_coordinates (GTK_WIDGET (native), widget, event_x, event_y, &x, &y);
+          event_x = x;
+          event_y = y;
+
           /* Dont try to search for an event coordinate that is not in the area, that will
            * trigger a runtime warning.
            */