diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-31 12:23:05 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-31 12:23:05 -0400 |
commit | 67a460a42be09d4e50200d710407774fdc30d38a (patch) | |
tree | 14911a5994d5479f054011379f43bbf8a73237a3 | |
parent | f77b4014c8ef4f9962363ed94775e225f0d25865 (diff) | |
download | eclipse.platform.swt-gtk3_ungrab_pointer.tar.gz eclipse.platform.swt-gtk3_ungrab_pointer.tar.xz eclipse.platform.swt-gtk3_ungrab_pointer.zip |
Use gdk_device_ungrab () instead of gdk_keyboard_ungrab () for GTK+3gtk3_ungrab_pointer
6 files changed, 48 insertions, 3 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 6e7bfc86c3..ae87373cb3 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(int /*long*/ widget, int /*long*/ context){ int /*long*/ display = OS.gdk_window_get_display (OS.gtk_widget_get_window(widget)); int /*long*/ device_manager = OS.gdk_display_get_device_manager (display); int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager); + int /*long*/ 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 d09dd699af..de59fac283 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_1manager_1get_1client_1pointer JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1device_1manager_1get_1client_1pointer) (JNIEnv *env, jclass that, jintLong arg0) @@ -5741,7 +5761,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 d9abcce87f..1519b414da 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 @@ -130,6 +130,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 @@ -158,6 +159,7 @@ #define gdk_device_manager_get_client_pointer_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 c84b472c97..dd8b5066d5 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 = 1339; -int OS_nativeFunctionCallCount[1339]; +int OS_nativeFunctionCount = 1340; +int OS_nativeFunctionCallCount[1340]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -420,6 +420,7 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1cursor_1new_1from_1pixbuf", "_1gdk_1cursor_1new_1from_1pixmap", "_1gdk_1cursor_1unref", + "_1gdk_1device_1get_1associated_1device", "_1gdk_1device_1manager_1get_1client_1pointer", "_1gdk_1device_1ungrab", "_1gdk_1display_1get_1default", 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 047d1ab5d7..dd06e39c1c 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 @@ -428,6 +428,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_1manager_1get_1client_1pointer_FUNC, _1gdk_1device_1ungrab_FUNC, _1gdk_1display_1get_1default_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 4bb0a934b5..70f3b05b1a 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 @@ -4320,6 +4320,7 @@ public static final int /*long*/ 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(); @@ -4671,6 +4672,16 @@ public static final void gdk_device_ungrab(int /*long*/ device, int time_) { lock.unlock(); } } +/** @method flags=dynamic */ +public static final native int /*long*/ _gdk_device_get_associated_device(int /*long*/ device); +public static final int /*long*/ gdk_device_get_associated_device(int /*long*/ device) { + lock.lock(); + try { + return _gdk_device_get_associated_device(device); + } finally { + lock.unlock(); + } +} /** * @param window cast=(GdkWindow *) * @param property cast=(GdkAtom) |