Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358627 - e4 problems with dual monitors
Summary: e4 problems with dual monitors
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.2 M3   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 359047 361844 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-22 12:55 EDT by Chris Goldthorpe CLA
Modified: 2011-12-06 17:04 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Goldthorpe CLA 2011-09-22 12:55:47 EDT
Eclipse 4.2 build I20110916-0200

On Win 7 set your PC to use dual monitors
Launch Eclipse 4.2M2
Drag Eclipse to screen 2
Exit Eclipse
Disconnect monitor 2
Start Eclipse

Expected result - Eclipse is launched in the visible screen area
Actual result   - Eclipse is launched off screen

Note that Eclipse 3.8M2 handles this situation correctly

I've marked this as major because it is a bad usability problem. If I have a second monitor attached to a laptop at work, move Eclipse to the second monitor then take that laptop to a location where there is no second monitor there does not seem to be any obvious and easy way to access that Eclipse workspace.
Comment 1 Eric Moffatt CLA 2011-09-22 20:44:38 EDT
Thanks Chris, on 3.8 where does eclipse show up when you re-dock and have the second monitor again (I don't have a dual monitor setup handy) ?
Comment 2 Chris Goldthorpe CLA 2011-09-23 12:27:14 EDT
(In reply to comment #1)

On 3.8 if Eclipse was closed from screen 2 and I restart in single monitor mode Eclipse is painted at the top left corner of the screen, with the same dimensions as when it was closed.
Comment 3 Eric Moffatt CLA 2011-09-23 15:44:33 EDT
Sorry, I was asking if you then close it, re-dock and restart does it move back to the second monitor?

I suspect you're seeing a fix I made that simply forces the shell into the available display area once it's been rendered. This is simple enough to do for e4, I just want to make sure that it's a one way street in 3.8.
Comment 4 Chris Goldthorpe CLA 2011-09-23 17:03:45 EDT
(In reply to comment #3)

Using Eclipse 3.8 here's the sequence 

With dual monitors open Eclipse and move to screen 2
Close Eclipse
Disconnect monitor 2.
Launch Eclipse - it opens in screen 1
Close Eclipse
Reconnect monitor 2
Launch Eclipse - it opens in screen 1 again
Comment 5 Eric Moffatt CLA 2011-09-26 16:30:27 EDT
kk, that's what I thought. I'll fix this tomorrow...
Comment 6 Remy Suen CLA 2011-09-27 08:22:35 EDT
*** Bug 359047 has been marked as a duplicate of this bug. ***
Comment 7 Dean Roberts CLA 2011-09-27 08:35:47 EDT
I ran into this today.  I do have dual monitors, but I've never been completly hosted before as I typically leave Eclipse running when I undock.  I also usually run multiple windows so my chances of having at least one window in the correct monitor is greater.  Still annoying ... but not as completely unrecoverable.

Another two pieces of information that are possibly interesting.

1) If you have E4 open in the 2nd windows while disconnecting the 2nd monitor,
the correct thing happens.  The window is repositioned on the 1st monitor.

2) The splash screen always opens on the primary monitor regardless of how many
monitors are attached or which monitor the window was open in when it was
saved.  I wonder if this is actually a bug?  Should the splash screen open in
the primary monitor, or the monitor where the window was last saved (assuming
it is currently attached)

Maybe I should look at this after I finish the capabilities work as I do have multiple monitors at work?
Comment 8 Eric Moffatt CLA 2011-09-27 11:32:08 EDT
Pushed in >20110927.

commit 9c05c8f6038a87fe04c81120c80f7892bb36684c

I took the code from 3.8 and put it into the WBWRenderer. Note that this will prevent anybody from creating a shell 'off screen'. If necessary we could add a 'NO_FORCE' tag to override this behavior.

I tested it by creating a WBW and moving it to the far right of my monitor (at 1600 x 1200) closing it and then changing my resolution to 1280 x 1024 before restarting. It now gets pushed to the top/left if it would otherwise be off the screen.

Dean, I'll likely need you to 'verify' this once it gets into a build...
Comment 9 Chris Goldthorpe CLA 2011-10-11 12:08:40 EDT
I just tested using I20111004-2000 and it now always launches Eclipse in the visible area so I am setting the state to VERIFIED.
Comment 10 Eric Moffatt CLA 2011-10-12 13:07:59 EDT
Thanks Chris !
Comment 11 Brian de Alwis CLA 2011-11-01 10:51:07 EDT
Unfortunately my patch for bug 350226 may revert this fix should the second monitor have negative coordinates.
Comment 12 Dean Roberts CLA 2011-11-01 11:42:53 EDT
Is the negative co-ordinates case the one where Monitor 2 is on the left, and monitor 1 is on the right?
Comment 13 Chris Goldthorpe CLA 2011-11-01 12:40:08 EDT
You should also test the case where monitor 1 is on the bottom and monitor two on top, which is what I use with my laptop as monitor 1 and an external monitor as monitor 2.
Comment 14 Brian de Alwis CLA 2011-11-03 08:32:18 EDT
(Dean, in reply to comment #12)
> Is the negative co-ordinates case the one where Monitor 2 is on the left, and
> monitor 1 is on the right?

Or Monitor 2 is above Monitor 1

(In reply to comment #13)
> You should also test the case where monitor 1 is on the bottom and monitor two
> on top, which is what I use with my laptop as monitor 1 and an external monitor
> as monitor 2.

That's my normal configuration when working at home.

So the problem comes down to choosing a sentinel value to act as a standin for an "unspecified" value.  I used "-1", and wondering if I should instead use Integer.MIN_VALUE (-2 ^ 31 or -2147483648).  I think that should be safe — I've seen some CSS tricks for hiding elements using positions of '-9000' or '-100%' which shouldn't come close, even with very high  DPI and very wide or tall displays.
Comment 16 Dean Roberts CLA 2011-11-24 08:49:38 EST
*** Bug 361844 has been marked as a duplicate of this bug. ***
Comment 17 Brian de Alwis CLA 2011-12-06 17:04:02 EST
Verified for M4