eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
118 stars 137 forks source link

Distorted Buttons since 2022-03 #848

Closed jukzi closed 11 months ago

jukzi commented 1 year ago

This problem occurs when we are in the "light"theme, in "dark" theme it works fine. The problem is there since eclipse version 2022-03. So till 2021-12 it was working fine. The changes responsible for the problem is the because the api "wmColorChild" was overrriden in the "Button" class in order to fix the bugzilla bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=577042

Originally posted by @SudhindraKKulkarni in https://github.com/eclipse-pde/eclipse.pde/issues/727#issuecomment-1790272732

image

jukzi commented 1 year ago

@SudhindraKKulkarni as you have already analysed the problem, can you provide a fix, please?

SyntevoAlex commented 11 months ago

Reproducible with this snippet on my Win11:

final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout (new GridLayout (1, true));

Label label = new Label(shell, 0);
label.setText(
    "1. Run on Windows\n" +
    "2. Press Alt\n" +
    "3. Issue 848: Buttons disappear"
);

TabFolder tabFolder = new TabFolder(shell, 0);

Composite composite = new Composite(tabFolder, 0);
composite.setLayout(new GridLayout (1, true));

TabItem tabItem = new TabItem(tabFolder, 0);
tabItem.setControl(composite);
tabItem.setText("TabPage");

Button button1 = new Button(composite, SWT.PUSH);
button1.setText("&Button1");

Button button2 = new Button(composite, SWT.PUSH);
button2.setText("B&utton2");
button2.setEnabled(false);

shell.pack();
shell.open();

while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
        display.sleep();
    }
}

display.dispose();
SyntevoAlex commented 11 months ago

I plan to investigate and fix this within a week.

SyntevoAlex commented 11 months ago

The fix is available at https://github.com/eclipse-platform/eclipse.platform.swt/pull/911

SyntevoAlex commented 11 months ago

I think that there's no need to rush this fix into upcoming 4.30 release: