Bug 37909 - [Workbench] Eclipse does not remember window positions on second display
Summary: [Workbench] Eclipse does not remember window positions on second display
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M2   Edit
Assignee: Simon Arsenault CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 38696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-21 06:27 EDT by Simon Tardell CLA
Modified: 2003-06-16 15:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Tardell CLA 2003-05-21 06:27:48 EDT
If you have multiple displays, and position an Eclipse window on the second 
display, the position will not be remembered when you restart Eclipse. All 
windows will appear on the primary display.

Note: If the second display *does not exist* when you restart, then it is, of 
course, desired behaviour.
Comment 1 Debbie Wilson CLA 2003-05-21 15:23:54 EDT
Simon, I'm not sure I understand your problem.  Are you running in an 
environment with dual terminals?  Which build are you using?
Comment 2 Simon Tardell CLA 2003-05-21 16:26:29 EDT
In Windows XP (and W2K for that matter) you can have multiple displays 
attached and having the desktop stretch over all of them (e.g I have the 
internal display of my laptop plus a monitor on the side giving me a desktop 
of 2800x1050). You can place Eclipse windows on the secondary displays, but if 
you do and quit and restart Eclipse, the window position will not be 
remembered for any window on a secondary display.

On the other hand, if you before you restart Eclipse detach the secondary 
display, you want all the windows to appear on the primary display (not 
outside the display).

I'm using Eclipse 2.1.
Comment 3 Debbie Wilson CLA 2003-05-29 11:40:53 EDT
Simon,
Can you tell me what your configuration is (with respect to the dual terminal 
stuff).  I am testing this on the following:
Windows XP Pro
2 Video cards (Not dual head)

Rage 128 PRO  (ATI Xpert 128)
Intel 82845G/GL Graphics Controller  (Onboard Video)
Comment 4 Simon Tardell CLA 2003-05-29 15:31:14 EDT
WXP Pro on a Dell Latitude C800 with an ATI Mobility M4 driving the builtin 
screen and an external monitor.
Comment 5 Christophe Cornu CLA 2003-05-30 17:09:18 EDT
Simon:
What happens when you:
- start Eclipse (if more than one window open, close the other ones - so that 
you only have one Eclipse window on your primary monitor)
- Menu Window > new Window. Move this second Eclipse window to your 2nd monitor
- Exit Eclipse (Menu File > Exit from the Eclipse window on the primary 
monitor)
- Restart Eclipse.

Do you get both Eclipse windows in the primary monitor or not?
Comment 6 Debbie Wilson CLA 2003-06-05 13:42:21 EDT
Simon, Have you been able to try out the things Christophe suggested?
Comment 7 Simon Tardell CLA 2003-06-06 10:06:59 EDT
Ah!

If the second window is maximized (before exiting) it will be restored to the 
primary screen. If it is not maximized it will be restored to the secondary 
screen.

Of course, maximizing the Eclipse windows seems pretty natural, so... 
Comment 8 Christophe Cornu CLA 2003-06-09 10:33:55 EDT
Simon: so is the problem restricted to maximized windows?

Debbie:
On Windows, a Shell is maximized into the monitor which contains most of this 
Shell. It looks as if Eclipse does not store the location of a maximized 
Shell - it just stores the 'maximized' state, which causes the OS to maximize 
it on the primary monitor. Can someone in the Eclipse UI team confirm this? If 
that's true, a fix would be to also store the position of a maximized Shell.
Comment 9 Simon Tardell CLA 2003-06-10 02:45:43 EDT
Yes.
Comment 10 Debbie Wilson CLA 2003-06-10 11:07:07 EDT
*** Bug 38696 has been marked as a duplicate of this bug. ***
Comment 11 Simon Arsenault CLA 2003-06-11 15:06:27 EDT
The workbench only remembers that the window was maximized on shutdown. It does 
not remember the location in that case.

I tried saving and restoring the bounds of the window when maximized and that 
fixed the problem reported. However, the bounds saved are the bounds of the 
shell in maximized state, not in normal state. So when you unmaximize after 
shutdown and startup cycle, the window still occupies the entire monitor screen.

There is no support in SWT to get the size of the shell in normal state when 
maximized/minimized. SWT suggested we listen for resize events and keep track 
of the window size ourself. We should ignore possible resize callbacks if the 
shell is maximized/minimized (some OS simply set the shell size to the monitor 
screen size when requested to maximize a shell).

We should also, when restoring windows, ensure that they intersect with the 
current virtual screen bounds (Display.getBounds()). Otherwise, if you run on a 
machine with dual monitors and a window in placed in the 2nd monitor, that 
location is saved. If you start that same workspace on another machine 
(workspace maybe on a network which you can access from different machines), 
that only has one monitor, the windows on the second monitor will not be 
visible. If a saved window's bound is outside the virtual screen bounds, it 
should be changed to be inside the bounds.

We should also consider what to do in the minimized case also. See bug 11509 
for more information.
Comment 12 Simon Arsenault CLA 2003-06-16 15:09:54 EDT
Fix workbench window to remember the shell's bounds in normal state and to 
restore these on startup. Also guards against a shell's bounds being outside 
the display's bounds (i.e would not be visible to the user).