diff options
author | Sven Gothel <[email protected]> | 2020-01-15 08:02:18 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-01-15 08:02:18 +0100 |
commit | d671b2ab3badbcfdbe0ff57f55ff997ba7bcb060 (patch) | |
tree | 8a3bb1994d69cb3b58d84e8607b9ae17c05db612 /src/test/com/jogamp/opengl | |
parent | 9bcc384e66e40706225b86e9750c5822cb8f8c57 (diff) |
Bug 1422: Emulate DPI Scaling on non-native DPI autoscale platforms (!MacOS)
Bug 1422 shows that it seems to be desired to emulate DPI scaling where
the native toolkit does not implmement the same.
On GTK, DPIUtil.mapDPIToZoom (int dpi) reads:
double zoom = (double) dpi * 100 / 96;
int roundedZoom = (int) Math.round (zoom);
return roundedZoom;
While having dpi calculated as:
dpi = 96 * GDK.gdk_monitor_get_scale_factor(monitor);
Well, this seems to exist to allow 96 dpi fixed layout to
'look' OK on high-dpi screens.
However, you get in trouble if you layout high-dpi aware,
i.e. using percentages etc.
There is one exception: If DPIUtil.useCairoAutoScale() is true, scalingFactor is 1f
and hence the scaling emulation dropped.
'DPIUtil.setUseCairoAutoScale((sx[0]*100) == scaleFactor || OS.isGNOME);'
Diffstat (limited to 'src/test/com/jogamp/opengl')
4 files changed, 6 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java index a5bafd15d..86e0f9d9b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java @@ -184,6 +184,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { {
display = new Display();
Assert.assertNotNull( display );
+ SWTAccessor.printInfo(System.err, display);
shell = new Shell( display );
shell.setText( getSimpleTestName(".") );
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java index bf98a8e95..79dc71406 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java @@ -83,12 +83,11 @@ public class TestSWTAccessor01 extends UITestCase { } protected void init() throws InterruptedException, InvocationTargetException { - System.err.println("SWT Platform: "+SWT.getPlatform()+", Version "+SWT.getVersion()); - System.err.println("GTK_VERSION: "+SWTAccessor.GTK_VERSION()); SWTAccessor.invoke(true, new Runnable() { public void run() { display = new Display(); Assert.assertNotNull( display ); + SWTAccessor.printInfo(System.err, display); shell = new Shell( display ); Assert.assertNotNull( shell ); shell.setLayout( new GridLayout(3, false) ); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java index 787858175..b40eb3203 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java @@ -92,12 +92,11 @@ public class TestSWTAccessor02NewtGLWindow extends UITestCase { Composite composite = null; protected void init() throws InterruptedException, InvocationTargetException { - System.err.println("SWT Platform: "+SWT.getPlatform()+", Version "+SWT.getVersion()); - System.err.println("GTK_VERSION: "+SWTAccessor.GTK_VERSION()); SWTAccessor.invoke(true, new Runnable() { public void run() { display = new Display(); Assert.assertNotNull( display ); + SWTAccessor.printInfo(System.err, display); shell = new Shell( display ); Assert.assertNotNull( shell ); shell.setLayout( new GridLayout(3, false) ); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java index d3c4de885..732db5c51 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java @@ -55,6 +55,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.JunitTracer; import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.test.junit.jogl.demos.es1.OneTriangle; import com.jogamp.opengl.test.junit.util.MiscUtils; @@ -82,7 +83,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { // NSLocking issues on OSX and AWT, able to freeze whole test suite! // Since this test is merely a technical nature to validate the accessor w/ SWT // we can drop it w/o bothering. - UITestCase.setTestSupported(false); + JunitTracer.setTestSupported(false); return; } System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); @@ -107,6 +108,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { public void run() { display = new Display(); Assert.assertNotNull( display ); + SWTAccessor.printInfo(System.err, display); shell = new Shell( display ); Assert.assertNotNull( shell ); shell.setLayout( new FillLayout() ); |