summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-03 14:23:32 -0400
committerAlexander Kurtakov <akurtako@redhat.com>2012-10-04 23:33:27 +0300
commita4e8d53a7f3afac8a7698d325365123a4d399a8c (patch)
treef47b8817d355d4a33a2b226f8b44def62ff81e42
parentf595bd26249b063ab16f669e49ee726a84b4ab51 (diff)
downloadeclipse.platform.swt-a4e8d53a7f3afac8a7698d325365123a4d399a8c.tar.gz
eclipse.platform.swt-a4e8d53a7f3afac8a7698d325365123a4d399a8c.tar.xz
eclipse.platform.swt-a4e8d53a7f3afac8a7698d325365123a4d399a8c.zip
Use gdk_device_get_window_at_position instead of gdk_window_at_pointer
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c35
-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.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java12
7 files changed, 77 insertions, 2 deletions
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 9029c72241..b44af1161e 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
@@ -4904,6 +4904,33 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1device_1get_1associated_1device)
}
#endif
+#ifndef NO__1gdk_1device_1get_1window_1at_1position
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1device_1get_1window_1at_1position)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2)
+{
+ jint *lparg1=NULL;
+ jint *lparg2=NULL;
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1device_1get_1window_1at_1position_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)gdk_device_get_window_at_position(arg0, (gint *)lparg1, (gint *)lparg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_device_get_window_at_position)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, gint *, gint *))fp)(arg0, (gint *)lparg1, (gint *)lparg2);
+ }
+ }
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1gdk_1device_1get_1window_1at_1position_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1device_1grab
JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1device_1grab)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jboolean arg3, jint arg4, jintLong arg5, jint arg6)
@@ -6756,7 +6783,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1window_1at_1pointer)
OS_NATIVE_ENTER(env, that, _1gdk_1window_1at_1pointer_FUNC);
if (arg0) if ((lparg0 = (*env)->GetIntArrayElements(env, arg0, NULL)) == NULL) goto fail;
if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+/*
rc = (jintLong)gdk_window_at_pointer((gint *)lparg0, (gint *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_window_at_pointer)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(gint *, gint *))fp)((gint *)lparg0, (gint *)lparg1);
+ }
+ }
fail:
if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
if (arg0 && lparg0) (*env)->ReleaseIntArrayElements(env, arg0, lparg0, 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 0bb1de9c8e..942698e5e0 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
@@ -174,6 +174,7 @@
#define gdk_cursor_new_from_pixbuf_LIB LIB_GDK
#define gdk_cursor_unref_LIB LIB_GDK
#define gdk_device_manager_get_client_pointer_LIB LIB_GDK
+#define gdk_device_get_window_at_position_LIB LIB_GDK
#define gdk_device_grab_LIB LIB_GDK
#define gdk_device_ungrab_LIB LIB_GDK
#define gdk_display_get_device_manager_LIB LIB_GDK
@@ -231,6 +232,7 @@
#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_at_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 24aea91661..3559ae0c39 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
@@ -420,6 +420,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1cursor_1new_1from_1pixmap",
"_1gdk_1cursor_1unref",
"_1gdk_1device_1get_1associated_1device",
+ "_1gdk_1device_1get_1window_1at_1position",
"_1gdk_1device_1grab",
"_1gdk_1device_1manager_1get_1client_1pointer",
"_1gdk_1device_1ungrab",
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 3b1b9bdbed..a802197f31 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
@@ -430,6 +430,7 @@ typedef enum {
_1gdk_1cursor_1new_1from_1pixmap_FUNC,
_1gdk_1cursor_1unref_FUNC,
_1gdk_1device_1get_1associated_1device_FUNC,
+ _1gdk_1device_1get_1window_1at_1position_FUNC,
_1gdk_1device_1grab_FUNC,
_1gdk_1device_1manager_1get_1client_1pointer_FUNC,
_1gdk_1device_1ungrab_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 0fb80d5ebd..481f4fe151 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
@@ -3718,6 +3718,20 @@ public static final long /*int*/ gdk_device_manager_get_client_pointer(long /*in
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param win_x cast=(gint *)
+ * @param win_y cast=(gint *)
+ */
+public static final native long /*int*/ _gdk_device_get_window_at_position(long /*int*/ device, int[] win_x, int[] win_y);
+public static final long /*int*/ gdk_device_get_window_at_position(long /*int*/ device, int[] win_x, int[] win_y) {
+ lock.lock();
+ try {
+ return _gdk_device_get_window_at_position(device, win_x, win_y);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=dynamic */
public static final native boolean _gdk_display_supports_cursor_color(long /*int*/ display);
public static final boolean gdk_display_supports_cursor_color(long /*int*/ display) {
@@ -5106,6 +5120,7 @@ public static final long /*int*/ gdk_visual_get_system() {
}
}
/**
+ * @method flags=dynamic
* @param win_x cast=(gint *)
* @param win_y cast=(gint *)
*/
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 c6814080a4..a72736c1c9 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
@@ -1418,7 +1418,7 @@ public Control getCursorControl () {
int[] x = new int[1], y = new int[1];
long /*int*/ handle = 0;
long /*int*/ [] user_data = new long /*int*/ [1];
- long /*int*/ window = OS.gdk_window_at_pointer (x,y);
+ long /*int*/ window = gdk_device_get_window_at_position (x,y);
if (window != 0) {
OS.gdk_window_get_user_data (window, user_data);
handle = user_data [0];
@@ -4420,4 +4420,15 @@ long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[]
}
}
+long /*int*/ gdk_device_get_window_at_position (int[] win_x, int[] win_y) {
+ if (OS.GTK_VERSION >= OS.VERSION(3,0,0)) {
+ long /*int*/ display = OS.gdk_display_get_default ();
+ long /*int*/ device_manager = OS.gdk_display_get_device_manager (display);
+ long /*int*/ device = OS.gdk_device_manager_get_client_pointer (device_manager);
+ return OS.gdk_device_get_window_at_position (device, win_x, win_y);
+ } else {
+ return OS.gdk_window_at_pointer (win_x, win_y);
+ }
+}
+
}
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 d8dac6457d..7e73baeea7 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
@@ -2540,7 +2540,7 @@ void setToolTipText (long /*int*/ rootWidget, long /*int*/ tipWidget, String str
if (tipWindow != 0) {
if (gtk_widget_get_visible (tipWidget) || gtk_widget_get_realized (tipWidget)) {
int [] x = new int [1], y = new int [1];
- long /*int*/ window = OS.gdk_window_at_pointer (x, y);
+ long /*int*/ window = gdk_device_get_window_at_position (x, y);
if (window != 0) {
long /*int*/ [] user_data = new long /*int*/ [1];
OS.gdk_window_get_user_data (window, user_data);
@@ -2580,4 +2580,14 @@ void gtk_render_box (long /*int*/ style, long /*int*/ window, int state_type, in
OS.gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
}
+long /*int*/ gdk_device_get_window_at_position (int[] win_x, int[] win_y) {
+ if (OS.GTK_VERSION >= OS.VERSION(3,0,0)) {
+ long /*int*/ display = OS.gdk_display_get_default ();
+ long /*int*/ device_manager = OS.gdk_display_get_device_manager (display);
+ long /*int*/ device = OS.gdk_device_manager_get_client_pointer (device_manager);
+ return OS.gdk_device_get_window_at_position (device, win_x, win_y);
+ } else {
+ return OS.gdk_window_at_pointer (win_x, win_y);
+ }
+}
}