summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-09-20 14:43:08 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-09-20 14:43:08 -0400
commit909e407d83db506024d7886ba3d14065e4957743 (patch)
treea9abcfc2ddbf45f3175146f357f2e921177d7e6b
parentb4cb6fedd5e033c160eed2842a6ba8b09aa3352c (diff)
downloadeclipse.platform.swt-gtk3_window_get_device_position.tar.gz
eclipse.platform.swt-gtk3_window_get_device_position.tar.xz
eclipse.platform.swt-gtk3_window_get_device_position.zip
Replace gdk_window_get_pointer with gdk_window_get_device_position GTK3gtk3_window_get_device_position
This patch replaces gdk_window_get_pointer with gdk_window_get_device_position for GTK+ 3 and higher
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java17
14 files changed, 127 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
index eeb43d3019..a61deed40f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -569,7 +569,7 @@ public DropTargetEffect getDropTargetEffect() {
int getOperationFromKeyState() {
int[] state = new int[1];
- OS.gdk_window_get_pointer(0, null, null, state);
+ gdk_window_get_device_position (0, null, null, state);
boolean ctrl = (state[0] & OS.GDK_CONTROL_MASK) != 0;
boolean shift = (state[0] & OS.GDK_SHIFT_MASK) != 0;
if (ctrl && shift) return DND.DROP_LINK;
@@ -813,4 +813,21 @@ void updateDragOverHover(long delay, DNDEvent event) {
dragOverEvent.time = event.time;
}
+int /*long*/ gdk_window_get_device_position (int /*long*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ int /*long*/ display = 0;
+ if( window != 0) {
+ display = OS.gdk_window_get_display (window);
+ } else {
+ window = OS.gdk_get_default_root_window ();
+ display = OS.gdk_window_get_display (window);
+ }
+ int /*long*/ device_manager = OS.gdk_display_get_device_manager (display);
+ int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager);
+ return OS.gdk_window_get_device_position(window, pointer, x, y, mask);
+ } else {
+ return OS.gdk_window_get_pointer (window, x, y, mask);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 4e3b0f2d57..dde4b9ec50 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -6762,6 +6762,36 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1children)
}
#endif
+#ifndef NO__1gdk_1window_1get_1device_1position
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1device_1position)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jintArray arg3, jintArray arg4)
+{
+ jint *lparg2=NULL;
+ jint *lparg3=NULL;
+ jint *lparg4=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1device_1position_FUNC);
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)gdk_window_get_device_position((GdkWindow *)arg0, (GdkDevice *)arg1, (gint *)lparg2, (gint *)lparg3, (GdkModifierType *)lparg4);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_window_get_device_position)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *, GdkDevice *, gint *, gint *, GdkModifierType *))fp)((GdkWindow *)arg0, (GdkDevice *)arg1, (gint *)lparg2, (gint *)lparg3, (GdkModifierType *)lparg4);
+ }
+ }
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
+ if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1device_1position_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1window_1get_1display
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1display)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -6891,7 +6921,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1get_1pointer)
if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+/*
rc = (jintLong)gdk_window_get_pointer((GdkWindow *)arg0, (gint *)lparg1, (gint *)lparg2, (GdkModifierType *)lparg3);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_window_get_pointer)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *, gint *, gint *, GdkModifierType *))fp)((GdkWindow *)arg0, (gint *)lparg1, (gint *)lparg2, (GdkModifierType *)lparg3);
+ }
+ }
fail:
if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 08633b994f..86a3cdb097 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -217,6 +217,8 @@
#define gdk_window_lookup_LIB LIB_GDK
#define gdk_window_restack_LIB LIB_GDK
#define gdk_window_get_height_LIB LIB_GDK
+#define gdk_window_get_device_position_LIB LIB_GDK
+#define gdk_window_get_pointer_LIB LIB_GDK
#define gdk_window_get_width_LIB LIB_GDK
#define gdk_pixmap_get_size_LIB LIB_GDK
#define gdk_window_get_display_LIB LIB_GDK
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 2dbd895edf..76a2ed511f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1345;
-int OS_nativeFunctionCallCount[1345];
+int OS_nativeFunctionCount = 1346;
+int OS_nativeFunctionCallCount[1346];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -540,6 +540,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1window_1end_1paint",
"_1gdk_1window_1focus",
"_1gdk_1window_1get_1children",
+ "_1gdk_1window_1get_1device_1position",
"_1gdk_1window_1get_1display",
"_1gdk_1window_1get_1events",
"_1gdk_1window_1get_1frame_1extents",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 607863df6f..9b8c7a1a45 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -548,6 +548,7 @@ typedef enum {
_1gdk_1window_1end_1paint_FUNC,
_1gdk_1window_1focus_FUNC,
_1gdk_1window_1get_1children_FUNC,
+ _1gdk_1window_1get_1device_1position_FUNC,
_1gdk_1window_1get_1display_FUNC,
_1gdk_1window_1get_1events_FUNC,
_1gdk_1window_1get_1frame_1extents_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 421703038c..ec3756b96f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -5209,6 +5209,7 @@ public static final int /*long*/ gdk_window_get_parent(int /*long*/ window) {
}
}
/**
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param x cast=(gint *)
* @param y cast=(gint *)
@@ -5224,6 +5225,23 @@ public static final int /*long*/ gdk_window_get_pointer(int /*long*/ window, int
}
}
/**
+ * @method flags=dynamic
+ * @param window cast=(GdkWindow *)
+ * @param device cast=(GdkDevice *)
+ * @param x cast=(gint *)
+ * @param y cast=(gint *)
+ * @param mask cast=(GdkModifierType *)
+ */
+public static final native int /*long*/ _gdk_window_get_device_position(int /*long*/ window, int /*long*/ device, int[] x, int[] y, int[] mask);
+public static final int /*long*/ gdk_window_get_device_position(int /*long*/ window, int /*long*/ device, int[] x, int[] y, int[] mask) {
+ lock.lock();
+ try {
+ return _gdk_window_get_device_position(window, device, x, y, mask);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param window cast=(GdkWindow *)
* @param x cast=(gint *)
* @param y cast=(gint *)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 91407953dd..79f61985a5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -336,7 +336,7 @@ void hookEvents () {
int /*long*/ hoverProc (int /*long*/ widget) {
int [] x = new int [1], y = new int [1], mask = new int [1];
- OS.gdk_window_get_pointer (0, x, y, mask);
+ gdk_window_get_device_position (0, x, y, mask);
sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x [0], y [0], false, mask [0]);
/* Always return zero in order to cancel the hover timer */
return 0;
@@ -2248,7 +2248,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean
quit = true;
}
int [] newX = new int [1], newY = new int [1];
- OS.gdk_window_get_pointer (gdkMotionEvent.window, newX, newY, null);
+ gdk_window_get_device_position (gdkMotionEvent.window, newX, newY, null);
break;
}
case OS.GDK_KEY_PRESS:
@@ -3105,7 +3105,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
if (gdkEvent.is_hint != 0) {
int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
int /*long*/ window = eventWindow ();
- OS.gdk_window_get_pointer (window, pointer_x, pointer_y, mask);
+ gdk_window_get_device_position (window, pointer_x, pointer_y, mask);
x = pointer_x [0];
y = pointer_y [0];
state = mask [0];
@@ -3117,7 +3117,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
int /*long*/ gtk_popup_menu (int /*long*/ widget) {
if (!hasFocus()) return 0;
int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, null);
+ gdk_window_get_device_position (0, x, y, null);
return showMenu (x [0], y [0], SWT.MENU_KEYBOARD) ? 1 : 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index d478017676..1d29c8305c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1514,7 +1514,7 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long*
public Point getCursorLocation () {
checkDevice ();
int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, null);
+ gdk_window_get_device_position (0, x, y, null);
return new Point (x [0], y [0]);
}
@@ -4397,4 +4397,21 @@ int /*long*/ windowTimerProc (int /*long*/ handle) {
return widget.timerProc (handle);
}
+int /*long*/ gdk_window_get_device_position (int /*long*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ int /*long*/ display = 0;
+ if( window != 0) {
+ display = OS.gdk_window_get_display (window);
+ } else {
+ window = OS.gdk_get_default_root_window ();
+ display = OS.gdk_window_get_display (window);
+ }
+ int /*long*/ device_manager = OS.gdk_display_get_device_manager (display);
+ int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager);
+ return OS.gdk_window_get_device_position(window, pointer, x, y, mask);
+ } else {
+ return OS.gdk_window_get_pointer (window, x, y, mask);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index dbc04e8c55..a440e89117 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -343,7 +343,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr
int eventX, eventY, eventState;
if (gdkEvent.is_hint != 0) {
int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
- OS.gdk_window_get_pointer (gdkEvent.window, pointer_x, pointer_y, mask);
+ gdk_window_get_device_position (gdkEvent.window, pointer_x, pointer_y, mask);
eventX = pointer_x [0];
eventY = pointer_y [0];
eventState = mask [0];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 5f1a5416bc..d24d63bfff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -2153,7 +2153,7 @@ void showWidget () {
int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
int offset = 16;
int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (0, x, y, null);
+ gdk_window_get_device_position (0, x, y, null);
y [0] += offset;
int /*long*/ screen = OS.gdk_screen_get_default ();
if (screen != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 742d742ead..fce3c0cad2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -957,7 +957,7 @@ public void setEnabled (boolean enabled) {
* button if the pointer is within its bounds.
*/
int [] x = new int [1], y = new int [1];
- OS.gdk_window_get_pointer (parent.paintWindow (), x, y, null);
+ gdk_window_get_device_position (parent.paintWindow (), x, y, null);
if (getBounds ().contains (x [0], y [0])) {
OS.gtk_widget_hide (handle);
OS.gtk_widget_show (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 2dd7b19b88..f01a1e64c4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -356,7 +356,7 @@ Point getLocation () {
}
if (x == -1 || y == -1) {
int [] px = new int [1], py = new int [1];
- OS.gdk_window_get_pointer (0, px, py, null);
+ gdk_window_get_device_position (0, px, py, null);
x = px [0];
y = py [0];
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index 17f929b3db..1c763b9527 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -203,7 +203,7 @@ Point adjustMoveCursor () {
* actual location of the pointer after it has been moved.
*/
int [] actualX = new int [1], actualY = new int [1], state = new int [1];
- OS.gdk_window_get_pointer (window, actualX, actualY, state);
+ gdk_window_get_device_position (window, actualX, actualY, state);
return new Point (actualX [0], actualY [0]);
}
@@ -236,7 +236,7 @@ Point adjustResizeCursor () {
* actual location of the pointer after it has been moved.
*/
int [] actualX = new int [1], actualY = new int [1], state = new int [1];
- OS.gdk_window_get_pointer (window, actualX, actualY, state);
+ gdk_window_get_device_position (window, actualX, actualY, state);
return new Point (actualX [0], actualY [0]);
}
@@ -523,7 +523,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr
int /*long*/ gtk_mouse (int eventType, int /*long*/ widget, int /*long*/ eventPtr) {
int [] newX = new int [1], newY = new int [1];
- OS.gdk_window_get_pointer (window, newX, newY, null);
+ gdk_window_get_device_position (window, newX, newY, null);
if (oldX != newX [0] || oldY != newY [0]) {
Rectangle [] oldRectangles = rectangles;
Rectangle [] rectsToErase = new Rectangle [rectangles.length];
@@ -672,7 +672,7 @@ public boolean open () {
update ();
drawRectangles (rectangles);
int [] oldX = new int [1], oldY = new int [1], state = new int [1];
- OS.gdk_window_get_pointer (window, oldX, oldY, state);
+ gdk_window_get_device_position (window, oldX, oldY, state);
/*
* if exactly one of UP/DOWN is specified as a style then set the cursor
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index afe1444725..f8893270f0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1866,6 +1866,23 @@ int gdk_pointer_grab (int /*long*/ window, int grab_ownership, boolean owner_eve
}
}
+int /*long*/ gdk_window_get_device_position (int /*long*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ int /*long*/ display = 0;
+ if( window != 0) {
+ display = OS.gdk_window_get_display (window);
+ } else {
+ window = OS.gdk_get_default_root_window ();
+ display = OS.gdk_window_get_display (window);
+ }
+ int /*long*/ device_manager = OS.gdk_display_get_device_manager (display);
+ int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager);
+ return OS.gdk_window_get_device_position(window, pointer, x, y, mask);
+ } else {
+ return OS.gdk_window_get_pointer (window, x, y, mask);
+ }
+}
+
/**
* Returns a string containing a concise, human-readable
* description of the receiver.