Bug 567215 - [GTK4] Port SWT Combo
While working on a fix for SWT Snippet 26, the issue was found in
adjustChildClipping as it applied some logic on READ ONLY Combos. The
bug is that when an item is selected, the widget disappears until a
resize of the window. There are a couple issues:
1) the gtk_cell_view_set_fit_model function appears to not be doing what
its supposed to. This can be seen as the combo resizes based on the
length of the item string. This function should allow for the CellView
to be smaller than the max size.
2) The combo does not conform to setBounds, thus this could be
interfering with set fit model, but to test this the setBounds issue
needs to be fixed.
For now, the fix in this patch will allow snippet 26 to run without it
disappearing when an item is selected, but it currently does not behave
like it does in GTK3. I have made a comment to revisit this issue once
other bugs are fixed.
Change-Id: I0e4d771028e53b5f89fa869a191a01f7f9d7112a
Signed-off-by: jmajano <jmajano@redhat.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182657
Tested-by: Platform Bot <platform-bot@eclipse.org>
Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
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 85a30ea..8e1c5b4 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
@@ -1595,6 +1595,17 @@
*/
if (widget == cellHandle && (style & SWT.READ_ONLY) != 0 && !unselected) {
/*
+ * Currently in GTK4, when a new combo is created it does not follow setBounds.
+ * This could be the reason gtk_cell_view_set_fit_model does not work like in GTK3.
+ * This bug will need to be revisited once setBounds is working again.
+ * See bug 567215
+ */
+ if(GTK.GTK4) {
+ super.adjustChildClipping(widget);
+ return;
+ }
+
+ /*
* Set "fit-model" mode for READ_ONLY Combos on GTK3.20+ to false.
* This means the GtkCellView rendering the text can be set to
* a size other than the maximum. See bug 539367.