Community
Participate
Working Groups
3.2 RC7 See also bug 33659. Display.getMonitors() works as expected; it returns monitors with the size of the screen and a client area that is smaller (as the client area does not include the panels). However, the monitor returned by Control.getMonitor() is flawed: its client area is made the same as its bounds. Control.getMonitor should include the same code as Display.getMonitors().
Created attachment 47332 [details] Patch Display.getMonitors() gets the available work area for monitor[0] and control.getMonitor() does not. Patch makes the behaviour of both methods consistent. Simple test case: public class Bug_147418 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 150); shell.setLayout(new GridLayout(1, false)); Label label = new Label(shell, SWT.NONE); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setText("Label"); shell.open(); Rectangle clientArea = label.getMonitor().getClientArea(); System.out.println(clientArea); Monitor[] monitors = display.getMonitors(); for (int i = 0; i < monitors.length; i++) { System.out.println(monitors[i].getClientArea()); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
fixed in HEAD > 20060824