diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 00:27:52 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 00:27:52 +0000 |
commit | 0888e85c007b3b88167753654769a8e3129d0fbb (patch) | |
tree | 9d44790c64c762b367b8ce48f22affd5e14cac17 /chrome/browser/gtk/location_bar_view_gtk.cc | |
parent | 5de6dace1d151d7929fee89e722e2d18709027d8 (diff) | |
download | chromium_src-0888e85c007b3b88167753654769a8e3129d0fbb.zip chromium_src-0888e85c007b3b88167753654769a8e3129d0fbb.tar.gz chromium_src-0888e85c007b3b88167753654769a8e3129d0fbb.tar.bz2 |
GTK: Compute infobubble target rects correctly.
I misunderstood how allocations work in the original
version and wasn't handling the case where there are
intermediate GdkWindows between the target widget and
its toplevel window correctly.
TEST=first-run, bookmark, and browser action bubbles get opened in the correct places under xmonad, metacity, and ion3
BUG=23373
Review URL: http://codereview.chromium.org/326017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/location_bar_view_gtk.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc index 382563a..086cf97 100644 --- a/chrome/browser/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/gtk/location_bar_view_gtk.cc @@ -649,20 +649,23 @@ void LocationBarViewGtk::ShowFirstRunBubbleInternal(bool use_OEM_bubble) { if (!location_entry_.get() || !widget()->window) return; - int x = widget()->allocation.x; - int y = widget()->allocation.y; + gfx::Rect rect = gtk_util::GetWidgetRectRelativeToToplevel(widget()); + rect.set_width(0); + rect.set_height(0); // The bubble needs to be just below the Omnibox and slightly to the right // of star button, so shift x and y co-ordinates. - y += widget()->allocation.height + kFirstRunBubbleTopMargin; + int y_offset = widget()->allocation.height + kFirstRunBubbleTopMargin; + int x_offset = 0; if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) - x += kFirstRunBubbleLeftMargin; + x_offset = kFirstRunBubbleLeftMargin; else - x += widget()->allocation.width - kFirstRunBubbleLeftMargin; + x_offset = widget()->allocation.width - kFirstRunBubbleLeftMargin; + rect.Offset(x_offset, y_offset); FirstRunBubble::Show(profile_, GTK_WINDOW(gtk_widget_get_toplevel(widget())), - gfx::Rect(x, y, 0, 0), + rect, use_OEM_bubble); } |