-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
Linux Mint (X11) and Ubuntu (Wayland) latest versions
Hi-res display (200% scaling)
Latest SWT I-builds
A common color chooser widget is a Button with an image consisting of a color block denoting the current color. Our RCP app uses such a color chooser. However, a combination of the following leads to a bad result:
- Linux
- 200% display scaling
- ImageGcDrawer
- Button disabled
Run the snippet below and comment out the line button.setEnabled(false);. It should look like this:
Now add the line back to disable the button. It looks like this:
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageGcDrawer;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class LinuxButtonImageDrawer {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Linux Button Image");
shell.setLayout(new GridLayout());
shell.setSize(450, 250);
Button button = new Button(shell, SWT.FLAT);
ImageGcDrawer gcDrawer = (gc, width, height) -> {
gc.setBackground(new Color(255, 200, 255));
gc.fillRectangle(0, 0, width - 1, height - 1);
gc.drawRectangle(0, 0, width - 1, height - 1);
};
Image image = new Image(display, gcDrawer, 40, 15);
button.setImage(image);
// Setting this to false causes the problem
button.setEnabled(false);
shell.open();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}The following example in Eclipse's preferences might be related:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels