Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486756

Summary: Focus Out leads to jump to top in ScrolledComposite (3.0.1 only)
Product: [RT] RAP Reporter: Markus Knauer <mknauer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/#/c/65457/
Whiteboard:
Attachments:
Description Flags
protocol log none

Description Markus Knauer CLA 2016-01-28 12:53:03 EST
I'd say we have a small regression in 3.0.1. The following snippet works fine in RAP 2.3, 3.0.0, and in 3.1.0 M4, but not with 3.0.1.

If you scroll down in the ScrolledComposite, select one of the Text widgets on the bottom with the mouse, eventually change some text, and *click with the mouse outside of any text widget*, then you are scrolled to the top of the composite. My guess is that this is a side-effect of fixing bug 471795.


public class ScrolledCompositeFocusOutJumpToTop extends AbstractEntryPoint {

    private ScrolledComposite composite;
    private Composite content;

    @Override
    protected void createContents(Composite parent) {
        composite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
        composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
        content = new Composite(composite, SWT.NONE);
        content.setLayout(new GridLayout(2, true));
        for (int ii = 0; ii < 200; ii++) {
            Text text = new Text(content, SWT.NONE);
            text.setText("Text Widget " + ii);
        }
        composite.setContent(content);
        composite.setExpandHorizontal(true);
        composite.setExpandVertical(true);
        composite.setAlwaysShowScrollBars(true);
        composite.setShowFocusedControl(true);
        composite.setMinSize(content.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        composite.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(ControlEvent e) {
                composite.setMinSize(content.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            }
        });
    }

}
Comment 1 Ivan Furnadjiev CLA 2016-01-29 03:19:34 EST
I will check if the issue exists in current 3.0-maintenance branch.
Comment 2 Ivan Furnadjiev CLA 2016-01-29 03:34:50 EST
OK... reproducible with current 3.0-maintenance branch.
Comment 3 Ivan Furnadjiev CLA 2016-01-29 03:49:14 EST
...but the same code exists in 3.1 M4... something on the client has changed in master as during the scrolling there is no server-side turn around.
Comment 4 Markus Knauer CLA 2016-01-29 04:32:26 EST
Created attachment 259444 [details]
protocol log

(In reply to Ivan Furnadjiev from comment #3)
> ...but the same code exists in 3.1 M4...

That was a little mystery to me, because my expectation was that it should be possible to reproduce the very same behaviour with 3.1 M4.

When I started to track down this issue, I looked into the protocol messages in a bigger application - the relevant part is attached to this bug report. There are some set operations on w1+w2 for activeControl and focusControl properties.
Comment 5 Ivan Furnadjiev CLA 2016-01-29 05:11:05 EST
Still don't know what is going on, but will try to fix it in 3.0-maintenance branch.
Comment 6 Ivan Furnadjiev CLA 2016-02-02 05:32:09 EST
Fixed in 3.0-maintenance branch with change https://git.eclipse.org/r/#/c/65457/