[planner: 22/32] gantt-row: Drop usage of deprecated gdk_window_get_pointer()




commit 055e4bff40194106274f9f1c5839e1b457020780
Author: Mart Raudsepp <leio gentoo org>
Date:   Sun Jun 13 12:27:06 2021 +0300

    gantt-row: Drop usage of deprecated gdk_window_get_pointer()

 src/planner-gantt-row.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/planner-gantt-row.c b/src/planner-gantt-row.c
index 1f467239..31d06402 100644
--- a/src/planner-gantt-row.c
+++ b/src/planner-gantt-row.c
@@ -2041,6 +2041,22 @@ gantt_row_disconnect_all_resources (MrpTask *task, PlannerGanttRow *row)
        g_list_free (resources);
 }
 
+static void
+gantt_row_get_window_pointer_position (GdkWindow *window,
+                                       gint      *x,
+                                       gint      *y)
+{
+       GdkDisplay       *display;
+       GdkDeviceManager *device_manager;
+       GdkDevice        *device;
+
+       display = gdk_window_get_display (window);
+       device_manager = gdk_display_get_device_manager (display);
+       device = gdk_device_manager_get_client_pointer (device_manager);
+
+       gdk_window_get_device_position (window, device, x, y, NULL);
+}
+
 static gboolean
 gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
 {
@@ -2067,7 +2083,7 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
        /* Get the current mouse position so that we can decide if the pointer
         * is inside the viewport.
         */
-       gdk_window_get_pointer (gtk_widget_get_window (GTK_WIDGET (canvas)), &x, &y, NULL);
+       gantt_row_get_window_pointer_position (gtk_widget_get_window (GTK_WIDGET (canvas)), &x, &y);
 
        gnome_canvas_get_scroll_offsets (canvas, &cx, &cy);
 
@@ -2550,7 +2566,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
                if (event->motion.is_hint) {
                        gint x, y;
 
-                       gdk_window_get_pointer (event->motion.window, &x, &y, NULL);
+                       gantt_row_get_window_pointer_position (event->motion.window, &x, &y);
                        gnome_canvas_window_to_world(item->canvas, x, y, &event->motion.x, &event->motion.y);
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]