Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul D'Pong2020-09-03 20:52:49 +0000
committerAlexander Kurtakov2020-09-08 18:48:43 +0000
commit0d843584f3eb397d2a2e2c4830309f3cc8605fed (patch)
tree8e8c2deb58aac1865eabbbb1841c01f58ad58836
parent92b1b1b26f82a083958f385083df42b365e223f1 (diff)
downloadeclipse.platform.swt-0d843584f3eb397d2a2e2c4830309f3cc8605fed.tar.gz
eclipse.platform.swt-0d843584f3eb397d2a2e2c4830309f3cc8605fed.tar.xz
eclipse.platform.swt-0d843584f3eb397d2a2e2c4830309f3cc8605fed.zip
Bug 564795 - [GTK4] Adapt to GtkContainer removal - gtk_container_add
- Replaced gtk_container_add with corresponding widget child setting functions - Removed unnecessary gtk_widget_show (since GTK4 all widgets are visible by default) - Removed g_object_set for the margin property of GtkBox (no longer exist) Change-Id: I6a7c04f02fb38c479a9e47443d9c1d5742cc7aae Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java2
26 files changed, 297 insertions, 77 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 dff6a85ec1..1b54833b89 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
@@ -5645,6 +5645,24 @@ fail:
}
#endif
+#ifndef NO_gtk_1expander_1set_1child
+JNIEXPORT void JNICALL GTK_NATIVE(gtk_1expander_1set_1child)
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+ GTK_NATIVE_ENTER(env, that, gtk_1expander_1set_1child_FUNC);
+/*
+ gtk_expander_set_child((GtkExpander *)arg0, (GtkWidget *)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_expander_set_child)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkExpander *, GtkWidget *))fp)((GtkExpander *)arg0, (GtkWidget *)arg1);
+ }
+ }
+ GTK_NATIVE_EXIT(env, that, gtk_1expander_1set_1child_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1expander_1set_1expanded
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1expander_1set_1expanded)
(JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
@@ -6143,6 +6161,24 @@ fail:
}
#endif
+#ifndef NO_gtk_1frame_1set_1child
+JNIEXPORT void JNICALL GTK_NATIVE(gtk_1frame_1set_1child)
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+ GTK_NATIVE_ENTER(env, that, gtk_1frame_1set_1child_FUNC);
+/*
+ gtk_frame_set_child((GtkFrame *)arg0, (GtkWidget *)arg1);
+*/
+ {
+ GTK_LOAD_FUNCTION(fp, gtk_frame_set_child)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkFrame *, GtkWidget *))fp)((GtkFrame *)arg0, (GtkWidget *)arg1);
+ }
+ }
+ GTK_NATIVE_EXIT(env, that, gtk_1frame_1set_1child_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1frame_1set_1label_1widget
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1frame_1set_1label_1widget)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
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 44951971a1..8b2a31fc41 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
@@ -467,6 +467,7 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1event_1controller_1set_1propagation_1phase",
"gtk_1expander_1get_1expanded",
"gtk_1expander_1new",
+ "gtk_1expander_1set_1child",
"gtk_1expander_1set_1expanded",
"gtk_1expander_1set_1label_1widget",
"gtk_1file_1chooser_1add_1filter",
@@ -499,6 +500,7 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1font_1chooser_1set_1font",
"gtk_1frame_1get_1label_1widget",
"gtk_1frame_1new",
+ "gtk_1frame_1set_1child",
"gtk_1frame_1set_1label_1widget",
"gtk_1frame_1set_1shadow_1type",
"gtk_1gesture_1click_1new",
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 85728920c6..420b414ed1 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
@@ -465,6 +465,7 @@ typedef enum {
gtk_1event_1controller_1set_1propagation_1phase_FUNC,
gtk_1expander_1get_1expanded_FUNC,
gtk_1expander_1new_FUNC,
+ gtk_1expander_1set_1child_FUNC,
gtk_1expander_1set_1expanded_FUNC,
gtk_1expander_1set_1label_1widget_FUNC,
gtk_1file_1chooser_1add_1filter_FUNC,
@@ -497,6 +498,7 @@ typedef enum {
gtk_1font_1chooser_1set_1font_FUNC,
gtk_1frame_1get_1label_1widget_FUNC,
gtk_1frame_1new_FUNC,
+ gtk_1frame_1set_1child_FUNC,
gtk_1frame_1set_1label_1widget_FUNC,
gtk_1frame_1set_1shadow_1type_FUNC,
gtk_1gesture_1click_1new_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 871c8524fc..c7cd359205 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
@@ -993,12 +993,12 @@ public class GTK extends OS {
* @param visible cast=(gboolean)
*/
public static final native void gtk_entry_set_visibility(long entry, boolean visible);
+
+ /* GtkExpander */
+ /** @param label cast=(const gchar *) */
+ public static final native long gtk_expander_new(byte[] label);
/** @param expander cast=(GtkExpander *) */
public static final native boolean gtk_expander_get_expanded(long expander);
- /**
- * @param label cast=(const gchar *)
- */
- public static final native long gtk_expander_new(byte[] label);
/** @param expander cast=(GtkExpander *) */
public static final native void gtk_expander_set_expanded(long expander, boolean expanded);
/**
@@ -1007,6 +1007,15 @@ public class GTK extends OS {
*/
public static final native void gtk_expander_set_label_widget(long expander, long label_widget);
+ /* GtkExpander [GTK4 only] */
+ /**
+ * @method flags=dynamic
+ * @param expander cast=(GtkExpander *)
+ * @param child cast=(GtkWidget *)
+ */
+ public static final native void gtk_expander_set_child(long expander, long child);
+
+
/* GtkFileChooser */
/**
* @param chooser cast=(GtkFileChooser *)
@@ -1305,6 +1314,8 @@ public class GTK extends OS {
* @param fontname cast=(const gchar *)
*/
public static final native void gtk_font_chooser_set_font(long fsd, byte[] fontname);
+
+ /* GtkFrame */
/** @param label cast=(const gchar *) */
public static final native long gtk_frame_new(byte[] label);
/** @param frame cast=(GtkFrame *) */
@@ -1314,12 +1325,22 @@ public class GTK extends OS {
* @param label_widget cast=(GtkWidget *)
*/
public static final native void gtk_frame_set_label_widget(long frame, long label_widget);
+
+ /* GtkFrame [GTK3 only] */
/**
* @param frame cast=(GtkFrame *)
* @param type cast=(GtkShadowType)
*/
- /* [GTK3 only, if-def'd in os.h] */
public static final native void gtk_frame_set_shadow_type(long frame, int type);
+
+ /* GtkFrame [GTK4 only] */
+ /**
+ * @method flags=dynamic
+ * @param frame cast=(GtkFrame *)
+ * @param child cast=(GtkWidget *)
+ */
+ public static final native void gtk_frame_set_child(long frame, long child);
+
/* [GTK3 only, if-def'd in os.h] */
public static final native long gtk_get_current_event();
/* [GTK4 only, if-def'd in os.h] */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index a08306b372..287297a64d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -353,7 +353,7 @@ void createHandle (int index) {
default:
handle = GTK.gtk_button_new ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_widget_set_can_default (handle, true);
+ if (!GTK.GTK4) GTK.gtk_widget_set_can_default (handle, true);
break;
}
if ((style & SWT.ARROW) != 0) {
@@ -367,15 +367,27 @@ void createHandle (int index) {
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
imageHandle = GTK.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (handle, boxHandle);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_container_add (boxHandle, labelHandle);
+
+ if (GTK.GTK4) {
+ GTK.gtk_button_set_child(handle, boxHandle);
+ GTK.gtk_box_append(boxHandle, imageHandle);
+ GTK.gtk_box_append(boxHandle, labelHandle);
+ } else {
+ GTK.gtk_container_add (handle, boxHandle);
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_container_add (boxHandle, labelHandle);
+ }
+
if ((style & SWT.WRAP) != 0) {
GTK.gtk_label_set_line_wrap (labelHandle, true);
GTK.gtk_label_set_line_wrap_mode (labelHandle, OS.PANGO_WRAP_WORD_CHAR);
}
}
- GTK.gtk_container_add (fixedHandle, handle);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
if ((style & SWT.ARROW) != 0) return;
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
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 b65be479e6..68d455007f 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
@@ -534,7 +534,11 @@ void createHandle (int index) {
imContext = OS.imContextLast();
}
popupHandle = findPopupHandle (oldList);
- GTK.gtk_container_add (fixedHandle, handle);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
textRenderer = GTK.gtk_cell_renderer_text_new ();
if (textRenderer == 0) error (SWT.ERROR_NO_HANDLES);
/*
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 495bf780de..aa7a1fd4c1 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
@@ -337,7 +337,13 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
}
}
if (scrolled) {
- if (fixed) GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ if (fixed) {
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, scrolledHandle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ }
+ }
if (GTK.GTK4) {
GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
} else {
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 a11e120118..94c01f301f 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
@@ -423,44 +423,43 @@ private void createHandleForCalendar () {
calendarHandle = GTK.gtk_calendar_new ();
if (calendarHandle == 0) error (SWT.ERROR_NO_HANDLES);
- //Calenadar becomes container in this case.
+ //Calendar becomes container in this case.
handle = calendarHandle;
containerHandle = calendarHandle;
- GTK.gtk_container_add (fixedHandle, calendarHandle);
-
-
if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, calendarHandle);
+
GTK.gtk_calendar_set_show_heading(calendarHandle, true);
GTK.gtk_calendar_set_show_day_names(calendarHandle, true);
GTK.gtk_calendar_set_show_week_numbers(calendarHandle, showWeekNumbers());
} else {
+ GTK.gtk_container_add (fixedHandle, calendarHandle);
+
int flags = GTK.GTK_CALENDAR_SHOW_HEADING | GTK.GTK_CALENDAR_SHOW_DAY_NAMES;
if (showWeekNumbers()) {
flags |= GTK.GTK_CALENDAR_SHOW_WEEK_NUMBERS;
}
GTK.gtk_calendar_set_display_options (calendarHandle, flags);
+ GTK.gtk_widget_show (calendarHandle);
}
-
- GTK.gtk_widget_show (calendarHandle);
}
private void createHandleForDateWithDropDown () {
- //Create box to put entry and button into box.
containerHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
if (containerHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, containerHandle);
-
- //Create entry
textEntryHandle = GTK.gtk_entry_new ();
if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (containerHandle, textEntryHandle);
-
- GTK.gtk_widget_show (containerHandle);
- GTK.gtk_widget_show (textEntryHandle);
- handle = containerHandle;
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, containerHandle);
+ GTK.gtk_box_append(containerHandle, textEntryHandle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, containerHandle);
+ GTK.gtk_container_add (containerHandle, textEntryHandle);
+ GTK.gtk_widget_show (containerHandle);
+ GTK.gtk_widget_show (textEntryHandle);
+ }
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
// reset to default font to get the usual behavior
@@ -483,9 +482,14 @@ private void createHandleForDateTime () {
}
if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES);
- 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);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
+
+ GTK.gtk_spin_button_set_numeric (handle, false);
+ GTK.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0);
}
void createDropDownButton () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
index 2b2ff11b78..b3e6fb8c92 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -170,8 +170,13 @@ String openNativeChooserDialog () {
if (box == 0) error (SWT.ERROR_NO_HANDLES);
long label = GTK.gtk_label_new (buffer);
if (label == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (box, label);
- GTK.gtk_widget_show (label);
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(box, label);
+ } else {
+ GTK.gtk_container_add (box, label);
+ GTK.gtk_widget_show (label);
+ }
+
GTK.gtk_label_set_line_wrap (label, true);
GTK.gtk_label_set_justify (label, GTK.GTK_JUSTIFY_CENTER);
GTK.gtk_file_chooser_set_extra_widget (handle, box);
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 d865b444ff..8b93e7e5fd 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
@@ -5491,8 +5491,13 @@ void showIMWindow (Control control) {
if (preeditWindow == 0) error (SWT.ERROR_NO_HANDLES);
preeditLabel = GTK.gtk_label_new (null);
if (preeditLabel == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (preeditWindow, preeditLabel);
- GTK.gtk_widget_show (preeditLabel);
+
+ if (GTK.GTK4) {
+ GTK.gtk_window_set_child(preeditWindow, preeditLabel);
+ } else {
+ GTK.gtk_container_add (preeditWindow, preeditLabel);
+ GTK.gtk_widget_show (preeditLabel);
+ }
}
long [] preeditString = new long [1];
long [] pangoAttrs = new long [1];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index 127071d229..b57ed0ed9f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -147,14 +147,25 @@ void createHandle (int index) {
}
if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
GTK.gtk_scrolled_window_set_policy (scrolledHandle, GTK.GTK_POLICY_NEVER, GTK.GTK_POLICY_AUTOMATIC);
- GTK.gtk_container_add (fixedHandle, scrolledHandle);
- GTK.gtk_container_add(scrolledHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, scrolledHandle);
+ GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ GTK.gtk_container_add(scrolledHandle, handle);
+ }
+
if (!GTK.GTK4) {
long viewport = GTK.gtk_bin_get_child (scrolledHandle);
GTK.gtk_viewport_set_shadow_type (viewport, GTK.GTK_SHADOW_NONE);
}
} else {
- GTK.gtk_container_add (fixedHandle, handle);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
}
gtk_container_set_border_width (handle, 0);
// In GTK 3 font description is inherited from parent widget which is not how SWT has always worked,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index d3402dd934..38b4eaab66 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -130,15 +130,26 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (handle, clientHandle);
+ if (GTK.GTK4) {
+ GTK.gtk_expander_set_child(handle, clientHandle);
+ } else {
+ GTK.gtk_container_add (handle, clientHandle);
+ }
boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 4);
if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
labelHandle = GTK.gtk_label_new (null);
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
imageHandle = GTK.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_container_add (boxHandle, labelHandle);
+
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(boxHandle, imageHandle);
+ GTK.gtk_box_append(boxHandle, labelHandle);
+ } else {
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_container_add (boxHandle, labelHandle);
+ }
+
GTK.gtk_expander_set_label_widget (handle, boxHandle);
GTK.gtk_widget_set_can_focus (handle, true);
}
@@ -676,6 +687,10 @@ public void setText (String string) {
}
void showWidget (int index) {
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(parent.handle, handle);
+ gtk_box_set_child_packing (parent.handle, handle, false, false, 0, GTK.GTK_PACK_START);
+ } else {
GTK.gtk_widget_show (handle);
GTK.gtk_widget_show (clientHandle);
if (labelHandle != 0)
@@ -684,6 +699,7 @@ void showWidget (int index) {
GTK.gtk_widget_show (boxHandle);
GTK.gtk_container_add (parent.handle, handle);
gtk_box_set_child_packing (parent.handle, handle, false, false, 0, GTK.GTK_PACK_START);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 87420437f9..c55451901e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -188,10 +188,13 @@ void createHandle(int index) {
*/
gtk_widget_set_has_surface_or_window (clientHandle, true);
- GTK.gtk_container_add (fixedHandle, handle);
- GTK.gtk_container_add (handle, clientHandle);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ GTK.gtk_frame_set_child(handle, clientHandle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ GTK.gtk_container_add (handle, clientHandle);
- if (!GTK.GTK4) {
if ((style & SWT.SHADOW_IN) != 0) {
GTK.gtk_frame_set_shadow_type (handle, GTK.GTK_SHADOW_IN);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 809b58c3fc..69234ad959 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -258,8 +258,8 @@ void createHandle (int index) {
imageHandle = GTK.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
if (GTK.GTK4) {
- GTK.gtk_container_add (handle, labelHandle);
- GTK.gtk_container_add (handle, imageHandle);
+ GTK.gtk_box_append(handle, labelHandle);
+ GTK.gtk_box_append(handle, imageHandle);
gtk_box_set_child_packing(handle, labelHandle, true, true, 0, GTK.GTK_PACK_START);
gtk_box_set_child_packing(handle, imageHandle, true, true, 0, GTK.GTK_PACK_START);
} else {
@@ -273,11 +273,20 @@ void createHandle (int index) {
if ((style & SWT.BORDER) != 0) {
frameHandle = GTK.gtk_frame_new (null);
if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, frameHandle);
- GTK.gtk_container_add (frameHandle, handle);
- if (!GTK.GTK4) GTK.gtk_frame_set_shadow_type (frameHandle, GTK.GTK_SHADOW_ETCHED_IN);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, frameHandle);
+ GTK.gtk_frame_set_child(frameHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, frameHandle);
+ GTK.gtk_container_add (frameHandle, handle);
+ GTK.gtk_frame_set_shadow_type (frameHandle, GTK.GTK_SHADOW_ETCHED_IN);
+ }
} else {
- GTK.gtk_container_add (fixedHandle, handle);
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
}
if ((style & SWT.SEPARATOR) != 0) return;
if ((style & SWT.WRAP) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 78665f6e63..096a5563f2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -226,8 +226,14 @@ void createHandle (int index) {
GTK.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.text, TEXT_COLUMN);
GTK.gtk_tree_view_column_set_min_width (columnHandle, 0);
GTK.gtk_tree_view_insert_column (handle, columnHandle, index);
- GTK.gtk_container_add (fixedHandle, scrolledHandle);
- GTK.gtk_container_add (scrolledHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, scrolledHandle);
+ GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ GTK.gtk_container_add (scrolledHandle, handle);
+ }
int mode = (style & SWT.MULTI) != 0 ? GTK.GTK_SELECTION_MULTIPLE : GTK.GTK_SELECTION_BROWSE;
long selectionHandle = GTK.gtk_tree_view_get_selection (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index 9e187fed48..f9c3c9b7e6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -446,10 +446,14 @@ void createHandle (int index) {
} else {
handle = GTK.gtk_menu_bar_new ();
}
-
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+
long vboxHandle = parent.vboxHandle;
- GTK.gtk_container_add (vboxHandle, handle);
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(vboxHandle, handle);
+ } else {
+ GTK.gtk_container_add (vboxHandle, handle);
+ }
gtk_box_set_child_packing (vboxHandle, handle, false, true, 0, GTK.GTK_PACK_START);
} else {
if (GTK.GTK4) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index c901495b93..dd759f012f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -357,8 +357,12 @@ void createHandle (int index) {
if (OS.SWT_PADDED_MENU_ITEMS) {
GTK.gtk_image_set_pixel_size (imageHandle, 16);
}
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_widget_show (imageHandle);
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(boxHandle, imageHandle);
+ } else {
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_widget_show (imageHandle);
+ }
}
if (labelHandle != 0) {
GTK.gtk_label_set_xalign (labelHandle, 0);
@@ -367,8 +371,12 @@ void createHandle (int index) {
GTK.gtk_widget_show (labelHandle);
}
if (boxHandle != 0) {
- GTK.gtk_container_add (handle, boxHandle);
- GTK.gtk_widget_show (boxHandle);
+ if (GTK.GTK4) {
+ // TODO: need to implement how menu items will be populated, currently no value for handle
+ } else {
+ GTK.gtk_container_add (handle, boxHandle);
+ GTK.gtk_widget_show (boxHandle);
+ }
}
if ((style & SWT.SEPARATOR) == 0) {
if (boxHandle == 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
index 7dc654d885..c060e77a1a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -91,7 +91,13 @@ void createHandle (int index) {
gtk_widget_set_has_surface_or_window (fixedHandle, true);
handle = GTK.gtk_progress_bar_new ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
+
int orientation = (style & SWT.VERTICAL) != 0 ? GTK.GTK_PROGRESS_BOTTOM_TO_TOP : GTK.GTK_PROGRESS_LEFT_TO_RIGHT;
gtk_orientable_set_orientation (handle, orientation);
if ((style & SWT.INDETERMINATE) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
index d5ed689e13..e8d36881d7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
@@ -139,7 +139,13 @@ void createHandle (int index) {
handle = GTK.gtk_scale_new (GTK.GTK_ORIENTATION_VERTICAL, hAdjustment);
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
+
GTK.gtk_scale_set_digits (handle, 0);
GTK.gtk_scale_set_draw_value (handle, false);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
index af53197734..996aed2041 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
@@ -178,7 +178,12 @@ void createHandle (int index) {
if ((style & SWT.VERTICAL) != 0) {
GTK.gtk_widget_set_can_focus (handle, true);
}
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 3a4be5307f..5c21290f8a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -311,11 +311,15 @@ void createHandle (int index) {
if (adjustment == 0) error (SWT.ERROR_NO_HANDLES);
handle = GTK.gtk_spin_button_new (adjustment, climbRate, 0);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+
long boxHandle = GTK.gtk_widget_get_first_child(handle);
long textHandle = GTK.gtk_widget_get_first_child(boxHandle);
entryHandle = textHandle;
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
}
GTK.gtk_editable_set_editable (GTK.GTK4 ? entryHandle : handle, (style & SWT.READ_ONLY) == 0);
GTK.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index e8e62854f3..768b0c23d7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -256,7 +256,13 @@ void createHandle (int index) {
gtk_widget_set_has_surface_or_window (fixedHandle, true);
handle = GTK.gtk_notebook_new ();
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
+
GTK.gtk_notebook_set_show_tabs (handle, true);
GTK.gtk_notebook_set_scrollable (handle, true);
if ((style & SWT.BOTTOM) != 0) {
@@ -289,8 +295,15 @@ void createItem (TabItem item, int index) {
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
long imageHandle = GTK.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_container_add (boxHandle, labelHandle);
+
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(boxHandle, imageHandle);
+ GTK.gtk_box_append(boxHandle, labelHandle);
+ } else {
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_container_add (boxHandle, labelHandle);
+ }
+
long pageHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
if (pageHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, SWITCH_PAGE);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 7dc456c8bd..0734a7f6a1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -221,7 +221,13 @@ void createHandle (int index) {
handle = GTK.gtk_entry_new ();
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
+
GTK.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
/*
* We need to handle borders differently in GTK3.20+. GtkEntry without frame will have a blank background color.
@@ -252,8 +258,15 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
bufferHandle = GTK.gtk_text_view_get_buffer (handle);
if (bufferHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, scrolledHandle);
- GTK.gtk_container_add (scrolledHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, scrolledHandle);
+ GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ GTK.gtk_container_add (scrolledHandle, handle);
+ }
+
GTK.gtk_text_view_set_editable (handle, (style & SWT.READ_ONLY) == 0);
if ((style & SWT.WRAP) != 0) GTK.gtk_text_view_set_wrap_mode (handle, GTK.GTK_WRAP_WORD_CHAR);
int hsp = (style & SWT.H_SCROLL) != 0 ? GTK.GTK_POLICY_ALWAYS : GTK.GTK_POLICY_NEVER;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 75b73f609d..d2cfb170bc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -137,7 +137,12 @@ void createHandle (int index) {
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (fixedHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, handle);
+ }
/*
* Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called
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 c828997498..5a8fe0a2d7 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
@@ -810,8 +810,14 @@ void createHandle (int index) {
OS.g_object_ref (checkRenderer);
}
createColumn (null, 0);
- GTK.gtk_container_add (fixedHandle, scrolledHandle);
- GTK.gtk_container_add (scrolledHandle, handle);
+
+ if (GTK.GTK4) {
+ OS.swt_fixed_add(fixedHandle, scrolledHandle);
+ GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
+ } else {
+ GTK.gtk_container_add (fixedHandle, scrolledHandle);
+ GTK.gtk_container_add (scrolledHandle, handle);
+ }
int mode = (style & SWT.MULTI) != 0 ? GTK.GTK_SELECTION_MULTIPLE : GTK.GTK_SELECTION_BROWSE;
long selectionHandle = GTK.gtk_tree_view_get_selection (handle);
@@ -867,10 +873,20 @@ void createItem (TreeColumn column, int index) {
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
long imageHandle = GTK.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_container_add (boxHandle, labelHandle);
- GTK.gtk_widget_show (boxHandle);
- GTK.gtk_widget_show (labelHandle);
+
+ if (GTK.GTK4) {
+ GTK.gtk_box_append(boxHandle, imageHandle);
+ GTK.gtk_box_append(boxHandle, labelHandle);
+
+ GTK.gtk_widget_hide(imageHandle);
+ } else {
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_container_add (boxHandle, labelHandle);
+
+ GTK.gtk_widget_show (boxHandle);
+ GTK.gtk_widget_show (labelHandle);
+ }
+
column.labelHandle = labelHandle;
column.imageHandle = imageHandle;
GTK.gtk_tree_view_column_set_widget (column.handle, boxHandle);
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 1d044176e4..fb6a49c8f3 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
@@ -2056,7 +2056,6 @@ void gtk_box_set_child_packing (long box, long child, boolean expand, boolean fi
GTK.gtk_widget_set_valign(child, GTK.GTK_ALIGN_FILL);
}
GTK.gtk_box_set_child_packing(box, child, pack_type);
- OS.g_object_set(box, OS.margin, padding, 0);
} else {
GTK.gtk_box_set_child_packing(box, child, expand, fill, padding, pack_type);
}
@@ -2070,7 +2069,6 @@ void gtk_box_pack_end (long box, long child, boolean expand, boolean fill, int p
GTK.gtk_widget_set_halign(child, GTK.GTK_ALIGN_FILL);
GTK.gtk_widget_set_valign(child, GTK.GTK_ALIGN_FILL);
}
- OS.g_object_set(box, OS.margin, padding, 0);
GTK.gtk_box_append(box, child);
} else {
GTK.gtk_box_pack_end(box, child, expand, fill, padding);

Back to the top