Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2021-01-20 22:19:21 +0000
committerAlexander Kurtakov2021-01-21 15:38:18 +0000
commita743711b6bfaf322eebcfd54f7cfa79598b2b141 (patch)
tree3d4d402ecce897318113fe3cadd016e49a5eeb7a
parente0ebc99c9aff56596c1b8499081e3cafec5a4dab (diff)
downloadeclipse.platform.swt-a743711b6bfaf322eebcfd54f7cfa79598b2b141.tar.gz
eclipse.platform.swt-a743711b6bfaf322eebcfd54f7cfa79598b2b141.tar.xz
eclipse.platform.swt-a743711b6bfaf322eebcfd54f7cfa79598b2b141.zip
Bug 570178 - [GTK] Fix cast type for gtk_im_context_filter_keypress()
The problem here is that GTK3 wants 'GdkEventKey*' while GTK4 doesn't know this type at all and wants 'GdkEvent*'. So whatever is chosen, the type will be wrong on one of GTK versions. The type itself is not important for the compiled binary, it's merely a compilation issue. At the same time, final patch for Bug 570178 turned all warnings into errors to make sure that significant warnings are not overlooked. Until Bug 570533 is resolved, a temporary hack is applied to allow GTK4 to build. Change-Id: Ica2dd032ad5c6c60ec575a3e7b7db97b9cdf1119 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java15
5 files changed, 29 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 185515c7ef..ffcc052fa4 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
@@ -7454,18 +7454,6 @@ fail:
}
#endif
-#ifndef NO_gtk_1im_1context_1filter_1keypress
-JNIEXPORT jboolean JNICALL GTK_NATIVE(gtk_1im_1context_1filter_1keypress)
- (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
- jboolean rc = 0;
- GTK_NATIVE_ENTER(env, that, gtk_1im_1context_1filter_1keypress_FUNC);
- rc = (jboolean)gtk_im_context_filter_keypress((GtkIMContext *)arg0, (GdkEventKey *)arg1);
- GTK_NATIVE_EXIT(env, that, gtk_1im_1context_1filter_1keypress_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_gtk_1im_1context_1focus_1in
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1im_1context_1focus_1in)
(JNIEnv *env, jclass that, jlong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
index bf6fd23646..cd48837f79 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
@@ -155,6 +155,20 @@ JNIEXPORT jlong JNICALL OS_NATIVE(printerOptionWidgetNewProc_1CALLBACK)
}
#endif
+#ifndef NO__1gtk_1im_1context_1filter_1keypress
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GTK__1gtk_1im_1context_1filter_1keypress
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1im_1context_1filter_1keypress_FUNC);
+#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
+ rc = (jboolean)gtk_im_context_filter_keypress((GtkIMContext *)arg0, (GdkEvent *)arg1);
+#pragma GCC diagnostic pop
+ OS_NATIVE_EXIT(env, that, _1gtk_1im_1context_1filter_1keypress_FUNC);
+ return rc;
+}
+#endif
+
glong g_utf16_strlen(const gchar *str, glong max) {
const gchar *s = str;
guchar ch;
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 08ca41ef39..0e4cbccb15 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
@@ -316,6 +316,7 @@ char * GTK_nativeFunctionNames[] = {
"GtkTargetEntry_1sizeof",
"GtkTextIter_1sizeof",
"GtkTreeIter_1sizeof",
+ "_1gtk_1im_1context_1filter_1keypress",
"gtk_1accel_1group_1new",
"gtk_1accel_1label_1new",
"gtk_1accel_1label_1set_1accel",
@@ -554,7 +555,6 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1icon_1theme_1load_1icon",
"gtk_1icon_1theme_1lookup_1by_1gicon",
"gtk_1icon_1theme_1lookup_1icon",
- "gtk_1im_1context_1filter_1keypress",
"gtk_1im_1context_1focus_1in",
"gtk_1im_1context_1focus_1out",
"gtk_1im_1context_1get_1preedit_1string",
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 0efa2dd9be..be4ffadc3e 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
@@ -314,6 +314,7 @@ typedef enum {
GtkTargetEntry_1sizeof_FUNC,
GtkTextIter_1sizeof_FUNC,
GtkTreeIter_1sizeof_FUNC,
+ _1gtk_1im_1context_1filter_1keypress_FUNC,
gtk_1accel_1group_1new_FUNC,
gtk_1accel_1label_1new_FUNC,
gtk_1accel_1label_1set_1accel_FUNC,
@@ -552,7 +553,6 @@ typedef enum {
gtk_1icon_1theme_1load_1icon_FUNC,
gtk_1icon_1theme_1lookup_1by_1gicon_FUNC,
gtk_1icon_1theme_1lookup_1icon_FUNC,
- gtk_1im_1context_1filter_1keypress_FUNC,
gtk_1im_1context_1focus_1in_FUNC,
gtk_1im_1context_1focus_1out_FUNC,
gtk_1im_1context_1get_1preedit_1string_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index c22c259daa..fc7c1428d4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -1563,11 +1563,19 @@ public class GTK extends OS {
public static final native long gtk_icon_paintable_get_file(long paintable);
+ /* GtkIMContext */
/**
+ * @method flags=no_gen
* @param context cast=(GtkIMContext *)
- * @param event cast=(GdkEventKey *)
+ * @param event cast=(GdkEvent *)
+ *
+ * Note: This is a temporary solution until Bug 570533 is resolved.
+ * Remove this and code from 'os_custom.c' when this is done.
*/
- public static final native boolean gtk_im_context_filter_keypress(long context, long event);
+ public static final native boolean _gtk_im_context_filter_keypress(long context, long event);
+ public static final boolean gtk_im_context_filter_keypress(long context, long event) {
+ return _gtk_im_context_filter_keypress(context, event);
+ }
/** @param context cast=(GtkIMContext *) */
public static final native void gtk_im_context_focus_in(long context);
/** @param context cast=(GtkIMContext *) */
@@ -1592,6 +1600,9 @@ public class GTK extends OS {
* @param area cast=(GdkRectangle *),flags=no_out
*/
public static final native void gtk_im_context_set_cursor_location(long context, GdkRectangle area);
+
+
+ /* GtkIMMulticontext */
public static final native long gtk_im_multicontext_new();

Back to the top