Closed
Bug 1005619
Opened 11 years ago
Closed 11 years ago
[windows] Using dual monitors, Firefox/Thunderbird opens in wrong monitor
Categories
(Core :: Widget: Win32, defect)
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: sawrubh, Assigned: emk)
References
Details
Attachments
(3 files, 4 obsolete files)
3.88 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
3.27 KB,
patch
|
jimm
:
review+
|
Details | Diff | Splinter Review |
4.18 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
This is the bug for tracking the Linux specific fix for bug 264030.
Some additional comments from https://bugzilla.mozilla.org/show_bug.cgi?id=264030#c51 :
I have the opposite problem: Firefox always opens on my right-most (primary) monitor, even though I always close it (maximized) on my secondary (left-most) monitor.
Multi-monitor application bugs are one of my pet peeves, partially because Windows has two functions (GetWindowPlacement/SetWindowPlacement) that will do it correctly for you (and handles all the corner cases). Don't try to reinvent the wheel, you'll most likely screw it up. If you're not using GetWindowPlacement/SetWindowPlacement (which apparently Firefox isn't), then you've probably (in this case, definitely) overlooked something.
Reporter | ||
Comment 1•11 years ago
|
||
(In reply to Saurabh Anand [:sawrubh] from comment #0)
> This is the bug for tracking the Linux specific fix for bug 264030.
>
Sorry I meant 'bug for tracking the Windows specific fix'.
> Some additional comments from
> https://bugzilla.mozilla.org/show_bug.cgi?id=264030#c51 :
>
> I have the opposite problem: Firefox always opens on my right-most (primary)
> monitor, even though I always close it (maximized) on my secondary
> (left-most) monitor.
>
> Multi-monitor application bugs are one of my pet peeves, partially because
> Windows has two functions (GetWindowPlacement/SetWindowPlacement) that will
> do it correctly for you (and handles all the corner cases). Don't try to
> reinvent the wheel, you'll most likely screw it up. If you're not using
> GetWindowPlacement/SetWindowPlacement (which apparently Firefox isn't), then
> you've probably (in this case, definitely) overlooked something.
Updated•11 years ago
|
Summary: Windows tracking bug for 264030 → Windows tracking bug for 264030 - Using dual monitors, Firefox/Thunderbird opens in wrong monitor
Updated•11 years ago
|
Summary: Windows tracking bug for 264030 - Using dual monitors, Firefox/Thunderbird opens in wrong monitor → [windows] Using dual monitors, Firefox/Thunderbird opens in wrong monitor
Comment 2•11 years ago
|
||
Note: For anyone working on this bug, the Mac OS X patch in bug 1005620 might be a useful starting point or reference.
Assignee | ||
Comment 3•11 years ago
|
||
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #8420493 -
Flags: review?(jmathies)
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8420494 -
Flags: review?(neil)
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8420495 -
Flags: review?(jmathies)
Assignee | ||
Comment 7•11 years ago
|
||
For anyone interested in this bug: a test build is available here.
https://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/VYV03354@nifty.ne.jp-fdb7378d1518/try-win32/
Comment 8•11 years ago
|
||
Comment on attachment 8420493 [details] [diff] [review]
Part 1: Add nsIWidget::GetRestoredBounds()
>+NS_METHOD nsBaseWidget::GetRestoredBounds(nsIntRect &aRect)
>+{
>+ return NS_ERROR_NOT_IMPLEMENTED;
I'd prefer something like
if (SizeMode() != nsSizeMode_Normal)
return NS_ERROR_FAILURE;
return GetBounds(aRect);
This would then simplify the calling code.
Assignee | ||
Comment 9•11 years ago
|
||
I couldn't shortcut to GetBounds() because subclasses may override GetScreenBounds():
https://mxr.mozilla.org/mozilla-central/source/widget/gtk/nsWindow.cpp?rev=6c1c7e45c902#1423
Attachment #8420493 -
Attachment is obsolete: true
Attachment #8420493 -
Flags: review?(jmathies)
Attachment #8420662 -
Flags: review?(roc)
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8420494 -
Attachment is obsolete: true
Attachment #8420494 -
Flags: review?(neil)
Attachment #8420663 -
Flags: review?(neil)
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #8420495 -
Attachment is obsolete: true
Attachment #8420495 -
Flags: review?(jmathies)
Attachment #8420664 -
Flags: review?(jmathies)
Comment on attachment 8420662 [details] [diff] [review]
Part 1: Add nsIWidget::GetRestoredBounds()
Review of attachment 8420662 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/nsIWidget.h
@@ +1088,5 @@
> NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
>
> /**
> + * Similar to GetScreenBounds except that this function will always.
> + * get the normal (restored) widget's dimensions.
This comment isn't clear enough. What exactly does "the normal (restored) widget's dimensions" mean?
Attachment #8420662 -
Flags: review?(roc) → review-
Assignee | ||
Comment 13•11 years ago
|
||
Clarified the comment.
Attachment #8420662 -
Attachment is obsolete: true
Attachment #8420765 -
Flags: review?(roc)
Comment on attachment 8420765 [details] [diff] [review]
Add nsIWidget::GetRestoredBounds()
Review of attachment 8420765 [details] [diff] [review]:
-----------------------------------------------------------------
Excellent, thanks!
Attachment #8420765 -
Flags: review?(roc) → review+
Updated•11 years ago
|
Attachment #8420664 -
Flags: review?(jmathies) → review+
Comment 15•11 years ago
|
||
Comment on attachment 8420663 [details] [diff] [review]
Part 2: Use nsIWidget::GetRestoredBounds from appshell
Review of attachment 8420663 [details] [diff] [review]:
-----------------------------------------------------------------
Wrong person. Please make sure you assign to the correct Neil, guys.
Attachment #8420663 -
Flags: review?(neil) → review-
Assignee | ||
Comment 16•11 years ago
|
||
Comment on attachment 8420663 [details] [diff] [review]
Part 2: Use nsIWidget::GetRestoredBounds from appshell
Oops.
Attachment #8420663 -
Flags: review- → review?(neil)
Comment 17•11 years ago
|
||
Comment on attachment 8420663 [details] [diff] [review]
Part 2: Use nsIWidget::GetRestoredBounds from appshell
Thanks, that's looking a lot better. I've only had time for a quick look so far, so I'll just point out that sizeMode could be moved down into the PAD_MISC block and gotRestoredBounds looks a little lonely on its own line ;-) Don't bother updating the patch just yet in case I find something else.
Comment 18•11 years ago
|
||
Comment on attachment 8420663 [details] [diff] [review]
Part 2: Use nsIWidget::GetRestoredBounds from appshell
I have a problem. I can't actually reproduce the bug as described. I can for example configure Thunderbird to open the mail window maximised on the primary monitor and the address book maximised on the secondary monitor and it remembers which window should open on which monitor. Could someone provide me some STR?
Comment 19•11 years ago
|
||
The key to reproduce is that the monitor it appears on when starting is the one on which it was last in a non-maximized state on.
The common way to do this is to use the Aero Snap operations on Windows to move a maximized window between monitors (Win+Shift+Left/Right) and then close it.
Comment 20•11 years ago
|
||
I dunno about Thunderbird.
But i know it on Firefox:
- Move Firefox to second screen
- Maximise window
- Close Firefox
- Open Firefox again
Now you will find it on primary screen again.
Assignee | ||
Comment 21•11 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #18)
> Comment on attachment 8420663 [details] [diff] [review]
> I have a problem. I can't actually reproduce the bug as described. I can for
> example configure Thunderbird to open the mail window maximised on the
> primary monitor and the address book maximised on the secondary monitor and
> it remembers which window should open on which monitor. Could someone
> provide me some STR?
Hm, certainly the comment #20 issue is not reproducible for me, either. But it looks like this patch still fix the Aero Snap issue (comment #19).
Comment 22•11 years ago
|
||
(In reply to Masatoshi Kimura from comment #21)
> (In reply to comment #18)
> > Comment on attachment 8420663 [details] [diff] [review]
> > I have a problem. I can't actually reproduce the bug as described. I can for
> > example configure Thunderbird to open the mail window maximised on the
> > primary monitor and the address book maximised on the secondary monitor and
> > it remembers which window should open on which monitor. Could someone
> > provide me some STR?
>
> Hm, certainly the comment #20 issue is not reproducible for me, either. But
> it looks like this patch still fix the Aero Snap issue (comment #19).
http://stackoverflow.com/questions/5673242/getwindowplacement-gives-the-incorrect-window-position suggests that using Aero Snap to switch monitors doesn't update the restored window placement.
Assignee | ||
Comment 23•11 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #22)
> http://stackoverflow.com/questions/5673242/getwindowplacement-gives-the-
> incorrect-window-position suggests that using Aero Snap to switch monitors
> doesn't update the restored window placement.
The questioner must have misunderstood something. Apps should remember the un-Aero-Snapped dimensions and GetWindowPlacement returns the dimensions correctly. GetWindowsRect returns the Aero-Snapped dimensions. Apps bundled with Windows (such as IE or Notepad) will also remember the un-Aero-Snapped dimensions.
Comment 24•11 years ago
|
||
(In reply from comment #22)
> (In reply to Masatoshi Kimura from comment #21)
> > (In reply to comment #18)
> > > I have a problem. I can't actually reproduce the bug as described. I can for
> > > example configure Thunderbird to open the mail window maximised on the
> > > primary monitor and the address book maximised on the secondary monitor and
> > > it remembers which window should open on which monitor. Could someone
> > > provide me some STR?
> >
> > Hm, certainly the comment #20 issue is not reproducible for me, either. But
> > it looks like this patch still fix the Aero Snap issue (comment #19).
>
> http://stackoverflow.com/questions/5673242/getwindowplacement-gives-the-
> incorrect-window-position suggests that using Aero Snap to switch monitors
> doesn't update the restored window placement.
Ah, maybe I misunderstood that question. Anyway, I was able to borrow a dual-monitor Windows 7 PC and verified that the Aero Snap bug exists, but I don't have the authority to install an unreleased Firefox on that machine so I'll have to assume the code works by inspection.
Comment 25•11 years ago
|
||
Comment on attachment 8420663 [details] [diff] [review]
Part 2: Use nsIWidget::GetRestoredBounds from appshell
(Don't forget to consider my minor nits in comment #17.)
Attachment #8420663 -
Flags: review?(neil) → review+
Assignee | ||
Comment 26•11 years ago
|
||
Assignee | ||
Comment 27•11 years ago
|
||
Comment 28•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0b52fbd68bf3
https://hg.mozilla.org/mozilla-central/rev/8b1cdabfb557
https://hg.mozilla.org/mozilla-central/rev/bc60fad06272
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Comment 29•11 years ago
|
||
What's the behavior with 2 more monitors (say 3 e.g.)? Does it work as it should be?
Assignee | ||
Comment 30•11 years ago
|
||
Should work with 3 or more monitors.
Comment 31•10 years ago
|
||
I landed a trivial fixup for GCC (mingw) builds:
https://hg.mozilla.org/integration/mozilla-inbound/rev/781f4aff3769
Comment 32•10 years ago
|
||
Comment 33•8 years ago
|
||
Is it possible this caused bug 1250319?
You need to log in
before you can comment on or make changes to this bug.
Description
•