summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:39:01 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:39:01 +0000
commitbe5e2c880c787fff66a110913f0fdd85524e2ff8 (patch)
tree6029213d298f7dda27106379ef0af22fe1dc0141
parent6cf8b1a2a871d7edb5e308b6437ec0caefba4953 (diff)
downloadchromium_src-be5e2c880c787fff66a110913f0fdd85524e2ff8.zip
chromium_src-be5e2c880c787fff66a110913f0fdd85524e2ff8.tar.gz
chromium_src-be5e2c880c787fff66a110913f0fdd85524e2ff8.tar.bz2
Fix initial window placement when dragging a tab out of the tabstrip into its own window. This change also removes code that was overriding the requested size as a temporary workaround.
BUG=none TEST=Open a browser window with two tabs. Drag one of the tabs out of the tabstrip. A new window should be created where the mouse is positioned. Review URL: http://codereview.chromium.org/113874 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16944 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc4
-rw-r--r--chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc8
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h2
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc2
4 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index dac71c3..243a7a2 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -752,9 +752,7 @@ void BrowserWindowGtk::SetGeometryHints() {
gtk_window_unmaximize(window_);
gfx::Rect rect = browser_->GetSavedWindowBounds();
- gtk_window_set_default_size(window_,
- static_cast<gint>(rect.width()),
- static_cast<gint>(rect.height()));
+ SetBounds(rect);
}
void BrowserWindowGtk::SetWindowIcon() {
diff --git a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc
index 6550b3a..d815d7e 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc
+++ b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/platform_util.h"
namespace {
@@ -576,7 +577,12 @@ bool DraggedTabControllerGtk::CompleteDrag() {
destroy_immediately = false;
} else {
// Compel the model to construct a new window for the detached TabContents.
- gfx::Rect browser_rect = source_tabstrip_->bounds();
+ GtkWindow* browser_window =
+ platform_util::GetTopLevel(source_tabstrip_->widget());
+ gint x, y, width, height;
+ gtk_window_get_position(browser_window, &x, &y);
+ gtk_window_get_size(browser_window, &width, &height);
+ gfx::Rect browser_rect = gfx::Rect(x, y, width, height);
gfx::Rect window_bounds(
GetWindowCreatePoint(),
gfx::Size(browser_rect.width(), browser_rect.height()));
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 6288b63..0516c5a 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -37,6 +37,8 @@ class TabStripGtk : public TabStripModelObserver,
TabStripModel* model() const { return model_; }
+ GtkWidget* widget() const { return tabstrip_.get(); }
+
// Returns true if there is an active drag session.
bool IsDragSessionActive() const { return drag_controller_.get() != NULL; }
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index f54b27f..cc75ea2 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -311,8 +311,6 @@ void ShowOptionsWindow(OptionsPage page,
bool DockInfo::GetNewWindowBounds(gfx::Rect* new_window_bounds,
bool* maximize_new_window) const {
NOTIMPLEMENTED();
- // Return a reasonable default
- *new_window_bounds = gfx::Rect(640, 480);
return true;
}
#endif