Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-02-07 08:30:01 -0500
committerEric Williams2019-02-07 13:23:46 -0500
commit2d23d39e3702b7b9d8bc786352d9664d668b92d2 (patch)
tree6d3e68b506cc7f33d1eaa27b9a1b46fe4274a678
parent30a033bb2039d3e331292cc2d8e9d1c154de84ac (diff)
downloadeclipse.platform.swt-2d23d39e3702b7b9d8bc786352d9664d668b92d2.tar.gz
eclipse.platform.swt-2d23d39e3702b7b9d8bc786352d9664d668b92d2.tar.xz
eclipse.platform.swt-2d23d39e3702b7b9d8bc786352d9664d668b92d2.zip
Bug 543908: GTK4] Get ControlExample to launch and run on GTK4
Add proper GtkCssProvider API for GTK4 and adjust SwtFixed->measure to produce properly sized containers. Also make some small adjustments so that the DateTime tab works properly. Change-Id: I3dea2ec74788f11131187056a63e7e1505e9c2a5 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c56
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java6
17 files changed, 155 insertions, 38 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 c25e26ed32..dd4b9126fe 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
@@ -4816,29 +4816,57 @@ fail:
}
#endif
-#ifndef NO__1gtk_1css_1provider_1load_1from_1data
-JNIEXPORT jboolean JNICALL GTK_NATIVE(_1gtk_1css_1provider_1load_1from_1data)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLongArray arg3)
+#if (!defined(NO__1gtk_1css_1provider_1load_1from_1data__I_3BI) && !defined(JNI64)) || (!defined(NO__1gtk_1css_1provider_1load_1from_1data__J_3BJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1css_1provider_1load_1from_1data__I_3BI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1css_1provider_1load_1from_1data__J_3BJ)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2)
+#endif
+{
+ jbyte *lparg1=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1load_1from_1data__I_3BI_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1load_1from_1data__J_3BJ_FUNC);
+#endif
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ gtk_css_provider_load_from_data((GtkCssProvider *)arg0, (const gchar *)lparg1, (gssize)arg2);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1load_1from_1data__I_3BI_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1load_1from_1data__J_3BJ_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1css_1provider_1load_1from_1data__I_3BI_3I) && !defined(JNI64)) || (!defined(NO__1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT jboolean JNICALL GTK_NATIVE(_1gtk_1css_1provider_1load_1from_1data__I_3BI_3I)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLongArray arg3)
+#else
+JNIEXPORT jboolean JNICALL GTK_NATIVE(_1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLongArray arg3)
+#endif
{
jbyte *lparg1=NULL;
jintLong *lparg3=NULL;
jboolean rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1load_1from_1data_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1load_1from_1data__I_3BI_3I_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J_FUNC);
+#endif
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
-/*
- rc = (jboolean)gtk_css_provider_load_from_data(arg0, (const gchar *)lparg1, (gssize)arg2, (GError **)lparg3);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_css_provider_load_from_data)
- if (fp) {
- rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, const gchar *, gssize, GError **))fp)(arg0, (const gchar *)lparg1, (gssize)arg2, (GError **)lparg3);
- }
- }
+ rc = (jboolean)gtk_css_provider_load_from_data((GtkCssProvider *)arg0, (const gchar *)lparg1, (gssize)arg2, (GError **)lparg3);
fail:
if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- GTK_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1load_1from_1data_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1load_1from_1data__I_3BI_3I_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J_FUNC);
+#endif
return rc;
}
#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 20cc9a2642..c379af9343 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -275,6 +275,8 @@
#define NO__1gtk_1widget_1style_1get__J_3B_3IJ
#define NO__1gtk_1widget_1style_1get__I_3B_3JI
#define NO__1gtk_1widget_1style_1get__J_3B_3JJ
+#define NO__1gtk_1css_1provider_1load_1from_1data__I_3BI_3I
+#define NO__1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J
// Some GtkContainer functions don't exist on GTK4
#define NO__1gtk_1container_1propagate_1draw
@@ -439,6 +441,8 @@
#define NO__1gtk_1widget_1measure
#define NO__1gtk_1style_1context_1add_1provider_1for_1display
#define NO__1gtk_1widget_1get_1first_1child
+#define NO__1gtk_1css_1provider_1load_1from_1data__I_3BI
+#define NO__1gtk_1css_1provider_1load_1from_1data__J_3BJ
// GdkCursor API changes from GTK3 -> GTK4
#define NO__1gdk_1cursor_1new_1from_1name___3BI
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 79ce6890a6..638feba5f1 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
@@ -979,23 +979,22 @@ static void swt_fixed_measure (GtkWidget *widget, GtkOrientation orientation, i
SwtFixed *fixed = SWT_FIXED (widget);
SwtFixedPrivate *priv = fixed->priv;
GList *list;
- int total_nat, child_nat;
-
- total_nat = 0;
+ int natural_size, child_nat;
list = priv->children;
+ natural_size = 0;
while (list) {
SwtFixedChild *child_data = list->data;
GtkWidget *child = child_data->widget;
gtk_widget_measure(child, orientation, -1, NULL, &child_nat, NULL, NULL);
- total_nat = total_nat + child_nat;
+ if (child_nat > natural_size) natural_size = child_nat;
list = list->next;
}
+ if (natural) *natural = natural_size;
if (minimum) *minimum = 0;
- if (natural) *natural = total_nat;
if (minimum_baseline) *minimum_baseline = -1;
if (natural_baseline) *natural_baseline = -1;
return;
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 4c0fc02e47..ace3ab56f9 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
@@ -430,7 +430,16 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1container_1remove",
"_1gtk_1container_1set_1border_1width",
"_1gtk_1css_1provider_1get_1named",
- "_1gtk_1css_1provider_1load_1from_1data",
+#ifndef JNI64
+ "_1gtk_1css_1provider_1load_1from_1data__I_3BI",
+#else
+ "_1gtk_1css_1provider_1load_1from_1data__J_3BJ",
+#endif
+#ifndef JNI64
+ "_1gtk_1css_1provider_1load_1from_1data__I_3BI_3I",
+#else
+ "_1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J",
+#endif
"_1gtk_1css_1provider_1new",
"_1gtk_1css_1provider_1to_1string",
"_1gtk_1dialog_1add_1button",
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 bc462370ca..593affb51e 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,7 +428,16 @@ typedef enum {
_1gtk_1container_1remove_FUNC,
_1gtk_1container_1set_1border_1width_FUNC,
_1gtk_1css_1provider_1get_1named_FUNC,
- _1gtk_1css_1provider_1load_1from_1data_FUNC,
+#ifndef JNI64
+ _1gtk_1css_1provider_1load_1from_1data__I_3BI_FUNC,
+#else
+ _1gtk_1css_1provider_1load_1from_1data__J_3BJ_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1css_1provider_1load_1from_1data__I_3BI_3I_FUNC,
+#else
+ _1gtk_1css_1provider_1load_1from_1data__J_3BJ_3J_FUNC,
+#endif
_1gtk_1css_1provider_1new_FUNC,
_1gtk_1css_1provider_1to_1string_FUNC,
_1gtk_1dialog_1add_1button_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 4de0307541..821f8f735e 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
@@ -3879,12 +3879,13 @@ public class GTK extends OS {
}
}
/**
- * @method flags=dynamic
+ * @param css_provider cast=(GtkCssProvider *)
* @param data cast=(const gchar *)
* @param length cast=(gssize)
* @param error cast=(GError **)
*/
public static final native boolean _gtk_css_provider_load_from_data(long /*int*/ css_provider, byte[] data, long /*int*/ length, long /*int*/ error[]);
+ /** [GTK3 only, if-def'd in os.h] */
public static final boolean gtk_css_provider_load_from_data(long /*int*/ css_provider, byte[] data, long /*int*/ length, long /*int*/ error[] ) {
lock.lock();
try {
@@ -3893,6 +3894,21 @@ public class GTK extends OS {
lock.unlock();
}
}
+ /**
+ * @param css_provider cast=(GtkCssProvider *)
+ * @param data cast=(const gchar *)
+ * @param length cast=(gssize)
+ */
+ public static final native void _gtk_css_provider_load_from_data(long /*int*/ css_provider, byte[] data, long /*int*/ length);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final void gtk_css_provider_load_from_data(long /*int*/ css_provider, byte[] data, long /*int*/ length) {
+ lock.lock();
+ try {
+ _gtk_css_provider_load_from_data(css_provider, data, length);
+ } finally {
+ lock.unlock();
+ }
+ }
public static final native long /*int*/ _gtk_css_provider_new();
public static final long /*int*/gtk_css_provider_new() {
lock.lock();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 7ca6a7a9e6..fd76ad493e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -787,7 +787,11 @@ private void overrideThemeValues () {
}
GTK.gtk_style_context_add_provider_for_screen (screen, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (combinedCSS.toString(), true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (combinedCSS.toString(), true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (combinedCSS.toString(), true), -1, null);
+ }
}
/**
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 0eb94d213e..c7ac75d3ff 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
@@ -2135,7 +2135,11 @@ void setButtonBackgroundGdkRGBA (GdkRGBA rgba) {
GTK.gtk_style_context_add_provider(buttonContext, buttonProvider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref(buttonProvider);
}
- GTK.gtk_css_provider_load_from_data (buttonProvider, Converter.wcsToMbcs(finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
}
void setButtonForegroundGdkRGBA (GdkRGBA rgba) {
@@ -2155,7 +2159,11 @@ void setButtonForegroundGdkRGBA (GdkRGBA rgba) {
GTK.gtk_style_context_add_provider(buttonContext, buttonProvider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref(buttonProvider);
}
- GTK.gtk_css_provider_load_from_data (buttonProvider, Converter.wcsToMbcs(finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
}
@Override
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 5a7a42bf08..f59e798276 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
@@ -4953,7 +4953,11 @@ void gtk_css_provider_load_from_css (long /*int*/ context, String css) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ }
}
void setBackgroundGdkRGBA(GdkRGBA rgba) {
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 e8810f6e52..9f5659021f 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
@@ -478,9 +478,9 @@ private void createHandleForDateTime () {
}
if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_spin_button_set_numeric (textEntryHandle, false);
- GTK.gtk_container_add (fixedHandle, textEntryHandle);
- GTK.gtk_spin_button_set_wrap (textEntryHandle, (style & SWT.WRAP) != 0);
+ GTK.gtk_spin_button_set_numeric (GTK.GTK4? spinButtonHandle : textEntryHandle, false);
+ GTK.gtk_container_add (fixedHandle, GTK.GTK4? spinButtonHandle : textEntryHandle);
+ GTK.gtk_spin_button_set_wrap (GTK.GTK4? spinButtonHandle : textEntryHandle, (style & SWT.WRAP) != 0);
}
void createDropDownButton () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
index c8560f1135..8c60847d1b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -376,7 +376,11 @@ void gtk_css_provider_load_from_css (long /*int*/ context, String css) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index ce861fcdb5..bcdd1fbf55 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -3502,7 +3502,11 @@ public void setHeaderBackground(Color color) {
long /*int*/ provider = GTK.gtk_css_provider_new ();
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
GTK.gtk_style_context_invalidate(context);
}
}
@@ -3554,7 +3558,11 @@ public void setHeaderForeground (Color color) {
long /*int*/ provider = GTK.gtk_css_provider_new ();
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
GTK.gtk_style_context_invalidate(context);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 91b69c939e..6d5833e251 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -633,7 +633,11 @@ void gtk_css_provider_load_from_css (long /*int*/ context, String css) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 2a909e7409..d84ee30d04 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -302,7 +302,11 @@ void gtk_css_provider_load_from_css (long /*int*/ context, String css) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index 35412d74d9..f82091e526 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -892,7 +892,11 @@ private void setTrackerBackground(boolean opaque) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
}
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
+ }
GTK.gtk_style_context_invalidate (context);
}
long /*int*/ region = Cairo.cairo_region_create ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 8f55befaf1..d8ec3f3954 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -3563,7 +3563,11 @@ public void setHeaderBackground (Color color) {
long /*int*/ provider = GTK.gtk_css_provider_new ();
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
GTK.gtk_style_context_invalidate(context);
}
}
@@ -3615,7 +3619,11 @@ public void setHeaderForeground (Color color) {
long /*int*/ provider = GTK.gtk_css_provider_new ();
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
OS.g_object_unref (provider);
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (finalCss, true), -1, null);
+ }
GTK.gtk_style_context_invalidate(context);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 8590a03696..a6f7100e14 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1671,7 +1671,11 @@ public void setData (String key, Object value) {
long /*int*/ provider = GTK.gtk_css_provider_new();
if (context != 0 && provider != 0) {
GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_USER);
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs ((String) value, true), -1, null);
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs ((String) value, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs ((String) value, true), -1, null);
+ }
OS.g_object_unref (provider);
}
}

Back to the top