aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor2012-08-31 12:23:05 (EDT)
committerArun Thondapu2012-09-28 08:42:16 (EDT)
commit05d0c222631c4573978010636b08112190a63b4e (patch)
tree2a4e33c46871dd7f972e0d1a9f87e94618ec4b39
parentb10455c7784bbac9ddf3050dabceefccfa2b645e (diff)
downloadeclipse.platform.swt-05d0c222631c4573978010636b08112190a63b4e.zip
eclipse.platform.swt-05d0c222631c4573978010636b08112190a63b4e.tar.gz
eclipse.platform.swt-05d0c222631c4573978010636b08112190a63b4e.tar.bz2
Bug 388528 Use gdk_device_ungrab () instead of gdk_keyboard_ungrab () for GTK+3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c28
-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.java11
6 files changed, 46 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
index cce536a..e403b01 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -319,11 +319,13 @@ void dragEnd(long /*int*/ widget, long /*int*/ context){
long /*int*/ display = OS.gdk_window_get_display(OS.gtk_widget_get_window(widget));
long /*int*/ device_manager = OS.gdk_display_get_device_manager(display);
long /*int*/ pointer = OS.gdk_device_manager_get_client_pointer(device_manager);
+ long /*int*/ keyboard = OS.gdk_device_get_associated_device (pointer);
OS.gdk_device_ungrab(pointer, OS.GDK_CURRENT_TIME);
+ OS.gdk_device_ungrab(keyboard, OS.GDK_CURRENT_TIME);
} else {
OS.gdk_pointer_ungrab(OS.GDK_CURRENT_TIME);
+ OS.gdk_keyboard_ungrab(OS.GDK_CURRENT_TIME);
}
- OS.gdk_keyboard_ungrab(OS.GDK_CURRENT_TIME);
int operation = DND.DROP_NONE;
if (context != 0) {
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 38befce..dde2e9b 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
@@ -4876,6 +4876,26 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1cursor_1unref)
}
#endif
+#ifndef NO__1gdk_1device_1get_1associated_1device
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1device_1get_1associated_1device)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gdk_1device_1get_1associated_1device_FUNC);
+/*
+ rc = (jintLong)gdk_device_get_associated_device(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_device_get_associated_device)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gdk_1device_1get_1associated_1device_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)
@@ -5761,7 +5781,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1keyboard_1ungrab)
(JNIEnv *env, jclass that, jint arg0)
{
OS_NATIVE_ENTER(env, that, _1gdk_1keyboard_1ungrab_FUNC);
+/*
gdk_keyboard_ungrab(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gdk_keyboard_ungrab)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jint))fp)(arg0);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gdk_1keyboard_1ungrab_FUNC);
}
#endif
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 29f2d1a..8944f3f 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
@@ -134,6 +134,7 @@
#define gtk_icon_info_load_icon_LIB LIB_GTK
#define gtk_icon_info_free_LIB LIB_GTK
#define gtk_icon_theme_lookup_by_gicon_LIB LIB_GTK
+#define gdk_keyboard_ungrab_LIB LIB_GDK
#define gtk_icon_theme_get_default_LIB LIB_GTK
#define gtk_menu_item_remove_submenu_LIB LIB_GTK
#define gtk_menu_shell_set_take_focus_LIB LIB_GTK
@@ -169,6 +170,7 @@
#define gdk_device_grab_LIB LIB_GDK
#define gdk_device_ungrab_LIB LIB_GDK
#define gdk_display_get_device_manager_LIB LIB_GDK
+#define gdk_device_get_associated_device_LIB LIB_GDK
#define gdk_display_get_default_LIB LIB_GDK
#define gdk_display_supports_cursor_color_LIB LIB_GDK
#define gdk_draw_arc_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 fcd9ef1..8356918 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
@@ -419,6 +419,7 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1cursor_1new_1from_1pixbuf",
"_1gdk_1cursor_1new_1from_1pixmap",
"_1gdk_1cursor_1unref",
+ "_1gdk_1device_1get_1associated_1device",
"_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 af924c2..b0083a8 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
@@ -429,6 +429,7 @@ typedef enum {
_1gdk_1cursor_1new_1from_1pixbuf_FUNC,
_1gdk_1cursor_1new_1from_1pixmap_FUNC,
_1gdk_1cursor_1unref_FUNC,
+ _1gdk_1device_1get_1associated_1device_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 59314eb..dd6ca13 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
@@ -4331,6 +4331,7 @@ public static final long /*int*/ gdk_get_default_root_window() {
lock.unlock();
}
}
+/** @method flags=dynamic */
public static final native void _gdk_keyboard_ungrab(int time);
public static final void gdk_keyboard_ungrab(int time) {
lock.lock();
@@ -4702,6 +4703,16 @@ public static final void gdk_device_ungrab(long /*int*/ device, int time_) {
lock.unlock();
}
}
+/** @method flags=dynamic */
+public static final native long /*int*/ _gdk_device_get_associated_device(long /*int*/ device);
+public static final long /*int*/ gdk_device_get_associated_device(long /*int*/ device) {
+ lock.lock();
+ try {
+ return _gdk_device_get_associated_device(device);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param window cast=(GdkWindow *)
* @param property cast=(GdkAtom)