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

Unified Diff: ui/base/gtk/gtk_screen_util.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more vector use fixes Created 8 years, 2 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
Index: ui/base/gtk/gtk_screen_util.cc
diff --git a/ui/base/gtk/gtk_screen_util.cc b/ui/base/gtk/gtk_screen_util.cc
index f0ef4d35b336cbee3e0c8bb42568a271cb5498d6..718a10a7b95a40f94e8f4d65e5ed42735745998b 100644
--- a/ui/base/gtk/gtk_screen_util.cc
+++ b/ui/base/gtk/gtk_screen_util.cc
@@ -26,12 +26,12 @@ gfx::Point ClientPoint(GtkWidget* widget) {
return gfx::Point(x, y);
}
-gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
+gfx::Vector2d GetWidgetScreenOffset(GtkWidget* widget) {
GdkWindow* window = gtk_widget_get_window(widget);
if (!window) {
NOTREACHED() << "Must only be called on realized widgets.";
- return gfx::Point(0, 0);
+ return gfx::Vector2d(0, 0);
}
gint x, y;
@@ -44,11 +44,11 @@ gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
y += allocation.y;
}
- return gfx::Point(x, y);
+ return gfx::Vector2d(x, y);
}
gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) {
- gfx::Point position = GetWidgetScreenPosition(widget);
+ gfx::Point position = PointAtOffsetFromOrigin(GetWidgetScreenOffset(widget));
Peter Kasting 2012/10/30 01:14:14 Nit: Seems like we don't need to convert to a poin
danakj 2012/10/30 19:21:21 ya, the latter sounds nice. i had done that elsewh
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);

Powered by Google App Engine
This is Rietveld 408576698