Issue
I want to get dimensions and zoom of all monitors. Code:
package root.viewer.rcp.util;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.ui.PlatformUI;
public class ApplicationMonitorsManager
{
public Monitor[] monitors;
//public Display display = new Display();
public ApplicationMonitorsManager()
{
}
public Monitor[] getMonitors()
{
//Display display = Display.getCurrent();
Display display = PlatformUI.createDisplay();
monitors = display.getMonitors();
return monitors;
}
}
Values for primary monitor are correct:
clientHeight 2070
clientWidth 3840
clientX 0
clientY 0
handle 200823
height 2160
width 3840
x 0
y 0
zoom 225
The second monitor has the same resolution, but zoom is 125%. Values I get:
clientHeight 3798
clientWidth 6912
clientX 6912
clientY 0
handle 200517
height 3888
width 6912
x 6912
y 0
zoom 225
Any idea what is wrong, please?
Does not matter if I try Display display = Display.getCurrent() or Display display = PlatformUI.createDisplay(). For Display display = new Display() application crashes with SWTException: Invalid thread access.
Solution
SWT does not yet support different zoom values:
Answered By - howlger
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.