[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Weird shell size on Windows
|
I'm using following tiny snippet to show a shell with a certain size on
my Windows 10 machine with 4K-monitor (200% zoom):
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class WindowSize {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event event) {
System.out.println(shell.getSize());
}
});
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
As it is printed on console, the size is equal to the one specified.
While debugging it is obvious that the file is scaled to double-size, so
actually Control.setBoundsInPixels() is invoked with 800x600 as
argument. So far, so understandable, but when I take a screenshot with
Alt+Print and paste it into a graphic application, e.g. IrfanView, the
size 778x589 is displayed. The same occurs if I use, e.g. GreenShot to
take the screenshot and view its size. This somehow makes me wonder
where the remaining 22x11 pixels have gone.
--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog