Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-01-25 12:18:08 -0500
committerEric Williams2019-01-28 12:26:23 -0500
commit4665a93467ac895b9727b19b38b28f2a6555ffc9 (patch)
treee8c4b9fe4d0fa85472b0b71fd294e8085f6861a9
parent88a39221fa0872cb499e4ee5cf8ea1db4e60c1df (diff)
downloadeclipse.platform.swt-4665a93467ac895b9727b19b38b28f2a6555ffc9.tar.gz
eclipse.platform.swt-4665a93467ac895b9727b19b38b28f2a6555ffc9.tar.xz
eclipse.platform.swt-4665a93467ac895b9727b19b38b28f2a6555ffc9.zip
Bug 543276: [GTK4] Adapt to new GtkBox API and box related removals
Fix up Label to use a regular GtkBox and not GtkEventBox on GTK4. Change-Id: I186e2c080c7d836fa9a14a54716dd3b90cebd75e Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java27
1 files changed, 19 insertions, 8 deletions
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 747e079037..4b8a33e663 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
@@ -245,19 +245,30 @@ void createHandle (int index) {
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
} else {
- handle = GTK.gtk_event_box_new();
+ if (GTK.GTK4) {
+ handle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
+ } else {
+ handle = GTK.gtk_event_box_new();
+ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ }
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
labelHandle = GTK.gtk_label_new_with_mnemonic (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 (handle, boxHandle);
- GTK.gtk_container_add (boxHandle, labelHandle);
- GTK.gtk_container_add (boxHandle, imageHandle);
- gtk_box_set_child_packing(boxHandle, labelHandle, true, true, 0, GTK.GTK_PACK_START);
- gtk_box_set_child_packing(boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START);
+ if (GTK.GTK4) {
+ GTK.gtk_container_add (handle, labelHandle);
+ GTK.gtk_container_add (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 {
+ GTK.gtk_container_add (handle, boxHandle);
+ GTK.gtk_container_add (boxHandle, labelHandle);
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ gtk_box_set_child_packing(boxHandle, labelHandle, true, true, 0, GTK.GTK_PACK_START);
+ gtk_box_set_child_packing(boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START);
+ }
}
if ((style & SWT.BORDER) != 0) {
frameHandle = GTK.gtk_frame_new (null);

Back to the top