diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:59:55 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 17:59:55 +0000 |
commit | 9495e20a61ef7cb79a6ca2e3a70a1042a252bee6 (patch) | |
tree | 033f1ae1f5dfa273a242c78c679d39223ff3ae30 /chrome/browser/gtk | |
parent | 0bc189ec6ddffa79c1ce804d90a50fd550571093 (diff) | |
download | chromium_src-9495e20a61ef7cb79a6ca2e3a70a1042a252bee6.zip chromium_src-9495e20a61ef7cb79a6ca2e3a70a1042a252bee6.tar.gz chromium_src-9495e20a61ef7cb79a6ca2e3a70a1042a252bee6.tar.bz2 |
Linux: tweak find bar.
- (attempt to) fix find bar z ordering in a simpler way
- get "close without animation" right.
Review URL: http://codereview.chromium.org/100286
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 1 | ||||
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.cc | 11 | ||||
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/infobar_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/slide_animator_gtk.cc | 17 | ||||
-rw-r--r-- | chrome/browser/gtk/slide_animator_gtk.h | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/tab_contents_container_gtk.cc | 10 | ||||
-rw-r--r-- | chrome/browser/gtk/tab_contents_container_gtk.h | 7 |
8 files changed, 28 insertions, 27 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 3c2e285..ceb2561 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -660,7 +660,6 @@ bool BrowserWindowGtk::ShouldShowWindowIcon() const { } void BrowserWindowGtk::AddFindBar(FindBarGtk* findbar) { - contents_container_->set_find_bar(findbar); gtk_box_pack_start(GTK_BOX(render_area_vbox_), findbar->widget(), FALSE, FALSE, 0); gtk_box_reorder_child(GTK_BOX(render_area_vbox_), findbar->widget(), 0); diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 3a2f6be..8eb8f2e 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -186,8 +186,6 @@ GtkWidget* FindBarGtk::slide_widget() { } void FindBarGtk::Show() { - AssureOnTop(); - gtk_widget_show_all(slide_widget()); gtk_widget_grab_focus(find_text_); slide_widget_->Open(); } @@ -196,7 +194,7 @@ void FindBarGtk::Hide(bool animate) { if (animate) slide_widget_->Close(); else - gtk_widget_hide(slide_widget()); + slide_widget_->CloseWithoutAnimation(); } void FindBarGtk::SetFocusAndSelection() { @@ -237,7 +235,7 @@ gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { void FindBarGtk::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) { gtk_fixed_move(GTK_FIXED(widget()), slide_widget(), new_pos.x(), 0); - gtk_widget_show_all(slide_widget()); + slide_widget_->OpenWithoutAnimation(); } bool FindBarGtk::IsFindBarVisible() { @@ -257,11 +255,6 @@ bool FindBarGtk::GetFindBarWindowInfo(gfx::Point* position, return false; } -void FindBarGtk::AssureOnTop() { - if (container_->window) - gdk_window_raise(container_->window); -} - void FindBarGtk::ContentsChanged() { TabContents* tab_contents = find_bar_controller_->tab_contents(); if (!tab_contents) diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index d1ec9ce..6143e6c 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -61,10 +61,6 @@ class FindBarGtk : public FindBar, virtual bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible); - // Make sure the find bar is foremost on the z axis in the widget hierarchy - // by hiding and showing it. - void AssureOnTop(); - private: void InitWidgets(); diff --git a/chrome/browser/gtk/infobar_gtk.cc b/chrome/browser/gtk/infobar_gtk.cc index 4820b4f..4430135 100644 --- a/chrome/browser/gtk/infobar_gtk.cc +++ b/chrome/browser/gtk/infobar_gtk.cc @@ -88,6 +88,8 @@ void InfoBar::AnimateOpen() { void InfoBar::Open() { slide_widget_->OpenWithoutAnimation(); + if (border_bin_.get()->window) + gdk_window_lower(border_bin_.get()->window); } void InfoBar::AnimateClose() { diff --git a/chrome/browser/gtk/slide_animator_gtk.cc b/chrome/browser/gtk/slide_animator_gtk.cc index 083fab7..684cc37 100644 --- a/chrome/browser/gtk/slide_animator_gtk.cc +++ b/chrome/browser/gtk/slide_animator_gtk.cc @@ -71,13 +71,28 @@ void SlideAnimatorGtk::Open() { void SlideAnimatorGtk::OpenWithoutAnimation() { animation_->Reset(1.0); Open(); - fixed_needs_resize_ = true; + + // This checks to see if |child_| has been allocated yet. If it has been + // allocated already, we can go ahead and reposition everything by calling + // AnimationProgressed(). If it has not been allocated, we have to delay + // this call until it has been allocated (see OnChildSizeAllocate). + if (child_->allocation.x != -1) { + AnimationProgressed(animation_.get()); + } else { + fixed_needs_resize_ = true; + } } void SlideAnimatorGtk::Close() { animation_->Hide(); } +void SlideAnimatorGtk::CloseWithoutAnimation() { + animation_->Reset(0.0); + animation_->Hide(); + AnimationProgressed(animation_.get()); +} + bool SlideAnimatorGtk::IsShowing() { return animation_->IsShowing(); } diff --git a/chrome/browser/gtk/slide_animator_gtk.h b/chrome/browser/gtk/slide_animator_gtk.h index 984827b..8c0db60 100644 --- a/chrome/browser/gtk/slide_animator_gtk.h +++ b/chrome/browser/gtk/slide_animator_gtk.h @@ -61,6 +61,9 @@ class SlideAnimatorGtk : public AnimationDelegate { // Slide shut. void Close(); + // Immediately hide the widget. + void CloseWithoutAnimation(); + // Returns whether the widget is visible. bool IsShowing(); diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc index 4c2ea19..4b9767b 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/gtk/tab_contents_container_gtk.cc @@ -5,7 +5,6 @@ #include "chrome/browser/gtk/tab_contents_container_gtk.h" #include "base/gfx/native_widget_types.h" -#include "chrome/browser/gtk/find_bar_gtk.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" #include "chrome/common/notification_service.h" @@ -48,10 +47,11 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { gtk_box_pack_end(GTK_BOX(vbox_), widget, TRUE, TRUE, 0); gtk_widget_show_all(widget); } - // We need to make sure that the find bar is on top before any painting - // is done. - if (tab_contents_->find_ui_active()) - findbar_->AssureOnTop(); + // We need to make sure that we are below the findbar. + GdkWindow* content_gdk_window = + tab_contents_->GetContentNativeView()->window; + if (content_gdk_window) + gdk_window_lower(content_gdk_window); } } diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h index 5ddad17..6b4697b 100644 --- a/chrome/browser/gtk/tab_contents_container_gtk.h +++ b/chrome/browser/gtk/tab_contents_container_gtk.h @@ -10,7 +10,6 @@ #include "base/basictypes.h" #include "chrome/common/notification_observer.h" -class FindBarGtk; class RenderViewHost; class TabContents; @@ -31,8 +30,6 @@ class TabContentsContainerGtk : public NotificationObserver { const NotificationSource& source, const NotificationDetails& details); - void set_find_bar(FindBarGtk* findbar) { findbar_ = findbar; } - private: // Add or remove observers for events that we care about. void AddObservers(); @@ -56,10 +53,6 @@ class TabContentsContainerGtk : public NotificationObserver { // vbox_. GtkWidget* vbox_; - // We have to make sure we are always underneath the findbar, hence this - // pointer. - FindBarGtk* findbar_; - DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); }; |