Bug 23291 - [Dialogs] jface.Dialog.contrainShellSize() not working correctly for multiple workspaces
Summary: [Dialogs] jface.Dialog.contrainShellSize() not working correctly for multiple...
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0.1   Edit
Hardware: Other All
: P2 normal (vote)
Target Milestone: 2.0.2   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-06 16:25 EDT by Chris McKillop CLA
Modified: 2005-05-10 14:54 EDT (History)
0 users

See Also:


Attachments
This fixeds some problems with Dialog.constrainShellSize(). (1.38 KB, patch)
2002-09-06 16:27 EDT, Chris McKillop CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris McKillop CLA 2002-09-06 16:25:10 EDT
When used in an environment where the top-left corner of the display's device
boundries are not (0,0), this member function does not act properly and forces
properly centered dialogs to be lined up against the edge of the screen
(weighted towards the (0,0) desktop.

This should effect all windowing systems where there are virtual desktops with
changing physical locations.  This proplem was found under QNX/Photon.
Comment 1 Chris McKillop CLA 2002-09-06 16:27:49 EDT
Created attachment 1947 [details]
This fixeds some problems with Dialog.constrainShellSize().
Comment 2 Chris McKillop CLA 2002-09-06 16:28:14 EDT
Added a patch attachment to fix the problem.
Comment 3 Tod Creasey CLA 2002-09-09 12:34:14 EDT
This code fails for the case where 0,0 is the source so needs more analysis.

If you follow these steps on Windows

1) Open the preference dialog
2) Move it so that the bottom right is at the bottom of the display
3) Select the Compare page
4) The dialog will resize. Using the current code it will resize to make the 
entire dialog visible but with the suggested patch it will not at all.

Reducing to priority 3 as this is only an issue for multiple displays.
Comment 4 Chris McKillop CLA 2002-09-09 14:05:41 EDT
I changed the priority back since, for Photon, this is a very critical bug as 
it renders the Eclipse UI nearly unusable.  I will update the patch today to 
take into account the RHS side of the screen - in my tests before I wasn't 
getting any new contrainShellSize()'s in the preferences dialogs (as only some 
pages seem to cause it to be invoked) and assumed it only occured when opening 
the dialog the first time.  My mistake.



Comment 5 Tod Creasey CLA 2002-09-09 14:07:24 EDT
Chris

Could you please give some detailed steps for replication of this problem on 
Photon? I want to be able to see the issue myself when I test the patch.
Comment 6 Chris McKillop CLA 2002-09-09 14:10:58 EDT
Very simple.  Use Ctrl-Alt-[2..9] to move to a console other then the first 
console.  Start eclipse there and open the preferences dialog.  It will 
be "whipped" over to the screen edges that are closest to Console 1.  So on 
Console 5 it will be moved into the upper left-hand corner of the screen.

Comment 7 Tod Creasey CLA 2002-09-09 14:44:44 EDT
Replicated. Thanks for the steps.
Comment 8 Tod Creasey CLA 2002-09-09 15:11:08 EDT
I think the only different code required is to handle the case we already do - 
x between the bounds source and the width.

This code should be tried on QNX

int x = loc.x;
	int y = loc.y;
	
	if( x > bounds.x + bounds.width )
		x = bounds.x + bounds.width - size.x;
	else{
		if( x < bounds.x )
			x = bounds.x;
		else //Somewhere between bounds.x and bounds.width
			x = Math.max(bounds.x, Math.min(loc.x, bounds.width - 
size.x));
	}
	
	if( y > bounds.y + bounds.height )
		y = bounds.y + bounds.height - size.y;
	else{
		if( y < bounds.y )
			y = bounds.y;
		else //Somewhere between bounds.y and bounds.height
			 y = Math.max(bounds.y, Math.min(loc.y, bounds.height -
 size.y));
	}		 
Comment 9 Tod Creasey CLA 2002-09-10 10:45:15 EDT
Previous solution was too complex.

Changed the code to read

//the bottom right hand corner
	int x = Math.max(bounds.x, Math.min(loc.x, bounds.x + bounds.width - 
size.x));
	int y = Math.max(bounds.y, Math.min(loc.y, bounds.y + bounds.height - 
size.y));

Now the bounds x is taken into account for calculating the bottom rightmost 
possible position. 

Now when working in a multi desktop environment like Photon an expaned dialog 
will go to the top left or bottom right of the current desktop as appropriate.

Fixed in build >20020910.
Comment 10 Tod Creasey CLA 2005-05-10 14:54:14 EDT
Marking as closed.