Closed Bug 33438 Opened 25 years ago Closed 7 years ago

Multiple monitors: JS GetWidth/GetHeight return incorrect values

Categories

(Core :: XUL, defect, P1)

PowerPC
All
defect

Tracking

()

RESOLVED INCOMPLETE
Future

People

(Reporter: guldgb, Unassigned)

References

()

Details

(Keywords: helpwanted, Whiteboard: [nsbeta3-])

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) BuildID: 200003240 It doesn't use the display manager to get the screen width, it uses the grey region. When it tries to position a window on the screen, it does it relative to the space that all monitors take up, rather than a single monitor. For example, a JavaScript that tries to calculate teh center of the screen will do so by getting the width and the height, and calculating the center. Under Netscape 4.x and IE, this will be a good calculation, resulting in a centered window on the parent window's screen. Under Mozilla, the window will be centered across the two screens. Also, this makes the default window position wrong. it appears on the second monitor rather than the main monitor. In my case, the second monitor's top doesn't align with the main monitor's top, so the title bar isn't even accesable on the second monitor (you can only see the bottom half of the window). Reproducible: Always Steps to Reproduce: 1. Run a dual monitor system. 2. Use Mozilla. Try using JavaScripts that get width and height; bad values will be returned. Also try opening preference dialogs and such, they get centered wrong. 3. Actual Results: Windows appear centered wrongly; JavaScript's don't get screen coordinates properly. A JavaScript that tries to make the browser window the full size of the screen would try and make a window that spans all visible screens. Expected Results: Mozilla should be placing windows on the main screen (or the screen of a parent window, as the case may be). Also, calculations for screen height and width should be based on the parent screen of a window, not the combined width/height of all screens (the grey region bounding box).
guldgb@hotmail.com - do recent Mozilla builds still have this problem? Gerv
Reporter sez: "Yes. I checked the nightly build (5/5/00). You'd have to set the window position based on the GDevice (graphics device) on the screen that you want to center it on. So if you want to center the window on the main screen (the screen with the global menu bar; typically what you want for dialogs and windows that are popping up for the first time), you get the GDevice record for the main screen (easy to do), check its bounds, and base the window position on that. Also, when opening with a window position saved from disk, you should check if the window position is still valid (within the current bounds). Mac OS 8.5 has a Window Manager function to let you do this easily. The thing is, the user may have disconnected or rearranged their second monitor since the last time they used Mozilla. If the user had a window on the second screen (screen coords -500, 50), and then they later start up mozilla with only 1 monitor (so -500,50 is now an offscreen coordinate), the window won't appear onscreen and the user won't see it or be able to access it. I haven't tried it, but if you're not checking that's likely what's going to happen. Check out the "Display Manager" and the GDevice stuff in Quickraw chapters of Inside Mac for thorough info. You can send future questions to sarwat@interlog.com for more prompt responses." Confirming. Gerv
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: It's using the grey region to get the width of the display, rather than the display manager → Multiple monitors: JS GetWidth/GetHeight return incorrect values
Don -- multimonitor support is yours, right?
Assignee: rickg → don
Reassigning as per Don
Assignee: don → saari
Component: Viewer App → XP Toolkit/Widgets
Thanks for the analysis, it makes fixing the bug easier! I'll try and get this into M16. Originally we didn't have a JS exposed API for iterating over multiple monitors, so we need this behavior to support multiple monitors at all. We now have that API so we can revert this to the correct behavior.
Status: NEW → ASSIGNED
Priority: P3 → P1
Target Milestone: --- → M16
Moving all bugs that are not dogfood+, nsbeta2+,features, or nsbeta2- to M21
Target Milestone: M16 → M21
Correct multiple monitor support is a must for beta3
Keywords: nsbeta3
nsbeta3-. Affects few users on few web sites, not worth the time/risk.
Keywords: helpwanted
Whiteboard: [nsbeta3-]
Target Milestone: M21 → Future
trudelle@netscape.com - I don't know if your last comment was automated, but it's inappropriate. This bug, as far as I can see, affects _all_ multiple-monitor users on all websites, in that the window positioning will be wrong. Could you have another look here? Gerv
My remarks are sometimes mechanical, but never automated ;-). Inappropriate? I don't see how, although perhaps the 'few web sites' was incorrect. Users of N6 on multiple monitor Macs are a tiny fraction of our userbase, we have very limited time, so are focussing on bugs that affect all or most users. For Mac, this means things like getting the MTBF above 30 minutes, or improving the dreadful perforamance. If we have time left, we can re-consider this bug. We would welcome a fix from anyone who has time to fix it now. qa->jrgm
QA Contact: rickg → jrgm
what is still broken here?
OS: All
nominating for dogfood (from sdagley's list of bugs that are good candidates for our next release)
Keywords: nsdogfood
Dogfood? Who is blocked from using the product because of this bug?
Keywords: nsCatFood
Keywords: nsdogfood
CC'ing danm because I believe he killed all of these issues by revamping a pile of code (yeay!)
Somebody with the hardware needs to verify. When last I left multiple monitor world, it was pretty well behaved. It generally thinks in terms of the one monitor the current window is on or mostly on, which should fix the problems described here. But I'm prepared to believe there are broken edge cases I didn't look for.
similar: bug 62395, bug 101103, bug 149608. Dups?
I just ran into this problem on 1.3 on a Mac (OS X), so the problem is still there, and is not (I believe) just limited to javascript commands. Here's a test case: Open Mozilla on a main monitor that is larger than the secondary monitor. Open: http://www.ece.cmu.edu/c3s/raid2003/authors.html Put this page on the smaller, secondary monitor. Click on "instructions" towards the top of the page. This will open a new window, but the window will be sized for the main monitor, even though it will appear on the secondary monitor. Note that the top and bottom of the window is cut off.
Blocks: multimon-win
Assignee: saari → jag
Status: ASSIGNED → NEW
Assignee: jag → nobody
Blocks: 435008
There is still a case where this is a problem. It seems if one checks the JS shortly after startup, they return the size of the first monitor even if Firefox ends up being restored on the 2nd one. After the window is restored, the correct values are returned.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.