diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-15 16:22:59 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-15 16:22:59 -0400 |
commit | 1b01d53c50c67ea5b2a826fea42a52a45e2d594f (patch) | |
tree | 236c4c3d06d00def89ce7f2a28e847d62fab481d | |
parent | 390e16e87916237b4b4a491c6ddf80f8de406bfc (diff) | |
download | eclipse.platform.swt-1b01d53c50c67ea5b2a826fea42a52a45e2d594f.tar.gz eclipse.platform.swt-1b01d53c50c67ea5b2a826fea42a52a45e2d594f.tar.xz eclipse.platform.swt-1b01d53c50c67ea5b2a826fea42a52a45e2d594f.zip |
Use gtk_entry_im_context_filter_keypress to omit direct ImContext callgtk_im_context_filter_keypress
7 files changed, 69 insertions, 16 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 b71852b2c0..b5acf1d66c 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 @@ -8599,6 +8599,26 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1entry_1get_1visibility) } #endif +#ifndef NO__1gtk_1entry_1im_1context_1filter_1keypress +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1entry_1im_1context_1filter_1keypress) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1entry_1im_1context_1filter_1keypress_FUNC); +/* + rc = (jboolean)gtk_entry_im_context_filter_keypress(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_entry_im_context_filter_keypress) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1entry_1im_1context_1filter_1keypress_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1entry_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1entry_1new) (JNIEnv *env, jclass that) 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 2671afd6da..9567545da0 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 @@ -136,6 +136,7 @@ #define gtk_menu_tool_button_new_LIB LIB_GTK #define gtk_window_set_keep_below_LIB LIB_GTK #define gtk_set_locale_LIB LIB_GTK +#define gtk_entry_im_context_filter_keypress_LIB LIB_GTK #define gtk_toolbar_set_orientation_LIB LIB_GTK #define gtk_tooltip_trigger_tooltip_query_LIB LIB_GTK #define gtk_tooltips_set_tip_LIB LIB_GTK 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 aeb340c4a1..daf6f00899 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 = 1337; -int OS_nativeFunctionCallCount[1337]; +int OS_nativeFunctionCount = 1338; +int OS_nativeFunctionCallCount[1338]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -681,6 +681,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1entry_1get_1max_1length", "_1gtk_1entry_1get_1text", "_1gtk_1entry_1get_1visibility", + "_1gtk_1entry_1im_1context_1filter_1keypress", "_1gtk_1entry_1new", "_1gtk_1entry_1set_1alignment", "_1gtk_1entry_1set_1has_1frame", 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 6b46369112..16f54dbe7c 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 @@ -689,6 +689,7 @@ typedef enum { _1gtk_1entry_1get_1max_1length_FUNC, _1gtk_1entry_1get_1text_FUNC, _1gtk_1entry_1get_1visibility_FUNC, + _1gtk_1entry_1im_1context_1filter_1keypress_FUNC, _1gtk_1entry_1new_FUNC, _1gtk_1entry_1set_1alignment_FUNC, _1gtk_1entry_1set_1has_1frame_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 d221129a8e..4ee9310a2b 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 @@ -7368,6 +7368,16 @@ public static final void gtk_im_context_set_cursor_location(int /*long*/ context lock.unlock(); } } +/** @method flags=dynamic */ +public static final native boolean _gtk_entry_im_context_filter_keypress(int /*long*/ entry, int /*long*/ event); +public static final boolean gtk_entry_im_context_filter_keypress(int /*long*/ entry, int /*long*/ event) { + lock.lock(); + try { + return _gtk_entry_im_context_filter_keypress(entry, event); + } finally { + lock.unlock(); + } +} /** * @param context cast=(GtkIMMulticontext *) * @param menushell cast=(GtkMenuShell *) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index b34449a7ea..74401619d8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -487,9 +487,13 @@ boolean filterKey (int keyval, int /*long*/ event) { int time = OS.gdk_event_get_time (event); if (time != lastEventTime) { lastEventTime = time; - int /*long*/ imContext = imContext (); - if (imContext != 0) { - return OS.gtk_im_context_filter_keypress (imContext, event); + if (OS.GTK_VERSION >= OS.VERSION (2, 22, 0)) { + return OS.gtk_entry_im_context_filter_keypress (entryHandle, event); + } else { + int /*long*/ imContext = imContext (); + if (imContext != 0) { + return OS.gtk_im_context_filter_keypress (imContext, event); + } } } gdkEventKey = event; @@ -589,11 +593,17 @@ void fixIM () { * filter has to be called by SWT. */ if (gdkEventKey != 0 && gdkEventKey != -1) { - int /*long*/ imContext = imContext (); - if (imContext != 0) { - OS.gtk_im_context_filter_keypress (imContext, gdkEventKey); + if (OS.GTK_VERSION >= OS.VERSION(2, 22, 0)) { + OS.gtk_entry_im_context_filter_keypress (entryHandle, gdkEventKey); gdkEventKey = -1; return; + } else { + int /*long*/ imContext = imContext (); + if (imContext != 0) { + OS.gtk_im_context_filter_keypress (imContext, gdkEventKey); + gdkEventKey = -1; + return; + } } } gdkEventKey = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java index fbb57ce8d4..2c94eec3b5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java @@ -336,9 +336,13 @@ boolean filterKey (int keyval, int /*long*/ event) { int time = OS.gdk_event_get_time (event); if (time != lastEventTime) { lastEventTime = time; - int /*long*/ imContext = imContext (); - if (imContext != 0) { - return OS.gtk_im_context_filter_keypress (imContext, event); + if (OS.GTK_VERSION >= OS.VERSION (2, 22, 0)) { + return OS.gtk_entry_im_context_filter_keypress (handle, event); + } else { + int /*long*/ imContext = imContext (); + if (imContext != 0) { + return OS.gtk_im_context_filter_keypress (imContext, event); + } } } gdkEventKey = event; @@ -355,11 +359,17 @@ void fixIM () { * filter has to be called by SWT. */ if (gdkEventKey != 0 && gdkEventKey != -1) { - int /*long*/ imContext = imContext (); - if (imContext != 0) { - OS.gtk_im_context_filter_keypress (imContext, gdkEventKey); - gdkEventKey = -1; - return; + if (OS.GTK_VERSION >= OS.VERSION(2, 22, 0)){ + OS.gtk_entry_im_context_filter_keypress(handle, gdkEventKey); + gdkEventKey = -1; + return; + } else { + int /*long*/ imContext = imContext (); + if (imContext != 0) { + OS.gtk_im_context_filter_keypress (imContext, gdkEventKey); + gdkEventKey = -1; + return; + } } } gdkEventKey = 0; |