Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-11-14 18:57:29 +0000
committerEric Williams2018-11-22 19:35:56 +0000
commit849c24f7345b8b0a01607613ef596e9e6130bdac (patch)
treeb7c1da96343b934ce98264027d16e4b765f5ea2d /bundles
parent831821e42347196f49105bf89e01b6182d0d1670 (diff)
downloadeclipse.platform.swt-849c24f7345b8b0a01607613ef596e9e6130bdac.tar.gz
eclipse.platform.swt-849c24f7345b8b0a01607613ef596e9e6130bdac.tar.xz
eclipse.platform.swt-849c24f7345b8b0a01607613ef596e9e6130bdac.zip
Bug 541173: [GTK4] Get Snippet1 to work on GTK4 as proof of concept
Show Snippet1 running on GTK4 as a proof of concept. Note that clicking the "x" button on the Shell does not kill the SWT process -- this is a bug that will be fixed later. Manually terminate the process from the console instead. Change-Id: I489cbe966031a5a1ba02ddd1882e1ff1ab005b3b Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c326
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java89
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java64
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java132
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java54
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java21
13 files changed, 745 insertions, 158 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 ce66342420..235e9f3155 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
@@ -272,7 +272,15 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1atom_1intern)
jintLong rc = 0;
GDK_NATIVE_ENTER(env, that, _1gdk_1atom_1intern_FUNC);
if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
+/*
rc = (jintLong)gdk_atom_intern((const gchar *)lparg0, arg1);
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_atom_intern)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *, jboolean))fp)((const gchar *)lparg0, arg1);
+ }
+ }
fail:
if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, JNI_ABORT);
GDK_NATIVE_EXIT(env, that, _1gdk_1atom_1intern_FUNC);
@@ -706,6 +714,18 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1device_1manager)
}
#endif
+#ifndef NO__1gdk_1display_1get_1keymap
+JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1keymap)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1display_1get_1keymap_FUNC);
+ rc = (jintLong)gdk_display_get_keymap((GdkDisplay *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1display_1get_1keymap_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1display_1get_1monitor
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1monitor)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
@@ -746,6 +766,18 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1monitor_1at_1point)
}
#endif
+#ifndef NO__1gdk_1display_1get_1monitor_1at_1surface
+JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1monitor_1at_1surface)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ jintLong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1display_1get_1monitor_1at_1surface_FUNC);
+ rc = (jintLong)gdk_display_get_monitor_at_surface((GdkDisplay *)arg0, (GdkSurface *)arg1);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1display_1get_1monitor_1at_1surface_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1display_1get_1monitor_1at_1window
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1monitor_1at_1window)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -1095,7 +1127,15 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1flush)
(JNIEnv *env, jclass that)
{
GDK_NATIVE_ENTER(env, that, _1gdk_1flush_FUNC);
+/*
gdk_flush();
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_flush)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)())fp)();
+ }
+ }
GDK_NATIVE_EXIT(env, that, _1gdk_1flush_FUNC);
}
#endif
@@ -1137,7 +1177,15 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1keymap_1get_1for_1display)
{
jintLong rc = 0;
GDK_NATIVE_ENTER(env, that, _1gdk_1keymap_1get_1for_1display_FUNC);
+/*
rc = (jintLong)gdk_keymap_get_for_display((GdkDisplay *)arg0);
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_keymap_get_for_display)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkDisplay *))fp)((GdkDisplay *)arg0);
+ }
+ }
GDK_NATIVE_EXIT(env, that, _1gdk_1keymap_1get_1for_1display_FUNC);
return rc;
}
@@ -1282,7 +1330,15 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1pango_1context_1get)
{
jintLong rc = 0;
GDK_NATIVE_ENTER(env, that, _1gdk_1pango_1context_1get_FUNC);
+/*
rc = (jintLong)gdk_pango_context_get();
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_pango_context_get)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
GDK_NATIVE_EXIT(env, that, _1gdk_1pango_1context_1get_FUNC);
return rc;
}
@@ -1939,7 +1995,15 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1set_1program_1class)
jbyte *lparg0=NULL;
GDK_NATIVE_ENTER(env, that, _1gdk_1set_1program_1class_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+/*
gdk_set_program_class((const char *)lparg0);
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_set_program_class)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(const char *))fp)((const char *)lparg0);
+ }
+ }
fail:
if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
GDK_NATIVE_EXIT(env, that, _1gdk_1set_1program_1class_FUNC);
@@ -1978,6 +2042,20 @@ JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1surface_1focus)
}
#endif
+#ifndef NO__1gdk_1surface_1get_1frame_1extents
+JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1surface_1get_1frame_1extents)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+{
+ GdkRectangle _arg1, *lparg1=NULL;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1surface_1get_1frame_1extents_FUNC);
+ if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
+ gdk_surface_get_frame_extents((GdkSurface *)arg0, (GdkRectangle *)lparg1);
+fail:
+ if (arg1 && lparg1) setGdkRectangleFields(env, arg1, lparg1);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1surface_1get_1frame_1extents_FUNC);
+}
+#endif
+
#ifndef NO__1gdk_1text_1property_1to_1utf8_1list_1for_1display
JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1text_1property_1to_1utf8_1list_1for_1display)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jint arg4, jintLongArray arg5)
@@ -3627,7 +3705,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1button_1set_1image)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1button_1set_1image_FUNC);
+/*
gtk_button_set_image((GtkButton *)arg0, (GtkWidget *)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_button_set_image)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkButton *, GtkWidget *))fp)((GtkButton *)arg0, (GtkWidget *)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1button_1set_1image_FUNC);
}
#endif
@@ -4974,7 +5060,15 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1event_1box_1new)
{
jintLong rc = 0;
GTK_NATIVE_ENTER(env, that, _1gtk_1event_1box_1new_FUNC);
+/*
rc = (jintLong)gtk_event_box_new();
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_event_box_new)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)();
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1event_1box_1new_FUNC);
return rc;
}
@@ -8789,6 +8883,24 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1add_1provider)
}
#endif
+#ifndef NO__1gtk_1style_1context_1add_1provider_1for_1display
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1add_1provider_1for_1display)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2)
+{
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1add_1provider_1for_1display_FUNC);
+/*
+ gtk_style_context_add_provider_for_display((GdkDisplay *)arg0, (GtkStyleProvider *)arg1, (guint)arg2);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_style_context_add_provider_for_display)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GdkDisplay *, GtkStyleProvider *, guint))fp)((GdkDisplay *)arg0, (GtkStyleProvider *)arg1, (guint)arg2);
+ }
+ }
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1add_1provider_1for_1display_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1style_1context_1add_1provider_1for_1screen
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1add_1provider_1for_1screen)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2)
@@ -8799,13 +8911,20 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1add_1provider_1for_1scr
}
#endif
-#ifndef NO__1gtk_1style_1context_1get
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get)
- (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jbyteArray arg2, jintLongArray arg3, jintLong arg4)
+#if (!defined(NO__1gtk_1style_1context_1get__II_3B_3II) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get__JI_3B_3JJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get__II_3B_3II)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jbyteArray arg2, jintLongArray arg3, jintLong arg4)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get__JI_3B_3JJ)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jbyteArray arg2, jintLongArray arg3, jintLong arg4)
+#endif
{
jbyte *lparg2=NULL;
jintLong *lparg3=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get__II_3B_3II_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get__JI_3B_3JJ_FUNC);
+#endif
if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail;
/*
@@ -8820,7 +8939,47 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get)
fail:
if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0);
if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, JNI_ABORT);
- GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get__II_3B_3II_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get__JI_3B_3JJ_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1style_1context_1get__I_3B_3II) && !defined(JNI64)) || (!defined(NO__1gtk_1style_1context_1get__J_3B_3JJ) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get__I_3B_3II)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLongArray arg2, jintLong arg3)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1style_1context_1get__J_3B_3JJ)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLongArray arg2, jintLong arg3)
+#endif
+{
+ jbyte *lparg1=NULL;
+ jintLong *lparg2=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get__I_3B_3II_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get__J_3B_3JJ_FUNC);
+#endif
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+/*
+ gtk_style_context_get(arg0, (const gchar *)lparg1, lparg2, (const gchar *)NULL);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_style_context_get)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, const gchar *, jintLong *, const gchar *))fp)(arg0, (const gchar *)lparg1, lparg2, (const gchar *)NULL);
+ }
+ }
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, JNI_ABORT);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get__I_3B_3II_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get__J_3B_3JJ_FUNC);
+#endif
}
#endif
@@ -9672,7 +9831,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1toggle_1button_1set_1inconsistent)
(JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1toggle_1button_1set_1inconsistent_FUNC);
+/*
gtk_toggle_button_set_inconsistent((GtkToggleButton *)arg0, (gboolean)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_toggle_button_set_inconsistent)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkToggleButton *, gboolean))fp)((GtkToggleButton *)arg0, (gboolean)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1toggle_1button_1set_1inconsistent_FUNC);
}
#endif
@@ -9682,7 +9849,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1toggle_1button_1set_1mode)
(JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1toggle_1button_1set_1mode_FUNC);
+/*
gtk_toggle_button_set_mode((GtkToggleButton *)arg0, (gboolean)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_toggle_button_set_mode)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkToggleButton *, gboolean))fp)((GtkToggleButton *)arg0, (gboolean)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1toggle_1button_1set_1mode_FUNC);
}
#endif
@@ -9860,7 +10035,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1toolbar_1set_1icon_1size)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC);
+/*
gtk_toolbar_set_icon_size((GtkToolbar *)arg0, arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_toolbar_set_icon_size)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkToolbar *, jint))fp)((GtkToolbar *)arg0, arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC);
}
#endif
@@ -11183,7 +11366,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1add_1events)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1add_1events_FUNC);
+/*
gtk_widget_add_events((GtkWidget *)arg0, (gint)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_add_events)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, gint))fp)((GtkWidget *)arg0, (gint)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1add_1events_FUNC);
}
#endif
@@ -11285,7 +11476,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1draw)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1draw_FUNC);
+/*
gtk_widget_draw((GtkWidget *)arg0, (cairo_t *)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_draw)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, cairo_t *))fp)((GtkWidget *)arg0, (cairo_t *)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1draw_FUNC);
}
#endif
@@ -11380,7 +11579,15 @@ JNIEXPORT jint JNICALL GTK_NATIVE(_1gtk_1widget_1get_1events)
{
jint rc = 0;
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1events_FUNC);
+/*
rc = (jint)gtk_widget_get_events((GtkWidget *)arg0);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_get_events)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1events_FUNC);
return rc;
}
@@ -11527,7 +11734,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1get_1preferred_1height)
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1preferred_1height_FUNC);
if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
+/*
gtk_widget_get_preferred_height((GtkWidget *)arg0, (gint *)lparg1, (gint *)lparg2);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_get_preferred_height)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, gint *, gint *))fp)((GtkWidget *)arg0, (gint *)lparg1, (gint *)lparg2);
+ }
+ }
fail:
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
@@ -11544,7 +11759,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1get_1preferred_1height_1for_1wi
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1preferred_1height_1for_1width_FUNC);
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+/*
gtk_widget_get_preferred_height_for_width((GtkWidget *)arg0, (gint)arg1, (gint *)lparg2, (gint *)lparg3);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_get_preferred_height_for_width)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, gint, gint *, gint *))fp)((GtkWidget *)arg0, (gint)arg1, (gint *)lparg2, (gint *)lparg3);
+ }
+ }
fail:
if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
@@ -11578,7 +11801,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1get_1preferred_1width_1for_1hei
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1preferred_1width_1for_1height_FUNC);
if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+/*
gtk_widget_get_preferred_width_for_height((GtkWidget *)arg0, (gint)arg1, (gint *)lparg2, (gint *)lparg3);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_get_preferred_width_for_height)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, gint, gint *, gint *))fp)((GtkWidget *)arg0, (gint)arg1, (gint *)lparg2, (gint *)lparg3);
+ }
+ }
fail:
if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
@@ -11954,7 +12185,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1set_1allocation)
GtkAllocation _arg1, *lparg1=NULL;
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1allocation_FUNC);
if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
gtk_widget_set_allocation((GtkWidget *)arg0, (GtkAllocation *)lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_set_allocation)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *))fp)((GtkWidget *)arg0, (GtkAllocation *)lparg1);
+ }
+ }
fail:
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1allocation_FUNC);
}
@@ -12155,7 +12394,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1set_1redraw_1on_1allocate)
(JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1redraw_1on_1allocate_FUNC);
+/*
gtk_widget_set_redraw_on_allocate((GtkWidget *)arg0, (gboolean)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_set_redraw_on_allocate)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, gboolean))fp)((GtkWidget *)arg0, (gboolean)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1redraw_1on_1allocate_FUNC);
}
#endif
@@ -12219,7 +12466,15 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1shape_1combine_1region)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
{
GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1shape_1combine_1region_FUNC);
+/*
gtk_widget_shape_combine_region((GtkWidget *)arg0, (cairo_region_t *)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_shape_combine_region)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, cairo_region_t *))fp)((GtkWidget *)arg0, (cairo_region_t *)arg1);
+ }
+ }
GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1shape_1combine_1region_FUNC);
}
#endif
@@ -12234,16 +12489,67 @@ JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1show)
}
#endif
-#ifndef NO__1gtk_1widget_1size_1allocate
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1allocate)
- (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#if (!defined(NO__1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2) && !defined(JNI64)) || (!defined(NO__1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
+#endif
{
GtkAllocation _arg1, *lparg1=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1allocate_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC);
+#endif
if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
gtk_widget_size_allocate((GtkWidget *)arg0, (GtkAllocation *)lparg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_size_allocate)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *))fp)((GtkWidget *)arg0, (GtkAllocation *)lparg1);
+ }
+ }
+fail:
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC);
+#endif
+}
+#endif
+
+#if (!defined(NO__1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I) && !defined(JNI64)) || (!defined(NO__1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I) && defined(JNI64))
+#ifndef JNI64
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2)
+#else
+JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2)
+#endif
+{
+ GtkAllocation _arg1, *lparg1=NULL;
+#ifndef JNI64
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC);
+#else
+ GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC);
+#endif
+ if (arg1) if ((lparg1 = getGtkAllocationFields(env, arg1, &_arg1)) == NULL) goto fail;
+/*
+ gtk_widget_size_allocate((GtkWidget *)arg0, (GtkAllocation *)lparg1, arg2);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_widget_size_allocate)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *, jint))fp)((GtkWidget *)arg0, (GtkAllocation *)lparg1, arg2);
+ }
+ }
fail:
- GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1allocate_FUNC);
+#ifndef JNI64
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC);
+#else
+ GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC);
+#endif
}
#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 9e295d72f4..cbf8407b09 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
@@ -274,18 +274,9 @@
#define NO__1gdk_1screen_1is_1composited
// Miscellaneous functions removed from GTK4
-#define NO__1gtk_1button_1set_1image
#define NO__1gtk_1misc_1set_1alignment
-#define NO__1gtk_1toggle_1button_1set_1inconsistent
-#define NO__1gtk_1toggle_1button_1set_1mode
-#define NO__1gtk_1toolbar_1set_1icon_1size
-#define NO__1gdk_1flush
-#define NO__1gdk_1keymap_1get_1for_1display
-#define NO__1gdk_1pango_1context_1get
-#define NO__1gdk_1set_1program_1class
#define NO__1gdk_1test_1simulate_1button
#define NO__1gdk_1test_1simulate_1key
-#define NO__1gdk_1atom_1intern
#define NO__1gdk_1atom_1name
#define NO__1gdk_1cairo_1create
#define NO_gdk_1threads_1leave
@@ -293,11 +284,6 @@
#define NO__1gdk_1selection_1owner_1get
#define NO__1gdk_1visual_1get_1depth
-// Some drawing functions have been removed on GTK4
-#define NO__1gtk_1widget_1draw
-#define NO__1gtk_1widget_1set_1redraw_1on_1allocate
-#define NO__1gtk_1widget_1shape_1combine_1region
-
// Some GtkContainer functions don't exist on GTK4
#define NO__1gtk_1container_1propagate_1draw
#define NO__1gtk_1container_1set_1border_1width
@@ -321,11 +307,6 @@
#define NO__1gtk_1drag_1set_1icon_1surface
// Some sizing functions are not available on GTK4
-#define NO__1gtk_1widget_1get_1preferred_1height
-#define NO__1gtk_1widget_1get_1preferred_1height_1for_1width
-#define NO__1gtk_1widget_1get_1preferred_1width_1for_1height
-#define NO__1gtk_1widget_1size_1allocate
-#define NO__1gtk_1widget_1set_1allocation
#define NO__1gtk_1window_1set_1geometry_1hints
// No GdkWindow on GTK4, this includes parameter casting
@@ -392,9 +373,6 @@
#define NO__1gtk_1tree_1view_1get_1bin_1window
// Event related functions removed in GTK4
-#define NO__1gtk_1event_1box_1new
-#define NO__1gtk_1widget_1add_1events
-#define NO__1gtk_1widget_1get_1events
#define NO__1gdk_1event_1free
#define NO__1gdk_1event_1get
#define NO__1gdk_1event_1peek
@@ -429,13 +407,16 @@
#define NO__1gdk_1surface_1destroy
#define NO__1gdk_1surface_1focus
#define NO__1gdk_1device_1get_1surface_1at_1position
+#define NO__1gdk_1display_1get_1monitor_1at_1surface
+#define NO__1gdk_1surface_1get_1frame_1extents
// Miscellaneous functions not present on GTK3
#define NO__1gdk_1device_1warp__III
#define NO__1gdk_1device_1warp__JII
#define NO__1gdk_1cursor_1new_1from_1name___3BI
#define NO__1gdk_1cursor_1new_1from_1name___3BJ
-
+#define NO__1gdk_1display_1get_1keymap
+#define NO__1gtk_1style_1context_1add_1provider_1for_1display
#endif
#include "os_custom.h"
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 4e3c65c2d0..64e70086d0 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
@@ -37,9 +37,9 @@
#define LIB_FONTCONFIG "libfontconfig-1.dll"
#else
#if GTK_CHECK_VERSION(3,94,0)
-#define LIB_GTK "libgtk-4.so.0"
+#define LIB_GTK "libgtk-4.so.0.9400.0"
// Point GDK to GTK for GTK4
-#define LIB_GDK "libgtk-4.so.0"
+#define LIB_GDK "libgtk-4.so.0.9400.0"
#else
#define LIB_GTK "libgtk-3.so.0"
#define LIB_GDK "libgdk-3.so.0"
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 c58bad23e0..d7f03d07d8 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
@@ -85,8 +85,10 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1display_1get_1default_1group",
"_1gdk_1display_1get_1default_1seat",
"_1gdk_1display_1get_1device_1manager",
+ "_1gdk_1display_1get_1keymap",
"_1gdk_1display_1get_1monitor",
"_1gdk_1display_1get_1monitor_1at_1point",
+ "_1gdk_1display_1get_1monitor_1at_1surface",
"_1gdk_1display_1get_1monitor_1at_1window",
"_1gdk_1display_1get_1n_1monitors",
"_1gdk_1display_1get_1primary_1monitor",
@@ -167,6 +169,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1surface_1create_1similar_1surface",
"_1gdk_1surface_1destroy",
"_1gdk_1surface_1focus",
+ "_1gdk_1surface_1get_1frame_1extents",
"_1gdk_1text_1property_1to_1utf8_1list_1for_1display",
"_1gdk_1unicode_1to_1keyval",
"_1gdk_1utf8_1to_1string_1target",
@@ -794,8 +797,18 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1status_1icon_1set_1visible",
"_1gtk_1style_1context_1add_1class",
"_1gtk_1style_1context_1add_1provider",
+ "_1gtk_1style_1context_1add_1provider_1for_1display",
"_1gtk_1style_1context_1add_1provider_1for_1screen",
- "_1gtk_1style_1context_1get",
+#ifndef JNI64
+ "_1gtk_1style_1context_1get__II_3B_3II",
+#else
+ "_1gtk_1style_1context_1get__JI_3B_3JJ",
+#endif
+#ifndef JNI64
+ "_1gtk_1style_1context_1get__I_3B_3II",
+#else
+ "_1gtk_1style_1context_1get__J_3B_3JJ",
+#endif
"_1gtk_1style_1context_1get_1background_1color",
"_1gtk_1style_1context_1get_1border",
"_1gtk_1style_1context_1get_1color",
@@ -1097,7 +1110,16 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1widget_1set_1visible",
"_1gtk_1widget_1shape_1combine_1region",
"_1gtk_1widget_1show",
- "_1gtk_1widget_1size_1allocate",
+#ifndef JNI64
+ "_1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2",
+#else
+ "_1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2",
+#endif
+#ifndef JNI64
+ "_1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I",
+#else
+ "_1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I",
+#endif
#ifndef JNI64
"_1gtk_1widget_1style_1get__I_3B_3II",
#else
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 73e3a0d8eb..b87a5aa80c 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
@@ -95,8 +95,10 @@ typedef enum {
_1gdk_1display_1get_1default_1group_FUNC,
_1gdk_1display_1get_1default_1seat_FUNC,
_1gdk_1display_1get_1device_1manager_FUNC,
+ _1gdk_1display_1get_1keymap_FUNC,
_1gdk_1display_1get_1monitor_FUNC,
_1gdk_1display_1get_1monitor_1at_1point_FUNC,
+ _1gdk_1display_1get_1monitor_1at_1surface_FUNC,
_1gdk_1display_1get_1monitor_1at_1window_FUNC,
_1gdk_1display_1get_1n_1monitors_FUNC,
_1gdk_1display_1get_1primary_1monitor_FUNC,
@@ -177,6 +179,7 @@ typedef enum {
_1gdk_1surface_1create_1similar_1surface_FUNC,
_1gdk_1surface_1destroy_FUNC,
_1gdk_1surface_1focus_FUNC,
+ _1gdk_1surface_1get_1frame_1extents_FUNC,
_1gdk_1text_1property_1to_1utf8_1list_1for_1display_FUNC,
_1gdk_1unicode_1to_1keyval_FUNC,
_1gdk_1utf8_1to_1string_1target_FUNC,
@@ -792,8 +795,18 @@ typedef enum {
_1gtk_1status_1icon_1set_1visible_FUNC,
_1gtk_1style_1context_1add_1class_FUNC,
_1gtk_1style_1context_1add_1provider_FUNC,
+ _1gtk_1style_1context_1add_1provider_1for_1display_FUNC,
_1gtk_1style_1context_1add_1provider_1for_1screen_FUNC,
- _1gtk_1style_1context_1get_FUNC,
+#ifndef JNI64
+ _1gtk_1style_1context_1get__II_3B_3II_FUNC,
+#else
+ _1gtk_1style_1context_1get__JI_3B_3JJ_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1style_1context_1get__I_3B_3II_FUNC,
+#else
+ _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,
@@ -1095,7 +1108,16 @@ typedef enum {
_1gtk_1widget_1set_1visible_FUNC,
_1gtk_1widget_1shape_1combine_1region_FUNC,
_1gtk_1widget_1show_FUNC,
- _1gtk_1widget_1size_1allocate_FUNC,
+#ifndef JNI64
+ _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC,
+#else
+ _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2_FUNC,
+#endif
+#ifndef JNI64
+ _1gtk_1widget_1size_1allocate__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC,
+#else
+ _1gtk_1widget_1size_1allocate__JLorg_eclipse_swt_internal_gtk_GtkAllocation_2I_FUNC,
+#endif
#ifndef JNI64
_1gtk_1widget_1style_1get__I_3B_3II_FUNC,
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index 698ef824ee..4ff456def2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -462,9 +462,12 @@ public class GDK extends OS {
lock.unlock();
}
}
- /** @param atom_name cast=(const gchar *),flags=no_out critical */
+ /**
+ * @method flags=dynamic
+ * @param atom_name cast=(const gchar *),flags=no_out critical
+ */
public static final native long /*int*/ _gdk_atom_intern(byte[] atom_name, boolean only_if_exists);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final long /*int*/ gdk_atom_intern(byte[] atom_name, boolean only_if_exists) {
lock.lock();
try {
@@ -1101,8 +1104,11 @@ public class GDK extends OS {
lock.unlock();
}
}
+ /**
+ * @method flags=dynamic
+ */
public static final native void _gdk_flush();
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gdk_flush() {
lock.lock();
try {
@@ -1122,10 +1128,11 @@ public class GDK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param display cast=(GdkDisplay *)
*/
public static final native long /*int*/ _gdk_keymap_get_for_display(long /*int*/ display);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final long /*int*/ gdk_keymap_get_for_display(long /*int*/ display) {
lock.lock();
try {
@@ -1135,6 +1142,19 @@ public class GDK extends OS {
}
}
/**
+ * @param display cast=(GdkDisplay *)
+ */
+ public static final native long /*int*/ _gdk_display_get_keymap(long /*int*/ display);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final long /*int*/ gdk_display_get_keymap(long /*int*/ display) {
+ lock.lock();
+ try {
+ return _gdk_display_get_keymap(display);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @param keymap cast=(GdkKeymap *)
* @param hardware_keycode cast=(guint)
* @param state cast=(GdkModifierType)
@@ -1186,8 +1206,11 @@ public class GDK extends OS {
lock.unlock();
}
}
+ /**
+ * @method flags=dynamic
+ */
public static final native long /*int*/ _gdk_pango_context_get();
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final long /*int*/ gdk_pango_context_get() {
lock.lock();
try {
@@ -1647,6 +1670,20 @@ public class GDK extends OS {
}
}
/**
+ * @param display cast=(GdkDisplay *)
+ * @param surface cast=(GdkSurface *)
+ */
+ public static final native long /*int*/ _gdk_display_get_monitor_at_surface(long /*int*/ display, long /*int*/ surface);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final long /*int*/ gdk_display_get_monitor_at_surface(long /*int*/ display, long /*int*/ surface) {
+ lock.lock();
+ try {
+ return _gdk_display_get_monitor_at_surface(display, surface);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @method flags=dynamic
*/
public static final native int _gdk_display_get_n_monitors(long /*int*/ display);
@@ -1864,9 +1901,12 @@ public class GDK extends OS {
lock.unlock();
}
}
- /** @param program_class cast=(const char *) */
+ /**
+ * @method flags=dynamic
+ * @param program_class cast=(const char *)
+ */
public static final native void _gdk_set_program_class(byte[] program_class);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gdk_set_program_class(byte[] program_class) {
lock.lock();
try {
@@ -2076,6 +2116,20 @@ public class GDK extends OS {
}
}
/**
+ * @param surface cast=(GdkSurface *)
+ * @param rect cast=(GdkRectangle *),flags=no_in
+ */
+ public static final native void _gdk_surface_get_frame_extents(long /*int*/ surface, GdkRectangle rect);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final void gdk_surface_get_frame_extents(long /*int*/ surface, GdkRectangle rect) {
+ lock.lock();
+ try {
+ _gdk_surface_get_frame_extents(surface, rect);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @param window cast=(GdkWindow *)
* @param x cast=(gint *)
* @param y cast=(gint *)
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 0531e922c9..86f6b19176 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
@@ -516,11 +516,12 @@ public class GTK extends OS {
}
/**
+ * @method flags=dynamic
* @param button cast=(GtkButton *)
* @param image cast=(GtkWidget *)
*/
public static final native void /*int*/ _gtk_button_set_image(long /*int*/ button, long /*int*/ image);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void /*int*/ gtk_button_set_image(long /*int*/ button, long /*int*/ image) {
lock.lock();
try {
@@ -1049,13 +1050,14 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param width cast=(gint)
* @param minimum_size cast=(gint *)
* @param natural_size cast=(gint *)
*/
public static final native void _gtk_widget_get_preferred_height_for_width(long /*int*/ widget, int width, int[] minimum_size, int[] natural_size);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_get_preferred_height_for_width(long /*int*/ widget, int width, int[] minimum_size, int[] natural_size) {
lock.lock();
try {
@@ -1065,12 +1067,13 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param minimum_size cast=(gint *)
* @param natural_size cast=(gint *)
*/
public static final native void _gtk_widget_get_preferred_height(long /*int*/ widget, int[] minimum_size, int[] natural_size);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_get_preferred_height(long /*int*/ widget, int[] minimum_size, int[] natural_size) {
lock.lock();
try {
@@ -1080,13 +1083,14 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param height cast=(gint)
* @param minimum_size cast=(gint *)
* @param natural_size cast=(gint *)
*/
public static final native void _gtk_widget_get_preferred_width_for_height(long /*int*/ widget, int height, int[] minimum_size, int[] natural_size);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_get_preferred_width_for_height(long /*int*/ widget, int height, int[] minimum_size, int[] natural_size) {
lock.lock();
try {
@@ -3136,7 +3140,11 @@ public class GTK extends OS {
lock.unlock();
}
}
+ /**
+ * @method flags=dynamic
+ */
public static final native long /*int*/ _gtk_event_box_new();
+ /** [GTK3 only] */
public static final long /*int*/ gtk_event_box_new() {
lock.lock();
try {
@@ -3787,6 +3795,22 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
+ * @param display cast=(GdkDisplay *)
+ * @param provider cast=(GtkStyleProvider *)
+ * @param priority cast=(guint)
+ */
+ public static final native void _gtk_style_context_add_provider_for_display (long /*int*/ display, long /*int*/ provider, int priority);
+ /** [GTK4 only] */
+ public static final void gtk_style_context_add_provider_for_display(long /*int*/ display, long /*int*/ provider, int priority) {
+ lock.lock();
+ try {
+ _gtk_style_context_add_provider_for_display(display, provider, priority);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @param context cast=(GtkStyleContext *)
* @param provider cast=(GtkStyleProvider *)
* @param priority cast=(guint)
@@ -5868,6 +5892,20 @@ public class GTK extends OS {
}
/**
* @method flags=dynamic
+ * @param property cast=(const gchar *),flags=no_out
+ * @param terminator cast=(const gchar *),flags=sentinel
+ */
+ public static final native void _gtk_style_context_get(long /*int*/ context, byte [] property, long /*int*/ [] value, long /*int*/ terminator);
+ public static final void gtk_style_context_get(long /*int*/ context, byte [] property, long /*int*/ [] value, long /*int*/ terminator) {
+ lock.lock();
+ try {
+ _gtk_style_context_get(context, property, value, terminator);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @method flags=dynamic
* @param context cast=(GtkStyleContext *)
* @param state cast=(GtkStateFlags)
* @param padding cast=(GtkBorder *),flags=no_in
@@ -6526,11 +6564,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param toggle_button cast=(GtkToggleButton *)
* @param setting cast=(gboolean)
*/
public static final native void _gtk_toggle_button_set_inconsistent(long /*int*/ toggle_button, boolean setting);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_toggle_button_set_inconsistent(long /*int*/ toggle_button, boolean setting) {
lock.lock();
try {
@@ -6540,11 +6579,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param toggle_button cast=(GtkToggleButton *)
* @param draw_indicator cast=(gboolean)
*/
public static final native void _gtk_toggle_button_set_mode(long /*int*/ toggle_button, boolean draw_indicator);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_toggle_button_set_mode(long /*int*/ toggle_button, boolean draw_indicator) {
lock.lock();
try {
@@ -6748,10 +6788,11 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param toolbar cast=(GtkToolbar *)
*/
public static final native void _gtk_toolbar_set_icon_size(long /*int*/ toolbar, int size);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_toolbar_set_icon_size(long /*int*/ toolbar, int size) {
lock.lock();
try {
@@ -8035,11 +8076,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param events cast=(gint)
*/
public static final native void _gtk_widget_add_events(long /*int*/ widget, int events);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_add_events(long /*int*/ widget, int events) {
lock.lock();
try {
@@ -8095,11 +8137,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param cr cast=(cairo_t *)
*/
public static final native void _gtk_widget_draw(long /*int*/ widget, long /*int*/ cr);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_draw(long /*int*/ widget, long /*int*/ cr) {
lock.lock();
try {
@@ -8198,10 +8241,11 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
*/
public static final native int _gtk_widget_get_events(long /*int*/ widget);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final int gtk_widget_get_events(long /*int*/ widget) {
lock.lock();
try {
@@ -8689,11 +8733,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param redraw cast=(gboolean)
*/
public static final native void _gtk_widget_set_redraw_on_allocate(long /*int*/ widget, boolean redraw);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_set_redraw_on_allocate(long /*int*/ widget, boolean redraw) {
lock.lock();
try {
@@ -8740,6 +8785,7 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param allocation cast=(GtkAllocation *),flags=no_out
*/
@@ -8754,11 +8800,27 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ * @param allocation cast=(GtkAllocation *),flags=no_out
+ */
+ public static final native void _gtk_widget_size_allocate(long /*int*/ widget, GtkAllocation allocation, int baseline);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final void gtk_widget_size_allocate(long /*int*/ widget, GtkAllocation allocation, int baseline) {
+ lock.lock();
+ try {
+ _gtk_widget_size_allocate(widget, allocation, baseline);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param allocation cast=(GtkAllocation *),flags=no_out
*/
public static final native void _gtk_widget_set_allocation(long /*int*/ widget, GtkAllocation allocation);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_set_allocation(long /*int*/ widget, GtkAllocation allocation) {
lock.lock();
try {
@@ -9330,11 +9392,12 @@ public class GTK extends OS {
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param region cast=(cairo_region_t *)
*/
public static final native void _gtk_widget_shape_combine_region(long /*int*/ widget, long /*int*/ region);
- /** [GTK3 only, if-def'd in os.h] */
+ /** [GTK3 only] */
public static final void gtk_widget_shape_combine_region(long /*int*/ widget, long /*int*/ region) {
lock.lock();
try {
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 7dc8600165..ca1865c51f 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
@@ -652,11 +652,19 @@ protected void init () {
GTK.gtk_widget_realize(shellHandle);
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
- long /*int*/ surface = GDK.gdk_window_create_similar_surface(GDK.gdk_get_default_root_window(), Cairo.CAIRO_CONTENT_COLOR, 10, 10);
double sx[] = new double[1];
double sy[] = new double[1];
+ long /*int*/ gdkResource;
+ long /*int*/ surface;
+ if (GTK.GTK4) {
+ GTK.gtk_widget_realize(shellHandle);
+ gdkResource = GTK.gtk_widget_get_surface(shellHandle);
+ surface = GDK.gdk_surface_create_similar_surface(gdkResource, Cairo.CAIRO_CONTENT_COLOR, 10, 10);
+ } else {
+ gdkResource = GDK.gdk_get_default_root_window();
+ surface = GDK.gdk_window_create_similar_surface(gdkResource, Cairo.CAIRO_CONTENT_COLOR, 10, 10);
+ }
Cairo.cairo_surface_get_device_scale(surface, sx, sy);
-
DPIUtil.setUseCairoAutoScale((sx[0]*100) == scaleFactor);
}
@@ -669,7 +677,11 @@ protected void init () {
} 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);
- GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_style_context_get(context, GTK.gtk_style_property_font, defaultFontArray, 0);
+ } else {
+ GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
+ }
GTK.gtk_style_context_restore(context);
defaultFont = defaultFontArray [0];
} else {
@@ -704,12 +716,7 @@ protected void init () {
* Note that much of eclipse 'dark theme' is done by platform.ui's CSS engine, not by SWT.
*/
private void overrideThemeValues () {
- long /*int*/ screen = GDK.gdk_screen_get_default();
long /*int*/ provider = GTK.gtk_css_provider_new();
- if (screen == 0 || provider == 0) {
- System.err.println("SWT Warning: Override of theme values failed. Reason: could not acquire screen or provider.");
- return;
- }
BiFunction <String, Boolean, String> load = (path, isResource) -> {
try {
@@ -760,7 +767,21 @@ private void overrideThemeValues () {
combinedCSS.append(load.apply(additionalCSSPath, false));
}
- GTK.gtk_style_context_add_provider_for_screen (screen, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ if (GTK.GTK4) {
+ long /*int*/ display = GDK.gdk_display_get_default();
+ if (display == 0 || provider == 0) {
+ System.err.println("SWT Warning: Override of theme values failed. Reason: could not acquire display or provider.");
+ return;
+ }
+ GTK.gtk_style_context_add_provider_for_display (display, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ } else {
+ long /*int*/ screen = GDK.gdk_screen_get_default();
+ if (screen == 0 || provider == 0) {
+ System.err.println("SWT Warning: Override of theme values failed. Reason: could not acquire screen or provider.");
+ return;
+ }
+ 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);
}
@@ -1050,15 +1071,20 @@ int _getDPIx () {
* @since 3.105
*/
protected int getDeviceZoom() {
- long /*int*/ screen = GDK.gdk_screen_get_default();
- int dpi = (int) GDK.gdk_screen_get_resolution (screen);
- if (dpi <= 0) dpi = 96; // gdk_screen_get_resolution returns -1 in case of error
+ /*
+ * We can hard-code 96 as gdk_screen_get_resolution will always return -1
+ * if gdk_screen_set_resolution has not been called.
+ */
+ int dpi = 96;
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
long /*int*/ display = GDK.gdk_display_get_default();
long /*int*/ monitor = GDK.gdk_display_get_monitor_at_point(display, 0, 0);
int scale = GDK.gdk_monitor_get_scale_factor(monitor);
dpi = dpi * scale;
} else if (GTK.GTK_VERSION > OS.VERSION(3, 9, 0)) {
+ long /*int*/ screen = GDK.gdk_screen_get_default();
+ dpi = (int) GDK.gdk_screen_get_resolution (screen);
+ if (dpi <= 0) dpi = 96; // gdk_screen_get_resolution returns -1 in case of error
int monitor_num = GDK.gdk_screen_get_monitor_at_point (screen, 0, 0);
int scale = GDK.gdk_screen_get_monitor_scale_factor (screen, monitor_num);
dpi = dpi * scale;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 685563b7f6..e1d1e314a9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -297,7 +297,7 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
}
handle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_widget_set_has_window (handle, true);
+ gtk_widget_set_has_surface_or_window (handle, true);
GTK.gtk_widget_set_can_focus (handle, true);
if ((style & SWT.EMBEDDED) == 0) {
if ((state & CANVAS) != 0) {
@@ -406,7 +406,11 @@ void adjustChildClipping (long /*int*/ widget) {
// Call gtk_widget_get_preferred_size() to prevent warnings
GTK.gtk_widget_get_preferred_size(widget, minimumSize, naturalSize);
// Allocate and queue a resize event
- GTK.gtk_widget_size_allocate(widget, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate(widget, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate(widget, allocation);
+ }
GTK.gtk_widget_queue_resize(widget);
}
}
@@ -895,7 +899,7 @@ boolean hasBorder () {
void hookEvents () {
super.hookEvents ();
if ((state & CANVAS) != 0) {
- GTK.gtk_widget_add_events (handle, GDK.GDK_POINTER_MOTION_HINT_MASK);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (handle, GDK.GDK_POINTER_MOTION_HINT_MASK);
if (scrolledHandle != 0) {
OS.g_signal_connect_closure (scrolledHandle, OS.scroll_child, display.getClosure (SCROLL_CHILD), false);
}
@@ -1281,7 +1285,11 @@ void moveChildren(int oldWidth) {
gtk_widget_get_preferred_size (topHandle, requisition);
allocation.x = x;
allocation.y = y;
- GTK.gtk_widget_size_allocate (topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
Control control = child.findBackgroundControl ();
if (control != null && control.backgroundImage != null) {
if (child.isVisible ()) child.redrawWidget (0, 0, 0, 0, true, true, true);
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 1b3740d97b..e17656bcf8 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
@@ -156,7 +156,7 @@ public Control (Composite parent, int style) {
void connectPaint () {
long /*int*/ paintHandle = paintHandle ();
int paintMask = GDK.GDK_EXPOSURE_MASK;
- GTK.gtk_widget_add_events (paintHandle, paintMask);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (paintHandle, paintMask);
OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (EXPOSE_EVENT_INVERSE), false);
@@ -368,7 +368,7 @@ void hookEvents () {
/* Connect the keyboard signals */
long /*int*/ focusHandle = focusHandle ();
int focusMask = GDK.GDK_KEY_PRESS_MASK | GDK.GDK_KEY_RELEASE_MASK | GDK.GDK_FOCUS_CHANGE_MASK;
- GTK.gtk_widget_add_events (focusHandle, focusMask);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (focusHandle, focusMask);
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [POPUP_MENU], 0, display.getClosure (POPUP_MENU), false);
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [SHOW_HELP], 0, display.getClosure (SHOW_HELP), false);
OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_PRESS_EVENT], 0, display.getClosure (KEY_PRESS_EVENT), false);
@@ -380,7 +380,7 @@ void hookEvents () {
/* Connect the mouse signals */
long /*int*/ eventHandle = eventHandle ();
int eventMask = GDK.GDK_POINTER_MOTION_MASK | GDK.GDK_BUTTON_PRESS_MASK | GDK.GDK_BUTTON_RELEASE_MASK | GDK.GDK_SCROLL_MASK | GDK.GDK_SMOOTH_SCROLL_MASK;
- GTK.gtk_widget_add_events (eventHandle, eventMask);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (eventHandle, eventMask);
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.getClosure (BUTTON_PRESS_EVENT), false);
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.getClosure (BUTTON_RELEASE_EVENT), false);
OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.getClosure (MOTION_NOTIFY_EVENT), false);
@@ -389,7 +389,7 @@ void hookEvents () {
/* Connect enter/exit signals */
long /*int*/ enterExitHandle = enterExitHandle ();
int enterExitMask = GDK.GDK_ENTER_NOTIFY_MASK | GDK.GDK_LEAVE_NOTIFY_MASK;
- GTK.gtk_widget_add_events (enterExitHandle, enterExitMask);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (enterExitHandle, enterExitMask);
OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.getClosure (ENTER_NOTIFY_EVENT), false);
OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [LEAVE_NOTIFY_EVENT], 0, display.getClosure (LEAVE_NOTIFY_EVENT), false);
@@ -473,7 +473,7 @@ long /*int*/ paintHandle () {
long /*int*/ topHandle = topHandle ();
long /*int*/ paintHandle = handle;
while (paintHandle != topHandle) {
- if (GTK.gtk_widget_get_has_window (paintHandle)) break;
+ if (gtk_widget_get_has_surface_or_window (paintHandle)) break;
paintHandle = GTK.gtk_widget_get_parent (paintHandle);
}
return paintHandle;
@@ -483,7 +483,11 @@ long /*int*/ paintHandle () {
long /*int*/ paintWindow () {
long /*int*/ paintHandle = paintHandle ();
GTK.gtk_widget_realize (paintHandle);
- return gtk_widget_get_window (paintHandle);
+ if (GTK.GTK4) {
+ return gtk_widget_get_surface (paintHandle);
+ } else {
+ return gtk_widget_get_window (paintHandle);
+ }
}
/**
@@ -770,7 +774,11 @@ void forceResize () {
gtk_widget_get_preferred_size (topHandle, requisition);
GtkAllocation allocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation(topHandle, allocation);
- GTK.gtk_widget_size_allocate (topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
}
/**
@@ -1035,7 +1043,11 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
Control focusControl = display.getFocusControl();
GTK.gtk_widget_show(topHandle);
gtk_widget_get_preferred_size (topHandle, requisition);
- GTK.gtk_widget_size_allocate (topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
GTK.gtk_widget_hide(topHandle);
/* Bug 540002: Showing and hiding widget causes original focused control to loose focus,
* Reset focus to original focused control after dealing with allocation.
@@ -1044,7 +1056,11 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
focusControl.setFocus();
}
} else {
- GTK.gtk_widget_size_allocate (topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
}
}
/*
@@ -3684,10 +3700,12 @@ long /*int*/ gtk_preedit_changed (long /*int*/ imcontext) {
@Override
long /*int*/ gtk_realize (long /*int*/ widget) {
- long /*int*/ imHandle = imHandle ();
- if (imHandle != 0) {
- long /*int*/ window = gtk_widget_get_window (paintHandle ());
- GTK.gtk_im_context_set_client_window (imHandle, window);
+ if (!GTK.GTK4) {
+ long /*int*/ imHandle = imHandle ();
+ if (imHandle != 0) {
+ long /*int*/ window = gtk_widget_get_window (paintHandle ());
+ GTK.gtk_im_context_set_client_window (imHandle, window);
+ }
}
if (backgroundImage != null) {
setBackgroundSurface (backgroundImage);
@@ -3743,8 +3761,10 @@ long /*int*/ gtk_style_set (long /*int*/ widget, long /*int*/ previousStyle) {
@Override
long /*int*/ gtk_unrealize (long /*int*/ widget) {
- long /*int*/ imHandle = imHandle ();
- if (imHandle != 0) GTK.gtk_im_context_set_client_window (imHandle, 0);
+ if (!GTK.GTK4) {
+ long /*int*/ imHandle = imHandle ();
+ if (imHandle != 0) GTK.gtk_im_context_set_client_window (imHandle, 0);
+ }
return 0;
}
@@ -4968,7 +4988,11 @@ void setInitialBounds () {
if (mustBeVisibleOnInitBounds ()) {
GTK.gtk_widget_set_visible(topHandle, true);
}
- GTK.gtk_widget_size_allocate(topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
} else {
resizeHandle (1, 1);
forceResize ();
@@ -5245,7 +5269,11 @@ public boolean setParent (Composite parent) {
allocation.y = y;
allocation.width = width;
allocation.height = height;
- GTK.gtk_widget_size_allocate (topHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (topHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (topHandle, allocation);
+ }
this.parent = parent;
setZOrder (null, false, true);
reskin (SWT.ALL);
@@ -6096,7 +6124,7 @@ void update (boolean all, boolean flush) {
if (GTK.GTK_VERSION < OS.VERSION(3, 16, 0)) {
GDK.gdk_window_process_updates (window, all);
}
- GDK.gdk_flush ();
+ if (!GTK.GTK4) GDK.gdk_flush ();
}
void updateBackgroundMode () {
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 b5ab6d45c7..8768428801 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
@@ -1029,13 +1029,14 @@ void checkXimModule () {
}
void createDisplay (DeviceData data) {
- if (!GTK.gtk_init_check (new long /*int*/ [] {0}, null)) {
- SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]"); //$NON-NLS-1$
- }
+ boolean init = GTK.GTK4 ? GTK.gtk_init_check () : GTK.gtk_init_check (new long /*int*/ [] {0}, null);
+ if (!init) SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]"); //$NON-NLS-1$
checkXimModule();
//set GTK+ Theme name as property for introspection purposes
System.setProperty("org.eclipse.swt.internal.gtk.theme", OS.getThemeName());
- if (OS.isX11()) xDisplay = GDK.gdk_x11_get_default_xdisplay();
+ if (OS.isX11()) {
+ xDisplay = GTK.GTK4 ? 0 : GDK.gdk_x11_get_default_xdisplay();
+ }
long /*int*/ ptr = GTK.gtk_check_version (GTK3_MAJOR, GTK3_MINOR, GTK3_MICRO);
if (ptr != 0) {
int length = C.strlen (ptr);
@@ -1096,7 +1097,9 @@ void createDisplay (DeviceData data) {
GTK.gtk_widget_set_default_direction (GTK.GTK_TEXT_DIR_LTR);
byte [] buffer = Converter.wcsToMbcs (APP_NAME, true);
OS.g_set_prgname (buffer);
- GDK.gdk_set_program_class (buffer);
+ if (OS.isX11() && !GTK.GTK4) {
+ GDK.gdk_set_program_class (buffer);
+ }
/* Initialize the hidden shell */
shellHandle = GTK.gtk_window_new (GTK.GTK_WINDOW_TOPLEVEL);
@@ -1109,22 +1112,32 @@ void createDisplay (DeviceData data) {
if (eventProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
GDK.gdk_event_handler_set (eventProc, 0, 0);
- byte[] atomName = Converter.wcsToMbcs ("SWT_Window_" + APP_NAME, true); //$NON-NLS-1$
- long /*int*/ atom = GDK.gdk_atom_intern(atomName, false);
- GDK.gdk_selection_owner_set(GTK.gtk_widget_get_window(shellHandle), atom, OS.CurrentTime, false);
- GDK.gdk_selection_owner_get(atom);
-
signalCallback = new Callback (this, "signalProc", 3); //$NON-NLS-1$
signalProc = signalCallback.getAddress ();
if (signalProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- GTK.gtk_widget_add_events (shellHandle, GDK.GDK_PROPERTY_CHANGE_MASK);
- OS.g_signal_connect (shellHandle, OS.property_notify_event, signalProc, PROPERTY_NOTIFY);
+
+ if (!GTK.GTK4) {
+ byte[] atomName = Converter.wcsToMbcs ("SWT_Window_" + APP_NAME, true); //$NON-NLS-1$
+ long /*int*/ atom = GDK.gdk_atom_intern(atomName, false);
+ GDK.gdk_selection_owner_set(GTK.gtk_widget_get_window(shellHandle), atom, OS.CurrentTime, false);
+ GDK.gdk_selection_owner_get(atom);
+
+ // No GdkWindow on GTK4
+ GTK.gtk_widget_add_events (shellHandle, GDK.GDK_PROPERTY_CHANGE_MASK);
+ OS.g_signal_connect (shellHandle, OS.property_notify_event, signalProc, PROPERTY_NOTIFY);
+ }
latinKeyGroup = findLatinKeyGroup ();
keysChangedCallback = new Callback (this, "keysChangedProc", 2); //$NON-NLS-1$
keysChangedProc = keysChangedCallback.getAddress ();
if (keysChangedProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- long /*int*/ keymap = GDK.gdk_keymap_get_for_display(GDK.gdk_display_get_default());
+ long /*int*/ keymap;
+ long /*int*/ display = GDK.gdk_display_get_default();
+ if (GTK.GTK4) {
+ keymap = GDK.gdk_display_get_keymap(display);
+ } else {
+ keymap = GDK.gdk_keymap_get_for_display(display);
+ }
OS.g_signal_connect (keymap, OS.keys_changed, keysChangedProc, 0);
}
@@ -1137,7 +1150,13 @@ void createDisplay (DeviceData data) {
private int findLatinKeyGroup () {
int result = 0;
groupKeysCount = new HashMap<> ();
- long /*int*/ keymap = GDK.gdk_keymap_get_for_display(GDK.gdk_display_get_default());
+ long /*int*/ keymap;
+ long /*int*/ display = GDK.gdk_display_get_default();
+ if (GTK.GTK4) {
+ keymap = GDK.gdk_display_get_keymap(display);
+ } else {
+ keymap = GDK.gdk_keymap_get_for_display(display);
+ }
// count all key groups for Latin alphabet
for (int keyval = GDK.GDK_KEY_a; keyval <= GDK.GDK_KEY_z; keyval++) {
@@ -1339,7 +1358,7 @@ long /*int*/ eventProc (long /*int*/ event, long /*int*/ data) {
int time = GDK.gdk_event_get_time (event);
if (time != 0) lastEventTime = time;
- int eventType = GDK.GDK_EVENT_TYPE (event);
+ int eventType = GTK.GTK4 ? GDK.gdk_event_get_event_type(event) : GDK.GDK_EVENT_TYPE (event);
switch (eventType) {
case GDK.GDK_BUTTON_PRESS:
case GDK.GDK_KEY_PRESS:
@@ -1477,8 +1496,10 @@ static long /*int*/ rendererRenderProc (long /*int*/ cell, long /*int*/ window,
}
void flushExposes (long /*int*/ window, boolean all) {
- GDK.gdk_flush ();
- GDK.gdk_flush ();
+ if (!GTK.GTK4) {
+ GDK.gdk_flush ();
+ GDK.gdk_flush ();
+ }
if (OS.isX11()) {
this.flushWindow = window;
this.flushAll = all;
@@ -3722,41 +3743,43 @@ void initializeColorList() {
}
void initializeSubclasses () {
- long /*int*/ pangoLayoutType = OS.PANGO_TYPE_LAYOUT ();
- long /*int*/ pangoLayoutClass = OS.g_type_class_ref (pangoLayoutType);
- pangoLayoutNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoLayoutClass);
- OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoLayoutClass, OS.pangoLayoutNewProc_CALLBACK(pangoLayoutNewProc));
- OS.g_type_class_unref (pangoLayoutClass);
-
- long /*int*/ imContextType = GTK.GTK_TYPE_IM_MULTICONTEXT ();
- long /*int*/ imContextClass = OS.g_type_class_ref (imContextType);
- imContextNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (imContextClass);
- OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (imContextClass, OS.imContextNewProc_CALLBACK(imContextNewProc));
- OS.g_type_class_unref (imContextClass);
-
- long /*int*/ pangoFontFamilyType = OS.PANGO_TYPE_FONT_FAMILY ();
- long /*int*/ pangoFontFamilyClass = OS.g_type_class_ref (pangoFontFamilyType);
- pangoFontFamilyNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoFontFamilyClass);
- OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoFontFamilyClass, OS.pangoFontFamilyNewProc_CALLBACK(pangoFontFamilyNewProc));
- OS.g_type_class_unref (pangoFontFamilyClass);
-
- long /*int*/ pangoFontFaceType = OS.PANGO_TYPE_FONT_FACE ();
- long /*int*/ pangoFontFaceClass = OS.g_type_class_ref (pangoFontFaceType);
- pangoFontFaceNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoFontFaceClass);
- OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoFontFaceClass, OS.pangoFontFaceNewProc_CALLBACK(pangoFontFaceNewProc));
- OS.g_type_class_unref (pangoFontFaceClass);
-
- if (!OS.IsWin32) { /* TODO [win32] replace unixprint */
- long /*int*/ printerOptionWidgetType = GTK.gtk_printer_option_widget_get_type();
- long /*int*/ printerOptionWidgetClass = OS.g_type_class_ref (printerOptionWidgetType);
- printerOptionWidgetNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (printerOptionWidgetClass);
- OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (printerOptionWidgetClass, OS.printerOptionWidgetNewProc_CALLBACK(printerOptionWidgetNewProc));
- OS.g_type_class_unref (printerOptionWidgetClass);
+ if (!GTK.GTK4) {
+ long /*int*/ pangoLayoutType = OS.PANGO_TYPE_LAYOUT ();
+ long /*int*/ pangoLayoutClass = OS.g_type_class_ref (pangoLayoutType);
+ pangoLayoutNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoLayoutClass);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoLayoutClass, OS.pangoLayoutNewProc_CALLBACK(pangoLayoutNewProc));
+ OS.g_type_class_unref (pangoLayoutClass);
+
+ long /*int*/ imContextType = GTK.GTK_TYPE_IM_MULTICONTEXT ();
+ long /*int*/ imContextClass = OS.g_type_class_ref (imContextType);
+ imContextNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (imContextClass);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (imContextClass, OS.imContextNewProc_CALLBACK(imContextNewProc));
+ OS.g_type_class_unref (imContextClass);
+
+ long /*int*/ pangoFontFamilyType = OS.PANGO_TYPE_FONT_FAMILY ();
+ long /*int*/ pangoFontFamilyClass = OS.g_type_class_ref (pangoFontFamilyType);
+ pangoFontFamilyNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoFontFamilyClass);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoFontFamilyClass, OS.pangoFontFamilyNewProc_CALLBACK(pangoFontFamilyNewProc));
+ OS.g_type_class_unref (pangoFontFamilyClass);
+
+ long /*int*/ pangoFontFaceType = OS.PANGO_TYPE_FONT_FACE ();
+ long /*int*/ pangoFontFaceClass = OS.g_type_class_ref (pangoFontFaceType);
+ pangoFontFaceNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (pangoFontFaceClass);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (pangoFontFaceClass, OS.pangoFontFaceNewProc_CALLBACK(pangoFontFaceNewProc));
+ OS.g_type_class_unref (pangoFontFaceClass);
+
+ if (!OS.IsWin32) { /* TODO [win32] replace unixprint */
+ long /*int*/ printerOptionWidgetType = GTK.gtk_printer_option_widget_get_type();
+ long /*int*/ printerOptionWidgetClass = OS.g_type_class_ref (printerOptionWidgetType);
+ printerOptionWidgetNewProc = OS.G_OBJECT_CLASS_CONSTRUCTOR (printerOptionWidgetClass);
+ OS.G_OBJECT_CLASS_SET_CONSTRUCTOR (printerOptionWidgetClass, OS.printerOptionWidgetNewProc_CALLBACK(printerOptionWidgetNewProc));
+ OS.g_type_class_unref (printerOptionWidgetClass);
+ }
}
}
void initializeSystemSettings () {
- OS.g_signal_connect (shellHandle, OS.style_set, signalProc, STYLE_SET);
+ if (!GTK.GTK4) OS.g_signal_connect (shellHandle, OS.style_set, signalProc, STYLE_SET);
/*
* Feature in GTK. Despite the fact that the
@@ -4430,7 +4453,7 @@ public boolean readAndDispatch () {
* code outside of SWT (i.e AWT, etc). It ensures that the current
* thread leaves the GTK lock before calling the function below.
*/
- GDK.gdk_threads_leave();
+ if (!GTK.GTK4) GDK.gdk_threads_leave();
events |= OS.g_main_context_iteration (0, false);
if (events) {
runDeferredEvents ();
@@ -5905,15 +5928,20 @@ protected long /*int*/ gsettingsProc (long /*int*/ gobject, long /*int*/ arg1, l
}
static int _getDeviceZoom (long /*int*/ monitor_num) {
- long /*int*/ screen = GDK.gdk_screen_get_default ();
- int dpi = (int) GDK.gdk_screen_get_resolution (screen);
- if (dpi <= 0) dpi = 96; // gdk_screen_get_resolution returns -1 in case of error
+ /*
+ * We can hard-code 96 as gdk_screen_get_resolution will always return -1
+ * if gdk_screen_set_resolution has not been called.
+ */
+ int dpi = 96;
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
long /*int*/ display = GDK.gdk_display_get_default();
long /*int*/ monitor = GDK.gdk_display_get_monitor_at_point(display, 0, 0);
int scale = GDK.gdk_monitor_get_scale_factor(monitor);
dpi = dpi * scale;
} else if (GTK.GTK_VERSION > OS.VERSION(3, 9, 0)) {
+ long /*int*/ screen = GDK.gdk_screen_get_default ();
+ dpi = (int) GDK.gdk_screen_get_resolution (screen);
+ if (dpi <= 0) dpi = 96; // gdk_screen_get_resolution returns -1 in case of error
int scale = GDK.gdk_screen_get_monitor_scale_factor (screen, (int) monitor_num);
dpi = dpi * scale;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 20f04131b8..cf1a1b7205 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -483,9 +483,14 @@ void adjustTrim () {
GTK.gtk_widget_get_allocation (shellHandle, allocation);
int width = allocation.width;
int height = allocation.height;
- long /*int*/ window = gtk_widget_get_window (shellHandle);
GdkRectangle rect = new GdkRectangle ();
- GDK.gdk_window_get_frame_extents (window, rect);
+ if (GTK.GTK4) {
+ long /*int*/ surface = gtk_widget_get_surface(shellHandle);
+ GDK.gdk_surface_get_frame_extents (surface, rect);
+ } else {
+ long /*int*/ window = gtk_widget_get_window (shellHandle);
+ GDK.gdk_window_get_frame_extents (window, rect);
+ }
int trimWidth = Math.max (0, rect.width - width);
int trimHeight = Math.max (0, rect.height - height);
/*
@@ -912,7 +917,7 @@ void hookEvents () {
OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.getClosure (FOCUS_OUT_EVENT), false);
if (isCustomResize ()) {
int mask = GDK.GDK_POINTER_MOTION_MASK | GDK.GDK_BUTTON_RELEASE_MASK | GDK.GDK_BUTTON_PRESS_MASK | GDK.GDK_ENTER_NOTIFY_MASK | GDK.GDK_LEAVE_NOTIFY_MASK;
- GTK.gtk_widget_add_events (shellHandle, mask);
+ if (!GTK.GTK4) GTK.gtk_widget_add_events (shellHandle, mask);
OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), false);
OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [LEAVE_NOTIFY_EVENT], 0, display.getClosure (LEAVE_NOTIFY_EVENT), false);
OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.getClosure (MOTION_NOTIFY_EVENT), false);
@@ -1034,7 +1039,7 @@ void forceResize (int width, int height) {
int clientWidth = 0;
if ((style & SWT.MIRRORED) != 0) clientWidth = getClientWidth ();
GtkAllocation allocation = new GtkAllocation ();
- int border = GTK.gtk_container_get_border_width (shellHandle);
+ int border = GTK.GTK4 ? 0 : GTK.gtk_container_get_border_width (shellHandle);
allocation.x = border;
allocation.y = border;
allocation.width = width;
@@ -1059,8 +1064,11 @@ void forceResize (int width, int height) {
allocation.y += dest_y[0];
}
}
-
- GTK.gtk_widget_size_allocate (vboxHandle, allocation);
+ if (GTK.GTK4) {
+ GTK.gtk_widget_size_allocate (vboxHandle, allocation, -1);
+ } else {
+ GTK.gtk_widget_size_allocate (vboxHandle, allocation);
+ }
if ((style & SWT.MIRRORED) != 0) moveChildren (clientWidth);
}
@@ -1497,6 +1505,15 @@ long /*int*/ gtk_leave_notify_event (long /*int*/ widget, long /*int*/ event) {
}
@Override
+long /*int*/ gtk_map (long /*int*/ widget) {
+ // No "map-event" signal on GTK4, set mapped here instead
+ if (GTK.GTK4) {
+ mapped = true;
+ }
+ return super.gtk_map(widget);
+}
+
+@Override
long /*int*/ gtk_move_focus (long /*int*/ widget, long /*int*/ directionType) {
Control control = display.getFocusControl ();
if (control != null) {
@@ -1637,7 +1654,12 @@ long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) {
@Override
long /*int*/ gtk_realize (long /*int*/ widget) {
long /*int*/ result = super.gtk_realize (widget);
- long /*int*/ window = gtk_widget_get_window (shellHandle);
+ long /*int*/ gdkResource;
+ if (GTK.GTK4) {
+ gdkResource = gtk_widget_get_surface (shellHandle);
+ } else {
+ gdkResource = gtk_widget_get_window (shellHandle);
+ }
if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) {
int decorations = 0;
int functions = 0;
@@ -1667,7 +1689,7 @@ long /*int*/ gtk_realize (long /*int*/ widget) {
if ((style & SWT.RESIZE) != 0) decorations |= GDK.GDK_DECOR_BORDER;
if ((style & SWT.NO_MOVE) == 0) functions |= GDK.GDK_FUNC_MOVE;
}
- GDK.gdk_window_set_decorations (window, decorations);
+ GDK.gdk_window_set_decorations (gdkResource, decorations);
/*
* For systems running Metacity, this call forces the style hints to
@@ -1675,11 +1697,11 @@ long /*int*/ gtk_realize (long /*int*/ widget) {
* set by the function gdk_window_set_decorations (window,
* decorations) are ignored by the window manager.
*/
- GDK.gdk_window_set_functions(window, functions);
+ GDK.gdk_window_set_functions(gdkResource, functions);
} else if ((style & SWT.NO_MOVE) != 0) {
// if the GDK_FUNC_ALL bit is present, all the other style
// bits specified as a parameter will be removed from the window
- GDK.gdk_window_set_functions (window, GDK.GDK_FUNC_ALL | GDK.GDK_FUNC_MOVE);
+ GDK.gdk_window_set_functions (gdkResource, GDK.GDK_FUNC_ALL | GDK.GDK_FUNC_MOVE);
}
if ((style & SWT.ON_TOP) != 0) GTK.gtk_window_set_keep_above(shellHandle, true);
@@ -1936,7 +1958,8 @@ void resizeBounds (int width, int height, boolean notify) {
if (enableWindow != 0) {
GDK.gdk_window_resize (enableWindow, width, height);
}
- int border = GTK.gtk_container_get_border_width (shellHandle);
+ int border = 0;
+ if (!GTK.GTK4) border = GTK.gtk_container_get_border_width (shellHandle);
int boxWidth = width - 2*border;
int boxHeight = height - 2*border;
if ((style & SWT.RESIZE) == 0) {
@@ -2159,7 +2182,12 @@ void setInitialBounds () {
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
long /*int*/ display = GDK.gdk_display_get_default();
if (display != 0) {
- long /*int*/ monitor = GDK.gdk_display_get_monitor_at_window(display, paintWindow());
+ long /*int*/ monitor;
+ if (GTK.GTK4) {
+ monitor = GDK.gdk_display_get_monitor_at_surface(display, paintWindow());
+ } else {
+ monitor = GDK.gdk_display_get_monitor_at_window(display, paintWindow());
+ }
GDK.gdk_monitor_get_geometry(monitor, dest);
width = dest.width * 5 / 8;
height = dest.height * 5 / 8;
@@ -2513,7 +2541,7 @@ public void setVisible (boolean visible) {
* code outside of SWT (i.e AWT, etc). It ensures that the current
* thread leaves the GTK lock before calling the function below.
*/
- GDK.gdk_threads_leave();
+ if (!GTK.GTK4) GDK.gdk_threads_leave();
OS.g_main_context_iteration (0, false);
if (isDisposed ()) break;
iconic = minimized || (shell != null && shell.minimized);
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 0b2fa2aee5..393c8c7ec1 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
@@ -1781,6 +1781,27 @@ long /*int*/ gtk_widget_get_window (long /*int*/ widget){
return GTK.gtk_widget_get_window (widget);
}
+long /*int*/ gtk_widget_get_surface (long /*int*/ widget){
+ GTK.gtk_widget_realize(widget);
+ return GTK.gtk_widget_get_surface (widget);
+}
+
+void gtk_widget_set_has_surface_or_window (long /*int*/ widget, boolean has) {
+ if (GTK.GTK4) {
+ GTK.gtk_widget_set_has_surface(widget, has);
+ } else {
+ GTK.gtk_widget_set_has_window(widget, has);
+ }
+}
+
+boolean gtk_widget_get_has_surface_or_window (long /*int*/ widget) {
+ if (GTK.GTK4) {
+ return GTK.gtk_widget_get_has_surface(widget);
+ } else {
+ return GTK.gtk_widget_get_has_window(widget);
+ }
+}
+
void gtk_widget_set_visible (long /*int*/ widget, boolean visible) {
GTK.gtk_widget_set_visible (widget, visible);
}

Back to the top