Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Moving a shell from a high-dpi to a low-dpi monitor does not rescale the shell and its contents
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 is currently offline Nicolas FalliereFriend
Messages: 3
Registered: March 2015
Junior Member

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.)

(Also, I apologize if you have seen this on SO, it's a repost of, 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() {
        public void handleEvent(Event event) {
            System.out.println("ZoomChanged: " + event);

    Button btn = new Button(shell, SWT.PUSH);
    while(!shell.isDisposed()) {
        if(!display.readAndDispatch()) {
Previous Topic:MavenCentral SWT for Windows x86_64-3.115.100 missing jar file
Next Topic:Glimmer Canvas Shape DSL & Animation DSL for SWT
Goto Forum:

Current Time: Thu Apr 22 04:12:16 GMT 2021

Powered by FUDForum. Page generated in 0.01868 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top