Re: SWT GLCanvas with DPI scaling in Eclipse
Posted by ChrisB on Jan 24, 2018; 9:16pm
URL: https://forum.jogamp.org/SWT-GLCanvas-with-DPI-scaling-in-Eclipse-tp4038566p4038572.html
Eclipse's GLCanvas hasn't been maintened since 2006, which is why we switched to the jogl GLCanvas. Not surprising it suffers the same issue. I also noticed the scaled mouse input once I added the workaround for the OpenGL part. I'm not sure if the eclipse developers had widgets like GLCanvas in mind when the DPI scaling was implemented. I suppose it allows developers to ignore the issue of DPI scaling while working only with SWT widgets. But for our application I'm afraid some rather tedious code changes are required to accommodate for this.
SWT_AUTOSCALE property would be the wrong one. It's the scaling passed to DPIUtil by VM-argument and maybe the operating system. Eclipse does some rounding as described on the page that I linked in my original post. From a quick look at the code there seems to be the propery "org.eclipse.swt.internal.deviceZoom" which holds the actual scale factor used by eclipse. I'm not at work right now so I can't check if this works.
Another option is calling org.eclipse.swt.widgets.Scrollable.getClientAreaInPixels () via reflection. Not a very nice solution either. In my opinion this is the method that the GLCanvas should use, but can't since it is private.
I'll file the bug report once I get my account. Thanks for the input.