diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 19:22:34 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 19:22:34 +0000 |
commit | 3a69f0af0b98c8373fd6b5997ce37efd31baa8dd (patch) | |
tree | f954ec0d0c56a53b20fe27640a674698a96f28ff /chrome/browser/gtk/status_bubble_gtk.cc | |
parent | 5beb105cef4ede484df49a02cfc7984ac053b225 (diff) | |
download | chromium_src-3a69f0af0b98c8373fd6b5997ce37efd31baa8dd.zip chromium_src-3a69f0af0b98c8373fd6b5997ce37efd31baa8dd.tar.gz chromium_src-3a69f0af0b98c8373fd6b5997ce37efd31baa8dd.tar.bz2 |
GTK: Implement GtkFloatingContainer and implement StatusBubble on top of it.
This introduces a hybrid GtkBin/GtkFixed container which exposes a signal to absolutely position widgets. This also fixes the current flickering issues with the status bubble.
http://crbug.com/11635
TEST=Goto a site with a long list of links (I used reddit.com) and move the mouse cursor up and down the list quickly. There shouldn't be flickering in the top left corner.
Review URL: http://codereview.chromium.org/115835
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/status_bubble_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.cc | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc index abdacba..041d6b9 100644 --- a/chrome/browser/gtk/status_bubble_gtk.cc +++ b/chrome/browser/gtk/status_bubble_gtk.cc @@ -32,8 +32,7 @@ static const int kHideDelay = 250; } // namespace StatusBubbleGtk::StatusBubbleGtk() - : parent_(NULL), - timer_factory_(this) { + : timer_factory_(this) { InitWidgets(); } @@ -56,13 +55,6 @@ void StatusBubbleGtk::SetStatus(const std::wstring& status) { SetStatus(WideToUTF8(status)); } -void StatusBubbleGtk::SetParentAllocation( - GtkWidget* parent, GtkAllocation* allocation) { - parent_ = parent; - parent_allocation_ = *allocation; - SetStatusBubbleSize(); -} - void StatusBubbleGtk::SetURL(const GURL& url, const std::wstring& languages) { SetStatus(url.possibly_invalid_spec()); } @@ -71,7 +63,6 @@ void StatusBubbleGtk::Show() { // If we were going to hide, stop. timer_factory_.RevokeAll(); - SetStatusBubbleSize(); gtk_widget_show_all(container_.get()); if (container_.get()->window) @@ -91,38 +82,6 @@ void StatusBubbleGtk::HideInASecond() { kHideDelay); } -void StatusBubbleGtk::SetStatusBubbleSize() { - if (parent_) { - GtkRequisition requisition; - gtk_widget_size_request(container_.get(), &requisition); - - // TODO(erg): Previously, I put a call to gtk_fixed_put() here. It appears - // that doing this sets off a size-allocate storm, since gtk_fixed_put() - // calls gtk_widget_queue_resize on the GtkFixed that caused this message. - // The real solution may be creating a subclass of GtkVBox that has extra - // code to deal with floating widgets, but this hack is good enough for - // Friday. evanm says that there's a a GtkFixed subclass in test_shell that - // we'll be stealing for plugin support anyway that should also do the same - // task. - - GtkAllocation widget_allocation; - int child_y = std::max( - parent_allocation_.y + parent_allocation_.height - requisition.height, - 0); - widget_allocation.x = 0; - widget_allocation.y = child_y; - widget_allocation.width = std::max(1, std::min(requisition.width, - parent_allocation_.width)); - widget_allocation.height = std::max(1, requisition.height); - - if (memcmp(&widget_allocation, &container_.get()->allocation, - sizeof widget_allocation) != 0) { - // Only do something when we are actually changing sizes. - gtk_widget_size_allocate(container_.get(), &widget_allocation); - } - } -} - void StatusBubbleGtk::MouseMoved() { // We can't do that fancy sliding behaviour where the status bubble slides // out of the window because the window manager gets in the way. So totally |