Moving a shell from a high-dpi to a low-dpi monitor does not rescale the shell and its contents [message #1836430] |
Sun, 03 January 2021 22:23 |
Nicolas Falliere Messages: 3 Registered: March 2015 |
Junior Member |
|
|
Hello,
The problem manifests itself when moving a simple Shell from the high-dpi primary display to an external monitor (standard dpi). The Shell and its contents are not rescaled when on the secondary monitor. SWT.ZoomChanged is received as expected, but I do not know how to act on it, I am not seeing any method on Shell that seems to perform rescaling. Related to that: Eclipse does auto-rescale additional windows and shells! Is it done manually then? Is there sample code out there showing how to do this reliably and on all systems? (GTK, etc.)
Thanks,
(Also, I apologize if you have seen this on SO, it's a repost of https://stackoverflow.com/questions/65547072/moving-a-shell-from-a-high-dpi-to-a-low-dpi-monitor-does-not-rescale-the-shell-a, which it seems is not going anywhere - so I thought it'd be more appropriate here.)
Test system: Win 10
Sample code:
public class ShellTest {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell(display, SWT.SHELL_TRIM);
shell.setLayout(new GridLayout());
shell.addListener(SWT.ZoomChanged, new Listener() {
@Override
public void handleEvent(Event event) {
System.out.println("ZoomChanged: " + event);
}
});
Button btn = new Button(shell, SWT.PUSH);
btn.setText("Test");
shell.open();
shell.layout();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03156 seconds