Skip to content

Commit 85d4b6f

Browse files
committed
Correct Cairo autoscaling setting in DPIUtil and remove setter #2031
Cairo auto-scaling was enabled in DPIUtil for every OS in a recent commit. This corrects the setting to be only applied on Linux/GTK and thus also issues arising from it. In addition, it removes the unnecessary setter for the auto-scaling and disables the tests that previously required it as they are meaningless without productive use of disabled Cairo auto-scale on Linux anyway. Fixes #2031
1 parent 111b874 commit 85d4b6f

File tree

2 files changed

+3
-7
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal
  • tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit

2 files changed

+3
-7
lines changed

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private static enum AutoScaleMethod { AUTO, NEAREST, SMOOTH }
4747
private static AutoScaleMethod autoScaleMethod = AutoScaleMethod.NEAREST;
4848

4949
private static String autoScaleValue;
50-
private static boolean useCairoAutoScale = true;
50+
private static final boolean useCairoAutoScale = Platform.PLATFORM.equals("gtk");
5151

5252
/**
5353
* System property that controls the autoScale functionality.
@@ -631,10 +631,6 @@ private static boolean sholdUseSmoothScaling() {
631631
};
632632
}
633633

634-
public static void setUseCairoAutoScale (boolean cairoAutoScale) {
635-
useCairoAutoScale = cairoAutoScale;
636-
}
637-
638634
public static int getZoomForAutoscaleProperty (int nativeDeviceZoom) {
639635
return getZoomForAutoscaleProperty(nativeDeviceZoom, autoScaleValue);
640636
}

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/DPIUtilTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static org.junit.Assert.assertArrayEquals;
1717
import static org.junit.Assert.assertEquals;
1818
import static org.junit.Assert.assertSame;
19+
import static org.junit.Assume.assumeFalse;
1920

2021
import org.eclipse.swt.graphics.Device;
2122
import org.eclipse.swt.graphics.Point;
@@ -37,14 +38,13 @@ public class DPIUtilTests {
3738

3839
@Before
3940
public void setup() {
41+
assumeFalse("Linux uses Cairo auto scaling, thus DPIUtil scaling is disabled", SwtTestUtil.isLinux);
4042
deviceZoom = DPIUtil.getDeviceZoom();
4143
DPIUtil.setDeviceZoom(200);
42-
DPIUtil.setUseCairoAutoScale(false);
4344
}
4445

4546
@After
4647
public void tearDown() {
47-
DPIUtil.setUseCairoAutoScale(true);
4848
DPIUtil.setDeviceZoom(deviceZoom);
4949
}
5050

0 commit comments

Comments
 (0)