-
Notifications
You must be signed in to change notification settings - Fork 192
Description
Describe the bug
The per-window-auto-scaling enabled in c35c568 broke the ScrolledComposite behavior (for displaying scrollbars only if needed) used for displaying dialogs in our applications.
To Reproduce
Snippet:
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class ScrolledCompositeTest {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
final FillLayout fillLayout = new FillLayout();
fillLayout.marginWidth = fillLayout.marginHeight = 20;
shell.setLayout(fillLayout);
final ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
final Label label = new Label(sc, SWT.WRAP);
label.setText("This is a longer line, but not very long.\nanother line");
sc.setContent(label);
final Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
sc.setMinSize(size);
sc.addListener(SWT.Resize, unused -> {
final Rectangle r = sc.getClientArea();
final Point size1 = label.computeSize(r.width, SWT.DEFAULT);
sc.setMinSize(size1);
});
shell.setSize(300, 100);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}Run it with SWT at commit 577b1d6 and you will get

You can resize the window and if it is to small to show the text, a vertical scrollbar will occur:

Now try with SWT at commit c35c568 or newer and you will get

You can resize the window and sometimes the horizontal scrollbar is shown, sometimes not.
Expected behavior
The ScrolledComposite should work as with commit 577b1d6 or earlier.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
-
Additional OS info (e.g. OS version, Linux Desktop, etc)
Windows 11 25H2 -
JRE/JDK version
Workaround (or) Additional context
No workarounds known.