Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2018-11-28 16:32:21 +0000
committerXi Yan2018-12-13 17:12:03 +0000
commit218b69a1632dcada8464e8f4114e52547033b943 (patch)
tree3081a0fedb730e582f76fc31c66f27126aa85ccb
parent2a1cde8dde99beb3cf3e3c70136d2c822467d69d (diff)
downloadeclipse.platform.swt-218b69a1632dcada8464e8f4114e52547033b943.tar.gz
eclipse.platform.swt-218b69a1632dcada8464e8f4114e52547033b943.tar.xz
eclipse.platform.swt-218b69a1632dcada8464e8f4114e52547033b943.zip
Bug 540672 - [GTK4] Adapt to GtkStyleContext API changes
Change-Id: Ia3b7acd7d34e35c1c3d392728e43c6d9573bffb1 Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c162
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java45
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java21
9 files changed, 294 insertions, 73 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 7f7bb12201..cbaa819dc1 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
@@ -9192,12 +9192,19 @@ fail:
}
#endif
-#ifndef NO__1gtk_1style_1context_1get_1border
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#if (!defined(NO__1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#endif
{
GtkBorder _arg2, *lparg2=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
if (arg2) if ((lparg2 = &_arg2) == NULL) goto fail;
/*
gtk_style_context_get_border((GtkStyleContext *)arg0, (GtkStateFlags)arg1, (GtkBorder *)lparg2);
@@ -9210,16 +9217,60 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border)
}
fail:
if (arg2 && lparg2) setGtkBorderFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
}
#endif
-#ifndef NO__1gtk_1style_1context_1get_1color
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#if (!defined(NO__1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
+{
+ GtkBorder _arg1, *lparg1=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
+ if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
+/*
+ gtk_style_context_get_border((GtkStyleContext *)arg0, (GtkBorder *)lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_style_context_get_border)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkStyleContext *, GtkBorder *))fp)((GtkStyleContext *)arg0, (GtkBorder *)lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) setGtkBorderFields(env, arg1, lparg1);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#endif
{
GdkRGBA _arg2, *lparg2=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1color_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#endif
if (arg2) if ((lparg2 = getGdkRGBAFields(env, arg2, &_arg2)) == NULL) goto fail;
/*
gtk_style_context_get_color((GtkStyleContext *)arg0, (GtkStateFlags)arg1, (GdkRGBA *)lparg2);
@@ -9232,7 +9283,44 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color)
}
fail:
if (arg2 && lparg2) setGdkRGBAFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1color_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
+{
+ GdkRGBA _arg1, *lparg1=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#endif
+ if (arg1) if ((lparg1 = getGdkRGBAFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
+ gtk_style_context_get_color((GtkStyleContext *)arg0, (GdkRGBA *)lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_style_context_get_color)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkStyleContext *, GdkRGBA *))fp)((GtkStyleContext *)arg0, (GdkRGBA *)lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) setGdkRGBAFields(env, arg1, lparg1);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC);
+#endif
}
#endif
@@ -9256,12 +9344,19 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1font)
}
#endif
-#ifndef NO__1gtk_1style_1context_1get_1padding
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#if (!defined(NO__1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
+#endif
{
GtkBorder _arg2, *lparg2=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1padding_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
if (arg2) if ((lparg2 = &_arg2) == NULL) goto fail;
/*
gtk_style_context_get_padding((GtkStyleContext *)arg0, (GtkStateFlags)arg1, (GtkBorder *)lparg2);
@@ -9274,7 +9369,44 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding)
}
fail:
if (arg2 && lparg2) setGtkBorderFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1padding_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
+{
+ GtkBorder _arg1, *lparg1=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
+ if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
+/*
+ gtk_style_context_get_padding((GtkStyleContext *)arg0, (GtkBorder *)lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_style_context_get_padding)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkStyleContext *, GtkBorder *))fp)((GtkStyleContext *)arg0, (GtkBorder *)lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) setGtkBorderFields(env, arg1, lparg1);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC);
+#endif
}
#endif
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 f3098d3565..42f35e0a5d 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
@@ -828,10 +828,37 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1style_1context_1get__J_3B_3JJ",
#endif
"_1gtk_1style_1context_1get_1background_1color",
- "_1gtk_1style_1context_1get_1border",
- "_1gtk_1style_1context_1get_1color",
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#else
+ "_1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#endif
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#else
+ "_1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#endif
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2",
+#else
+ "_1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2",
+#endif
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2",
+#else
+ "_1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2",
+#endif
"_1gtk_1style_1context_1get_1font",
- "_1gtk_1style_1context_1get_1padding",
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#else
+ "_1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#endif
+#ifndef JNI64
+ "_1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#else
+ "_1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2",
+#endif
"_1gtk_1style_1context_1invalidate",
"_1gtk_1style_1context_1remove_1class",
"_1gtk_1style_1context_1restore",
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 7162d38da0..c0f9f3d9b5 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
@@ -826,10 +826,37 @@ typedef enum {
_1gtk_1style_1context_1get__J_3B_3JJ_FUNC,
#endif
_1gtk_1style_1context_1get_1background_1color_FUNC,
- _1gtk_1style_1context_1get_1border_FUNC,
- _1gtk_1style_1context_1get_1color_FUNC,
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1border__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1border__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1border__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1border__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1color__IILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1color__JILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1color__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1color__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2_FUNC,
+#endif
_1gtk_1style_1context_1get_1font_FUNC,
- _1gtk_1style_1context_1get_1padding_FUNC,
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1padding__IILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1padding__JILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1style_1context_1get_1padding__ILorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#else
+ _1gtk_1style_1context_1get_1padding__JLorg_eclipse_swt_internal_gtk_GtkBorder_2_FUNC,
+#endif
_1gtk_1style_1context_1invalidate_FUNC,
_1gtk_1style_1context_1remove_1class_FUNC,
_1gtk_1style_1context_1restore_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 45275fb9c8..06ee6453d3 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
@@ -5879,6 +5879,21 @@ public class GTK extends OS {
lock.unlock();
}
}
+ /**
+ * @method flags=dynamic
+ * @param context cast=(GtkStyleContext *)
+ * @param color cast=(GdkRGBA *)
+ */
+ public static final native void _gtk_style_context_get_color(long /*int*/ context, GdkRGBA color);
+ /** [GTK4 only] */
+ public static final void gtk_style_context_get_color(long /*int*/ context, GdkRGBA color) {
+ lock.lock();
+ try {
+ _gtk_style_context_get_color(context, color);
+ } finally {
+ lock.unlock();
+ }
+ }
/** @method flags=dynamic */
public static final native long /*int*/ _gtk_style_context_get_font(long /*int*/ context, int state);
/** [GTK3; 3.8 deprecated, replaced] */
@@ -5908,6 +5923,21 @@ public class GTK extends OS {
}
/**
* @method flags=dynamic
+ * @param context cast=(GtkStyleContext *)
+ * @param padding cast=(GtkBorder *),flags=no_in
+ */
+ public static final native void _gtk_style_context_get_padding(long /*int*/ context, GtkBorder padding);
+ /** [GTK4 only] */
+ public static final void gtk_style_context_get_padding(long /*int*/ context, GtkBorder padding) {
+ lock.lock();
+ try {
+ _gtk_style_context_get_padding(context, padding);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @method flags=dynamic
* @param property cast=(const gchar *),flags=no_out
* @param terminator cast=(const gchar *),flags=sentinel
*/
@@ -5950,6 +5980,21 @@ public class GTK extends OS {
lock.unlock();
}
}
+ /**
+ * @method flags=dynamic
+ * @param context cast=(GtkStyleContext *)
+ * @param padding cast=(GtkBorder *),flags=no_in
+ */
+ public static final native void _gtk_style_context_get_border(long /*int*/ context, GtkBorder padding);
+ /** [GTK4 only] */
+ public static final void gtk_style_context_get_border(long /*int*/ context, GtkBorder padding) {
+ lock.lock();
+ try {
+ _gtk_style_context_get_border(context, padding);
+ } finally {
+ lock.unlock();
+ }
+ }
/** @method flags=dynamic */
public static final native void _gtk_style_context_invalidate(long /*int*/ context);
/** [GTK3; 3.12 deprecated] */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 8e2b8049d5..1d279a4e61 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -2984,6 +2984,9 @@ long /*int*/ getFontDescription () {
long /*int*/ context = GTK.gtk_widget_get_style_context (fontHandle);
if ("ppc64le".equals(System.getProperty("os.arch"))) {
return GTK.gtk_style_context_get_font(context, GTK.GTK_STATE_FLAG_NORMAL);
+ } else if (GTK.GTK4) {
+ GTK.gtk_style_context_get(context, GTK.gtk_style_property_font, fontDesc, 0);
+ return fontDesc [0];
} else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) {
GTK.gtk_style_context_save(context);
GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL);
@@ -3243,27 +3246,36 @@ Point getThickness (long /*int*/ widget) {
int xthickness = 0, ythickness = 0;
GtkBorder tmp = new GtkBorder();
long /*int*/ context = GTK.gtk_widget_get_style_context (widget);
-
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(widget), tmp);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(widget);
+ gtk_style_context_get_padding(context, state_flag, tmp);
GTK.gtk_style_context_save (context);
GTK.gtk_style_context_add_class (context, GTK.GTK_STYLE_CLASS_FRAME);
xthickness += tmp.left;
ythickness += tmp.top;
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(widget), tmp);
- }
+ int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(widget);
+ gtk_style_context_get_border (context, state, tmp);
xthickness += tmp.left;
ythickness += tmp.top;
GTK.gtk_style_context_restore (context);
return new Point (xthickness, ythickness);
}
+void gtk_style_context_get_padding(long /*int*/ context, int state, GtkBorder padding) {
+ if (GTK.GTK4) {
+ GTK.gtk_style_context_get_padding(context, padding);
+ } else {
+ GTK.gtk_style_context_get_padding(context, state, padding);
+ }
+}
+
+void gtk_style_context_get_border (long /*int*/ context, int state, GtkBorder padding) {
+ if (GTK.GTK4) {
+ GTK.gtk_style_context_get_border(context, padding);
+ } else {
+ GTK.gtk_style_context_get_border(context, state, padding);
+ }
+}
+
@Override
long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
return gtk_button_press_event (widget, event, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index 94252f69f7..31a1fd2583 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -362,21 +362,15 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
int xborder = 0, yborder = 0;
GtkBorder tmp = new GtkBorder ();
long /*int*/ context = GTK.gtk_widget_get_style_context (textEntryHandle);
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(textEntryHandle), tmp);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(textEntryHandle);
+ gtk_style_context_get_padding(context, state_flag, tmp);
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;
trim.height += tmp.top + tmp.bottom;
if ((style & SWT.BORDER) != 0) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(textEntryHandle), tmp);
- }
+ int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(textEntryHandle);
+ gtk_style_context_get_border(context, state, tmp);
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;
@@ -1736,11 +1730,8 @@ GtkBorder getGtkBorderPadding () {
//In Gtk3, acquire border.
GtkBorder gtkBorderPadding = new GtkBorder ();
long /*int*/ context = GTK.gtk_widget_get_style_context (textEntryHandle);
- if (GTK.GTK_VERSION < OS.VERSION(3, 18 , 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, gtkBorderPadding);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(textEntryHandle), gtkBorderPadding);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(textEntryHandle);
+ gtk_style_context_get_padding(context, state_flag, gtkBorderPadding);
return gtkBorderPadding;
}
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 41ac77c3fa..32a101c4ea 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
@@ -3403,7 +3403,9 @@ GdkRGBA styleContextGetColor(long /*int*/ context, int flag) {
* Reference: https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/
*/
GdkRGBA rgba = new GdkRGBA ();
- if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) {
+ if (GTK.GTK4) {
+ GTK.gtk_style_context_get_color(context, rgba);
+ } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) {
GTK.gtk_style_context_save(context);
GTK.gtk_style_context_set_state(context, flag);
GTK.gtk_style_context_get_color (context, flag, rgba);
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 668a15c54f..3e34ab592e 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
@@ -254,17 +254,11 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
Rectangle trim = super.computeTrimInPixels (x, y, width, height);
GtkBorder tmp = new GtkBorder();
long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle);
+ gtk_style_context_get_padding(context, state_flag, tmp);
if ((style & SWT.BORDER) != 0) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
+ int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle);
+ gtk_style_context_get_border(context, state, tmp);
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index aa40e5784c..e6a2586b4e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -610,11 +610,8 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
// GtkSearchEntry have more padding than GtkEntry
GtkBorder tmp = new GtkBorder();
long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle);
+ gtk_style_context_get_padding(context, state_flag, tmp);
width += tmp.left + tmp.right;
}
if (width == 0) width = DEFAULT_WIDTH;
@@ -633,11 +630,8 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
if ((style & SWT.SINGLE) != 0) {
GtkBorder tmp = new GtkBorder();
long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
+ int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle);
+ gtk_style_context_get_padding(context, state_flag, tmp);
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;
@@ -648,11 +642,8 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
trim.height += tmp.top + tmp.bottom;
}
if ((style & SWT.BORDER) != 0) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
+ int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle);
+ gtk_style_context_get_border(context, state, tmp);
trim.x -= tmp.left;
trim.y -= tmp.top;
trim.width += tmp.left + tmp.right;

Back to the top