summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/desktop-events.cpp10
-rw-r--r--src/widgets/desktop-widget.cpp9
2 files changed, 16 insertions, 3 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index ae198f5c1..b16cebee2 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -84,12 +84,18 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
int wx, wy;
SPDesktop *desktop = dtw->desktop;
+ GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(dtw->canvas));
- gdk_window_get_pointer(gtk_widget_get_window (GTK_WIDGET(dtw->canvas)), &wx, &wy, NULL);
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDisplay *display = gdk_window_get_display(window);
+ gdk_window_get_device_position(window, display->core_pointer, &wx, &wy, NULL);
+#else
+ gdk_window_get_pointer(window, &wx, &wy, NULL);
+#endif
Geom::Point const event_win(wx, wy);
gint width, height;
- gdk_window_get_geometry(gtk_widget_get_window (GTK_WIDGET(dtw->canvas)), NULL /*x*/, NULL /*y*/, &width, &height, NULL/*depth*/);
+ gdk_window_get_geometry(window, NULL /*x*/, NULL /*y*/, &width, &height, NULL/*depth*/);
switch (event->type) {
case GDK_BUTTON_PRESS:
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index bb1a0908c..fd529e959 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -253,7 +253,14 @@ Geom::Point
SPDesktopWidget::window_get_pointer()
{
gint x,y;
- gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(canvas)), &x, &y, NULL);
+ GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(canvas));
+
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDisplay *display = gdk_window_get_display(window);
+ gdk_window_get_device_position(window, display->core_pointer, &x, &y, NULL);
+#else
+ gdk_window_get_pointer(window, &x, &y, NULL);
+#endif
return Geom::Point(x,y);
}