Class PixelScaleSupportSWT

java.lang.Object
panamagl.canvas.swt.PixelScaleSupportSWT

public class PixelScaleSupportSWT extends Object
HiDPI plumbing for GLCanvasSWT.

Reads the pixel scale platform by platform:

  • cocoa: MacOSBackingScaleFactor.read(org.eclipse.swt.widgets.Control), because SWT's Monitor.getZoom() returns 100 on Retina;
  • gtk / win32: canvas.getMonitor().getZoom() / 100.0.

Wires SWT.ZoomChanged on the display (available since SWT 4.24 / 3.122 — confirmed in 3.126.0). On macOS, additionally listens to SWT.Move on the canvas because cocoa does not fire ZoomChanged when the window is moved between Retina and non-Retina monitors.