diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-22 18:41:23 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-22 18:41:23 +0000 |
commit | 9c94e7e17b009a000e3514196093c044a4844319 (patch) | |
tree | a1536df71b897d6d7c427df097fe922b4863d0bf /chrome/browser/gtk | |
parent | 6af4659c688caf12ef65abbf92aacf39a5f93d23 (diff) | |
download | chromium_src-9c94e7e17b009a000e3514196093c044a4844319.zip chromium_src-9c94e7e17b009a000e3514196093c044a4844319.tar.gz chromium_src-9c94e7e17b009a000e3514196093c044a4844319.tar.bz2 |
gtk: Get rid of status bubble flicker.
The bubble was appearing in its default location
when getting shown while the mouse was nearby; it
would move to the correct location on the next
motion event.
I think that there's still a flicker in the wrong
location when closing the download bar and then
triggering the bubble, but the fix is non-obvious
to me. It's possible that it's not noticeable on
anything faster than the slow DSL line that I'm
using to run Chrome remotely to test this.
BUG=28494
TEST=repeated steps from bug and checked that download bar behavior doesn't appear to have regressed either
Review URL: http://codereview.chromium.org/431007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.h | 6 |
2 files changed, 20 insertions, 2 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc index a57c05b..94cd392 100644 --- a/chrome/browser/gtk/status_bubble_gtk.cc +++ b/chrome/browser/gtk/status_bubble_gtk.cc @@ -43,7 +43,9 @@ StatusBubbleGtk::StatusBubbleGtk(Profile* profile) timer_factory_(this), flip_horizontally_(false), y_offset_(0), - download_shelf_is_visible_(false) { + download_shelf_is_visible_(false), + last_mouse_location_(0, 0), + last_mouse_left_content_(false) { InitWidgets(); theme_provider_->InitThemesFor(this); @@ -96,7 +98,6 @@ void StatusBubbleGtk::Show() { timer_factory_.RevokeAll(); gtk_widget_show_all(container_.get()); - if (container_->window) gdk_window_raise(container_->window); } @@ -110,6 +111,14 @@ void StatusBubbleGtk::SetStatusTextTo(const std::string& status_utf8) { HideInASecond(); } else { gtk_label_set_text(GTK_LABEL(label_), status_utf8.c_str()); + if (!last_mouse_left_content_) { + // Show the padding and label to update our requisition and then + // re-process the last mouse event -- if the label was empty before or the + // text changed, our size will have changed and we may need to move + // ourselves away from the pointer now. + gtk_widget_show_all(padding_); + MouseMoved(last_mouse_location_, false); + } Show(); } } @@ -125,6 +134,9 @@ void StatusBubbleGtk::HideInASecond() { void StatusBubbleGtk::MouseMoved( const gfx::Point& location, bool left_content) { + last_mouse_location_ = location; + last_mouse_left_content_ = left_content; + if (!GTK_WIDGET_REALIZED(container_.get())) return; diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h index 9784668..523dfcb 100644 --- a/chrome/browser/gtk/status_bubble_gtk.h +++ b/chrome/browser/gtk/status_bubble_gtk.h @@ -119,6 +119,12 @@ class StatusBubbleGtk : public StatusBubble, // If the download shelf is visible, do not obscure it. bool download_shelf_is_visible_; + + // 'location' and 'left_content' values from the last invocation of + // MouseMoved(). We hang onto these so we can move the bubble if necessary + // when its text changes, triggering a size change. + gfx::Point last_mouse_location_; + bool last_mouse_left_content_; }; #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ |