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

Unified Diff: chrome/common/gtk_util.cc

Issue 113532: Implement DraggedTabGtk, the object that handles rendering either a dragged t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/gtk_util.cc
===================================================================
--- chrome/common/gtk_util.cc (revision 16177)
+++ chrome/common/gtk_util.cc (working copy)
@@ -54,4 +54,31 @@
gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container);
}
+gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
+ int x = 0, y = 0;
+
+ GtkWidget* parent = widget;
+ while (parent) {
+ if (GTK_IS_WINDOW(parent)) {
+ int window_x, window_y;
+ gtk_window_get_position(GTK_WINDOW(parent), &window_x, &window_y);
+ x += window_x;
+ y += window_y;
+ return gfx::Point(x, y);
+ }
+
+ x += parent->allocation.x;
+ y += parent->allocation.y;
+ parent = gtk_widget_get_parent(parent);
+ }
+
+ return gfx::Point(x, y);
+}
+
+gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) {
+ gfx::Point position = GetWidgetScreenPosition(widget);
+ return gfx::Rect(position.x(), position.y(),
+ widget->allocation.width, widget->allocation.height);
+}
+
} // namespace gtk_util
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698