summaryrefslogtreecommitdiffstats
path: root/chrome/common/gtk_util.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 17:26:00 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 17:26:00 +0000
commitcaeb38f22fd69de427d56291b7932250323d96cf (patch)
tree426c0c0fc327d4bf29ce3cb89aa5acab3d48b471 /chrome/common/gtk_util.cc
parente6926ab01dfc5946aafac81123e278fc38b92982 (diff)
downloadchromium_src-caeb38f22fd69de427d56291b7932250323d96cf.zip
chromium_src-caeb38f22fd69de427d56291b7932250323d96cf.tar.gz
chromium_src-caeb38f22fd69de427d56291b7932250323d96cf.tar.bz2
Fix the screen bounds calculation of windowless widgets. Only windowed parent widgets' allocation should be taken into account when calculating the widget screen bounds.
BUG=none TEST=Open a browser and set the frame to custom. Drag tabs around. They should not be offset vertically. Review URL: http://codereview.chromium.org/147065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r--chrome/common/gtk_util.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 1a89b9b..0ff6111 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -121,7 +121,15 @@ void ForceFontSizePixels(GtkWidget* widget, double size_pixels) {
gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
int x = 0, y = 0;
- GtkWidget* parent = widget;
+ if (GTK_IS_WINDOW(widget)) {
+ gdk_window_get_origin(widget->window, &x, &y);
+ return gfx::Point(x, y);
+ } else {
+ x = widget->allocation.x;
+ y = widget->allocation.y;
+ }
+
+ GtkWidget* parent = gtk_widget_get_parent(widget);
while (parent) {
if (GTK_IS_WINDOW(parent)) {
int window_x, window_y;
@@ -132,8 +140,11 @@ gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
return gfx::Point(x, y);
}
- x += parent->allocation.x;
- y += parent->allocation.y;
+ if (!GTK_WIDGET_NO_WINDOW(parent)) {
+ x += parent->allocation.x;
+ y += parent->allocation.y;
+ }
+
parent = gtk_widget_get_parent(parent);
}