Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 147418 - Control.getMonitor does not properly set client area
Summary: Control.getMonitor does not properly set client area
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.3 M2   Edit
Assignee: Kevin Barnes CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-16 05:21 EDT by Tom Hofmann CLA
Modified: 2006-09-12 13:23 EDT (History)
4 users (show)

See Also:


Attachments
Patch (1.19 KB, patch)
2006-08-03 11:30 EDT, Kevin Barnes CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2006-06-16 05:21:49 EDT
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().
Comment 1 Kevin Barnes CLA 2006-08-03 11:30:36 EDT
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();
	}
}
Comment 2 Kevin Barnes CLA 2006-08-24 11:29:58 EDT
fixed in HEAD > 20060824