-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
HiDPIIssues related to High resolution monitorsIssues related to High resolution monitorsWindowsHappens on Windows OSHappens on Windows OS
Description
I'm using a monitor with 150% zoom. Now consider the following snippet:
package test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Snippet {
public static void main(String[] args) {
System.setProperty("swt.autoScale", "200");
Cursor cursor = new Cursor(null, getImageData(100), 0, 0);
Shell shell = new Shell(SWT.NO_TRIM);
shell.setSize(100, 100);
shell.setCursor(cursor);
shell.setBackground(new Color(0, 255, 0));
shell.open();
Display display = shell.getDisplay();
while (!display.isDisposed()){
display.readAndDispatch();
}
cursor.dispose();
}
private static ImageData getImageData(int zoom) {
Image image = new Image(null, 50, 50);
try {
GC gc = new GC(image);
gc.setBackground(new Color(255, 0, 0));
gc.fillRectangle(0, 0, 50, 50);
return image.getImageData(zoom);
} finally {
image.dispose();
}
}
}Expectation: The cursor should always take up 25% of the shell.
SWT 3.128.0 (2024-12), exactly right:

SWT 3.129.0 (2025-03), way too big:

Metadata
Metadata
Assignees
Labels
HiDPIIssues related to High resolution monitorsIssues related to High resolution monitorsWindowsHappens on Windows OSHappens on Windows OS

