Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Maximized shell size is bigger, than monitor resolution. Why?
Maximized shell size is bigger, than monitor resolution. Why? [message #543140] Mon, 28 June 2010 14:34 Go to next message
Marton Sigmond is currently offline Marton SigmondFriend
Messages: 73
Registered: July 2009
Location: Hungary
Member
Hi,

1) run the following code:
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Shell");
shell.setSize(200, 200);
shell.setLayout(new FillLayout());
final Button bt = new Button(shell, SWT.PUSH);
bt.setText("Push");
bt.addSelectionListener(new SelectionAdapter() {
	@Override
	public void widgetSelected(SelectionEvent arg0) {
		shell.setFullScreen(!shell.getFullScreen());
	}
});
shell.addControlListener(new ControlAdapter() {
	@Override
	public void controlResized(final ControlEvent event) {
		System.err.println("shell size = " + shell.getSize());
	}
});
shell.open();
while (!shell.isDisposed()) {
	if (!display.readAndDispatch())
		display.sleep();
}
display.dispose();
2) Push the 'Push' button
3) Push the 'Push' button again
4) Push the maximize button on shell frame
5) Push the restore button on the shell frame

This is what I got on Linux with 1600x1200 resolution:
 shell size = Point {200, 200}
 shell size = Point {1600, 1200}
 shell size = Point {196, 203}
 shell size = Point {1601, 1182}
 shell size = Point {196, 203}
and on Windows XP with 1280x1024 resolution:
 shell size = Point {200, 200}
 shell size = Point {200, 200}
 shell size = Point {1286, 1030}
 shell size = Point {200, 200}
 shell size = Point {1288, 972}
 shell size = Point {200, 200}


As you can see the size of the shell exceeds the resolution of the monitor.
How is this possible?

Thanks,
Marton
Antw: Maximized shell size is bigger, than monitor resolution. Why? [message #543346 is a reply to message #543140] Tue, 29 June 2010 07:51 Go to previous message
Eclipse UserFriend
Originally posted by: Ludger.Heisterkamp.gds.eu

Strange behaviour... I can reproduce it exactly on my XP with different SWT
versions.
The getSize() method is working correctly as I could verify it with an
external tool.
I changed getSize() to getBounds() and got his result:
shell bounds = Rectangle {22, 22, 200, 200}
shell bounds = Rectangle {-3, -3, 1286, 1030}
shell bounds = Rectangle {22, 22, 200, 200}
shell bounds = Rectangle {-4, -4, 1288, 979}
shell bounds = Rectangle {22, 22, 200, 200}
It seems that the borders of maximized windows are part of the size and
bounds calculation although they are not visible.

Regards,
Ludger


>>> Marton Sigmond<marton_sigmond@yahoo.com> schrieb am Montag, 28. Juni
2010
um 16:34:
> Hi,
>
> 1) run the following code:
> final Display display = new Display();
> final Shell shell = new Shell(display);
> shell.setText("Shell");
> shell.setSize(200, 200);
> shell.setLayout(new FillLayout());
> final Button bt = new Button(shell, SWT.PUSH);
> bt.setText("Push");
> bt.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent arg0) {
> shell.setFullScreen(!shell.getFullScreen());
> }
> });
> shell.addControlListener(new ControlAdapter() {
> @Override
> public void controlResized(final ControlEvent event) {
> System.err.println("shell size = " + shell.getSize());
> }
> });
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();2) Push the 'Push' button
> 3) Push the 'Push' button again
> 4) Push the maximize button on shell frame
> 5) Push the restore button on the shell frame
>
> This is what I got on Linux with 1600x1200 resolution:
> shell size = Point {200, 200}
> shell size = Point {1600, 1200}
> shell size = Point {196, 203}
> shell size = Point {1601, 1182}
> shell size = Point {196, 203}and on Windows XP with 1280x1024
> resolution:
> shell size = Point {200, 200}
> shell size = Point {200, 200}
> shell size = Point {1286, 1030}
> shell size = Point {200, 200}
> shell size = Point {1288, 972}
> shell size = Point {200, 200}
>
> As you can see the size of the shell exceeds the resolution of the
> monitor.
> How is this possible?
>
> Thanks,
> Marton
Previous Topic:flickering virtual table rows
Next Topic:TitleAreaDialog not correctly displaying long error messages
Goto Forum:
  


Current Time: Wed Apr 24 16:11:06 GMT 2024

Powered by FUDForum. Page generated in 0.03291 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top