Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-03 18:55:53 +0000
committerAlexander Kurtakov2012-10-04 11:53:08 +0000
commitc159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4 (patch)
treeb10eac79ff016219c25e1c2b8f609b109bc15887
parenta025bf9445abd24cfb0807a29038b2face3f0f8a (diff)
downloadeclipse.platform.swt-c159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4.tar.gz
eclipse.platform.swt-c159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4.tar.xz
eclipse.platform.swt-c159a9553ef0699a68dfd8ee6cae8e56f4b4ccb4.zip
Replace gdk_window_get_pointer with gdk_window_get_device_position GTK3
-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.c1
-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, 125 insertions, 14 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 ba9ced6489..b837c7f34d 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;
}
+long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ long /*int*/ 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);
+ }
+ long /*int*/ device_manager = OS.gdk_display_get_device_manager (display);
+ long /*int*/ 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 867d31aee3..e35bed5645 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
@@ -6840,6 +6840,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)
@@ -6969,7 +6999,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 d4be088725..bde1484b03 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
@@ -229,6 +229,8 @@
#define gdk_window_create_similar_surface_LIB LIB_GDK
#define gdk_window_lookup_LIB LIB_GDK
#define gdk_window_restack_LIB LIB_GDK
+#define gdk_window_get_device_position_LIB LIB_GDK
+#define gdk_window_get_pointer_LIB LIB_GDK
#define gdk_window_get_height_LIB LIB_GDK
#define gdk_window_get_width_LIB LIB_GDK
#define gdk_pixmap_get_size_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 51c3c32379..b4c5e216c4 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
@@ -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 84c09ff0ff..af36d4490c 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
@@ -550,6 +550,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 1b35784eff..2c75cdc633 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
@@ -5236,6 +5236,23 @@ public static final int gdk_window_get_origin(long /*int*/ window, int[] x, int[
lock.unlock();
}
}
+/**
+ * @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 long /*int*/ _gdk_window_get_device_position(long /*int*/ window, long /*int*/ device, int[] x, int[] y, int[] mask);
+public static final long /*int*/ gdk_window_get_device_position(long /*int*/ window, long /*int*/ 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 *) */
public static final native long /*int*/ _gdk_window_get_parent(long /*int*/ window);
public static final long /*int*/ gdk_window_get_parent(long /*int*/ window) {
@@ -5247,6 +5264,7 @@ public static final long /*int*/ gdk_window_get_parent(long /*int*/ window) {
}
}
/**
+ * @method flags=dynamic
* @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 98260057c0..d8143d22e8 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 () {
long /*int*/ hoverProc (long /*int*/ 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 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) {
if (gdkEvent.is_hint != 0) {
int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
long /*int*/ 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 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ gtk_popup_menu (long /*int*/ 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 eb66197b83..c6814080a4 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
@@ -1518,7 +1518,7 @@ long /*int*/ filterProc (long /*int*/ xEvent, long /*int*/ gdkEvent, long /*int*
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]);
}
@@ -4403,4 +4403,21 @@ long /*int*/ windowTimerProc (long /*int*/ handle) {
return widget.timerProc (handle);
}
+long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ long /*int*/ 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);
+ }
+ long /*int*/ device_manager = OS.gdk_display_get_device_manager (display);
+ long /*int*/ 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 49c25629b4..ee85b2f498 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
@@ -345,7 +345,7 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ 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 2306ee6270..294d7a030c 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
@@ -2180,7 +2180,7 @@ void showWidget () {
long /*int*/ sizeAllocateProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ 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;
long /*int*/ 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 b88ece03c1..b1cfc6096d 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 92ec814d9e..6ba97d92db 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 0e632a4603..c97bb431cc 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 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ eventPtr
long /*int*/ gtk_mouse (int eventType, long /*int*/ widget, long /*int*/ 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 02a53662e1..ed56af4328 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
@@ -2014,4 +2014,21 @@ void gdk_cursor_unref (long /*int*/ cursor) {
}
}
+long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[] y, int[] mask) {
+ if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) {
+ long /*int*/ 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);
+ }
+ long /*int*/ device_manager = OS.gdk_display_get_device_manager (display);
+ long /*int*/ 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);
+ }
+}
+
}

Back to the top