diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 23:54:59 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-23 23:54:59 +0000 |
commit | b1e8cb31f85869171dcb383c7ec5e8176833ec04 (patch) | |
tree | 8729b075052bd0ce84c72b5c524ebd08f56d49ab /chrome | |
parent | 0be0ee30616010ba8f8a21af50dbcdf6d0943363 (diff) | |
download | chromium_src-b1e8cb31f85869171dcb383c7ec5e8176833ec04.zip chromium_src-b1e8cb31f85869171dcb383c7ec5e8176833ec04.tar.gz chromium_src-b1e8cb31f85869171dcb383c7ec5e8176833ec04.tar.bz2 |
linux: obey window positioning information when bounds are overridden
Normally we want to let windows position themselves, but in some cases
(like dropping a tab) we really do want to drop the window where we
dropped.
BUG=15404
TEST=Drag off a tab and drop it. It should drop where you released it.
Review URL: http://codereview.chromium.org/159316
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 17 |
2 files changed, 17 insertions, 4 deletions
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 4c4555d..d4196ae 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -102,6 +102,10 @@ class Browser : public TabStripModelDelegate, void set_maximized_state(MaximizedState state) { maximized_state_ = state; } + // Return true if the initial window bounds have been overridden. + bool bounds_overridden() const { + return !override_bounds_.IsEmpty(); + } // Creates the Browser Window. Prefer to use the static helpers above where // possible. This does not show the window. You need to call window()->Show() diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index ae8c547..2ebc1cf 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1070,10 +1070,19 @@ void BrowserWindowGtk::SetGeometryHints() { gtk_window_unmaximize(window_); gfx::Rect bounds = browser_->GetSavedWindowBounds(); - // Note that calling SetBounds() here is incorrect, as that sets a forced - // position on the window and we intentionally *don't* do that. We tested - // many programs and none of them restored their position on Linux. - gtk_window_resize(window_, bounds.width(), bounds.height()); + // We don't blindly call SetBounds here, that sets a forced position + // on the window and we intentionally *don't* do that for normal + // windows. We tested many programs and none of them restored their + // position on Linux. + // + // However, in cases like dropping a tab where the bounds are + // specifically set, we do want to position explicitly. + if (browser_->bounds_overridden()) { + SetBounds(bounds); + } else { + // Ignore the position but obey the size. + gtk_window_resize(window_, bounds.width(), bounds.height()); + } } void BrowserWindowGtk::ConnectHandlersToSignals() { |