diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 21:09:57 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 21:09:57 +0000 |
commit | 58e23f78f5b1666cda9a0ab43ae6314026a88787 (patch) | |
tree | 219c2f3e69f017c4c0fa14dc307d9f98b8da3808 /chrome/browser/gtk/browser_window_gtk.cc | |
parent | 97a1d694d347ce8b84fca7ed1e17782726138f54 (diff) | |
download | chromium_src-58e23f78f5b1666cda9a0ab43ae6314026a88787.zip chromium_src-58e23f78f5b1666cda9a0ab43ae6314026a88787.tar.gz chromium_src-58e23f78f5b1666cda9a0ab43ae6314026a88787.tar.bz2 |
GTK: Change find bar to use a floating container rather than some hacked up gtkfixed business.
The straw that broke this camel's back was when I realized that showing the findbar in fullscreen mode would inescapably mean an extra 1 pixel border at the top.
Also fix z-ordering problems for findbar that have been around since I introduced the floating bookmark bar (the fact that no one filed a bug on this suggests that it's not that noticeable).
BUG=none
TEST=find bar still works. find bar works in fullscreen. the toolbar bottom border still exists at all times. there are no z-ordering problems. the find bar still gets out of way of find results.
Review URL: http://codereview.chromium.org/373007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_window_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 443df13..63fe880 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -46,6 +46,7 @@ #include "chrome/browser/gtk/download_shelf_gtk.h" #include "chrome/browser/gtk/edit_search_engine_dialog.h" #include "chrome/browser/gtk/find_bar_gtk.h" +#include "chrome/browser/gtk/gtk_floating_container.h" #include "chrome/browser/gtk/go_button_gtk.h" #include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/browser/gtk/import_dialog_gtk.h" @@ -1419,6 +1420,7 @@ void BrowserWindowGtk::OnStateChanged(GdkWindowState state, tabstrip_->Hide(); if (IsBookmarkBarSupported()) bookmark_bar_->EnterFullscreen(); + gtk_widget_hide(toolbar_border_); #if defined(OS_CHROMEOS) if (main_menu_button_) gtk_widget_hide(main_menu_button_->widget()); @@ -1430,6 +1432,9 @@ void BrowserWindowGtk::OnStateChanged(GdkWindowState state, } else { UpdateCustomFrame(); ShowSupportedWindowFeatures(); + + gtk_widget_show(toolbar_border_); + gdk_window_lower(toolbar_border_->window); } } @@ -1486,11 +1491,9 @@ bool BrowserWindowGtk::ShouldShowWindowIcon() const { } void BrowserWindowGtk::AddFindBar(FindBarGtk* 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); - - gtk_widget_hide(toolbar_border_); + gtk_floating_container_add_floating( + GTK_FLOATING_CONTAINER(render_area_floating_container_), + findbar->widget()); } void BrowserWindowGtk::ResetCustomFrameCursor() { @@ -1700,6 +1703,9 @@ void BrowserWindowGtk::InitWidgets() { // |render_area_vbox_| is packed in |render_area_event_box_|. render_area_vbox_ = gtk_vbox_new(FALSE, 0); gtk_widget_set_name(render_area_vbox_, "chrome-render-area-vbox"); + render_area_floating_container_ = gtk_floating_container_new(); + gtk_container_add(GTK_CONTAINER(render_area_floating_container_), + render_area_vbox_); toolbar_border_ = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(render_area_vbox_), @@ -1732,14 +1738,15 @@ void BrowserWindowGtk::InitWidgets() { gtk_widget_set_size_request(devtools_container_->widget(), -1, kDefaultDevToolsHeight); } - gtk_widget_show_all(render_area_vbox_); + gtk_widget_show_all(render_area_floating_container_); gtk_widget_hide(devtools_container_->widget()); render_area_event_box_ = gtk_event_box_new(); // Set a white background so during startup the user sees white in the // content area before we get a TabContents in place. gtk_widget_modify_bg(render_area_event_box_, GTK_STATE_NORMAL, &gfx::kGdkWhite); - gtk_container_add(GTK_CONTAINER(render_area_event_box_), render_area_vbox_); + gtk_container_add(GTK_CONTAINER(render_area_event_box_), + render_area_floating_container_); gtk_widget_show(render_area_event_box_); gtk_box_pack_end(GTK_BOX(window_vbox_), render_area_event_box_, TRUE, TRUE, 0); @@ -2286,7 +2293,7 @@ void BrowserWindowGtk::PlaceBookmarkBar(bool is_floating) { } else { // Place the bookmark bar at the end of the render area; this happens after // the tab contents container has been placed there so we will be - // above the webpage. + // above the webpage (in terms of y). gtk_box_pack_end(GTK_BOX(render_area_vbox_), bookmark_bar_->widget(), FALSE, FALSE, 0); } |