Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Issue 125179: Fix: New window appears to the left/up if the taskbar is on left/top.... (Closed)

Created:
11 years, 6 months ago by Yuzo
Modified:
9 years, 7 months ago
Reviewers:
Peter Kasting
CC:
chromium-reviews_googlegroups.com
Base URL:
svn://chrome-svn.corp.google.com/chrome/trunk/src/
Visibility:
Public.

Description

Fix: New window appears to the left/up if the taskbar is on left/top. Currently, the Windows taskbar (put differently, work area) is not considered in getting the last window bounds (while it is for the saved window bounds). This causes new windows (CTRL-N) appear to the left/up of the existing window instead of right/down, if the taskbar is on left or top. TESTED=gcl try, manually TEST=Place the taskbar on left or top of the screen and create new Chrome windows by CTRL-N and observe. BUG=14131 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=18795

Patch Set 1 #

Total comments: 2

Patch Set 2 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -8 lines) Patch
M chrome/browser/window_sizer.h View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/window_sizer.cc View 1 2 chunks +2 lines, -3 lines 1 comment Download
M chrome/browser/window_sizer_unittest.cc View 1 5 chunks +22 lines, -4 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Yuzo
Ping?
11 years, 6 months ago (2009-06-19 04:28:29 UTC) #1
Peter Kasting
Should there be a unittest for this case? LGTM otherwise http://codereview.chromium.org/125179/diff/1/4 File chrome/browser/window_sizer.cc (right): http://codereview.chromium.org/125179/diff/1/4#newcode152 ...
11 years, 6 months ago (2009-06-19 05:08:16 UTC) #2
Yuzo
Peter, Thank you for your review. I've added two tests for this to window_sizer_unittest.cc. Yuzo ...
11 years, 6 months ago (2009-06-19 05:39:32 UTC) #3
Peter Kasting
http://codereview.chromium.org/125179/diff/3001/2005 File chrome/browser/window_sizer.cc (right): http://codereview.chromium.org/125179/diff/3001/2005#newcode154 Line 154: bounds->Offset(monitor_info_provider_->GetBoundsOffsetMatching(*bounds)); So wait a minute. I'm thinking about ...
11 years, 6 months ago (2009-06-19 06:21:14 UTC) #4
Yuzo
Oops, I've just submitted this. Do you want me to roll it back? Yes, the ...
11 years, 6 months ago (2009-06-19 06:28:16 UTC) #5
Peter Kasting
On 2009/06/19 06:28:16, yuzo wrote: > Oops, I've just submitted this. > Do you want ...
11 years, 6 months ago (2009-06-19 06:51:52 UTC) #6
Yuzo
To be more precise: Currently, WindowWin::SetInitialBounds calls SetWindowPos using the bounds returned by WindowSizer, unadjusted. ...
11 years, 6 months ago (2009-06-19 06:58:08 UTC) #7
Yuzo
Sorry, the previous one is not complete. To be more precise: Currently, WindowWin::SetInitialBounds calls SetWindowPos ...
11 years, 6 months ago (2009-06-19 07:00:59 UTC) #8
Yuzo
11 years, 6 months ago (2009-06-19 07:39:56 UTC) #9
I agree that consistency is important.
I'll try to make it consistent next week, in a separate change.

Additional note:

BrowserWindow::GetNormalBounds() is actually EXPECTED
to return the bounds in screen coordinate:

  // TODO(beng): RENAME (GetRestoredBounds)
  // Returns the nonmaximized bounds of the frame (even if the frame is
  // currently maximized or minimized) in terms of the screen coordinates.
  virtual gfx::Rect GetNormalBounds() const = 0;

but

  GetWindowPlacement

called from the function returns the bounds in the work area
coordinate. (The msdn site is unclear as to in which 
coordinate the function returns the position. But as far
as I can tell using a debugger, the returned position is
in the work area coordinate.)

Yuzo

On 2009/06/19 07:00:59, yuzo wrote:
> Sorry, the previous one is not complete.
> 
> To be more precise:
> 
> Currently, WindowWin::SetInitialBounds calls SetWindowPos using
> the bounds returned by WindowSizer, unadjusted.
> 
> An alternative would be to
> - have WindowSizer return bounds in work area coordinate,
> - convert the bounds to the screen coordinate in calling SetWindowPos, and
> - change all other callers of WindowSizer similarly.
> 
> Yuzo
>   
>  
> > On 2009/06/19 06:28:16, yuzo wrote:
> > > Oops, I've just submitted this.
> > > Do you want me to roll it back?
> > > 
> > > Yes, the coordinate looked weird to me too.
> > > 
> > > The saved / last window coordinate is relative to work area,
> > > while the "adjusted" coordinate is relative to screen.
> > > 
> > > An alternative approach I thought was to make
> > > the all coordinates relative to work are in adjusting them,
> > > and converting coordinate relative to the screen in calling
> > > setting window position API.
> > > 
> > > But I was not confident the approach won't affect other
> > > parts of code. So I took seemingly safer approach.
> > > 
> > > Yuzo
> > > 
> > > 
> > > On 2009/06/19 06:21:14, pkasting wrote:
> > > > http://codereview.chromium.org/125179/diff/3001/2005
> > > > File chrome/browser/window_sizer.cc (right):
> > > > 
> > > > http://codereview.chromium.org/125179/diff/3001/2005#newcode154
> > > > Line 154:
> > > >
bounds->Offset(monitor_info_provider_->GetBoundsOffsetMatching(*bounds));
> > > > So wait a minute.  I'm thinking about these more and they feel weird.
> > > > 
> > > > Why are we offsetting by the (work area - monitor rect) difference
anyway?
> 
> > > Are
> > > > the previous bounds we retrieve offset opposite to this and we have to
> > correct
> > > > for it?  I assume so... but then the values you get in your unittests
> kinda
> > > > scare me since we go from e.g. (10, 10) to (127, 10).  The only way this
> can
> > > be
> > > > right is if the first coordinate is relative to the work area and the
> second
> > > > relative to the screen.  Is that the case?

Powered by Google App Engine
This is Rietveld 408576698