diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 21:00:33 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 21:00:33 +0000 |
commit | c4d6f87b0cf6ee6d8478a79875700600b049d1df (patch) | |
tree | e3fd77172b81c7d83ac495d96f973881946c7482 /chrome/browser/gtk/gtk_util.cc | |
parent | 875f8f9b0757f2029b21cead7822db116ea525e0 (diff) | |
download | chromium_src-c4d6f87b0cf6ee6d8478a79875700600b049d1df.zip chromium_src-c4d6f87b0cf6ee6d8478a79875700600b049d1df.tar.gz chromium_src-c4d6f87b0cf6ee6d8478a79875700600b049d1df.tar.bz2 |
GTK: position info bubbles relative to a subwidget, rather than the toplevel window.
(Client code can still use a toplevel widget as the anchor.)
BUG=40068
TEST=tried all popups in LTR and RTL
Review URL: http://codereview.chromium.org/1575019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/gtk_util.cc')
-rw-r--r-- | chrome/browser/gtk/gtk_util.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc index 72f392e..15941cc 100644 --- a/chrome/browser/gtk/gtk_util.cc +++ b/chrome/browser/gtk/gtk_util.cc @@ -515,18 +515,7 @@ bool WidgetContainsCursor(GtkWidget* widget) { gint x = 0; gint y = 0; gtk_widget_get_pointer(widget, &x, &y); - - // To quote the gtk docs: - // - // Widget coordinates are a bit odd; for historical reasons, they are - // defined as widget->window coordinates for widgets that are not - // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, - // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. - // - // So the base is always (0,0). - gfx::Rect widget_allocation(0, 0, widget->allocation.width, - widget->allocation.height); - return widget_allocation.Contains(x, y); + return WidgetBounds(widget).Contains(x, y); } void SetWindowIcon(GtkWindow* window) { @@ -858,4 +847,16 @@ bool GrabAllInput(GtkWidget* widget) { return true; } +gfx::Rect WidgetBounds(GtkWidget* widget) { + // To quote the gtk docs: + // + // Widget coordinates are a bit odd; for historical reasons, they are + // defined as widget->window coordinates for widgets that are not + // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, + // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. + // + // So the base is always (0,0). + return gfx::Rect(0, 0, widget->allocation.width, widget->allocation.height); +} + } // namespace gtk_util |