From 7b0cb58a2aedcac5c0973ddf0a9b4ab467c9e875 Mon Sep 17 00:00:00 2001 From: Eric Williams Date: Wed, 7 Mar 2018 14:25:32 -0500 Subject: Bug 500703: [GTK3.20+] Combo with SWT.READ_ONLY is garbled upon re-size In GTK3.20+ two things inside GTK3 changed. First, certain widgets have their clips unioned with the clips of their parent widget. This can cause overdrawing in widgets like Combo. Second, the internal widget hierarchy of Combo changed, and most of the resizing is done by a GtkBox instead of GtkComboBox itself. These two changes combined caused this bug. The overdrawing causes the Combo to draw over its neighbouring widgets (like a label). The resize issue means that resizing the widget doesn't cause it get smaller: the x coordinates of the allocation and clip just become negative and the whole widget shifts to the left. The fix is to adjust the clip and allocation of the Combo and its children from the parent Composite's draw handler. This ensures that the Combo is drawn with correct coordinates and that it actually shrinks when resized, instead of just shifting. Tested on GTK3.22, X11 and Wayland. Window -> Preferences -> General -> Keys behaves as expected, and no AllNonBrowser JUnit tests fail. Change-Id: Ic603acfda924b0ca36b4f0ba07048f6762c99270 Signed-off-by: Eric Williams --- .../swt/tests/gtk/snippets/Bug500703_ComboGarbledResize.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug500703_ComboGarbledResize.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug500703_ComboGarbledResize.java index 6c373985c0..f664bc2a5d 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug500703_ComboGarbledResize.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug500703_ComboGarbledResize.java @@ -43,8 +43,15 @@ public class Bug500703_ComboGarbledResize { Combo text = new Combo(shell, SWT.READ_ONLY); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); text.add("This is a very long long long long long box"); + text.add("short"); + + // Uncomment to test different selections +// text.select(0); +// text.select(1); shell.pack(); + // Uncomment for setBounds testing +// shell.setSize(400, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) -- cgit v1.2.3