summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 20:56:15 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 20:56:15 +0000
commiteeb49f7211391245d1468ca5b2ec16cb430fbd41 (patch)
tree62018ba939cec89df4901bfd7e1d3d18bb433fd9 /chrome/browser
parent0ee2861b2b02700e8df8b4c6bcc956223bf0f22a (diff)
downloadchromium_src-eeb49f7211391245d1468ca5b2ec16cb430fbd41.zip
chromium_src-eeb49f7211391245d1468ca5b2ec16cb430fbd41.tar.gz
chromium_src-eeb49f7211391245d1468ca5b2ec16cb430fbd41.tar.bz2
Move the titlebar background drawing from the titlebar to the
browser window. This fixes a visual bug where the border looked disconnected with the background. This matches what Windows does. BUG=14884 Review URL: http://codereview.chromium.org/140078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/browser_titlebar.cc24
-rw-r--r--chrome/browser/gtk/browser_titlebar.h10
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc15
3 files changed, 15 insertions, 34 deletions
diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc
index ff4e329..eab9a7e 100644
--- a/chrome/browser/gtk/browser_titlebar.cc
+++ b/chrome/browser/gtk/browser_titlebar.cc
@@ -44,13 +44,6 @@ BrowserTitlebar::BrowserTitlebar(BrowserWindowGtk* browser_window,
}
void BrowserTitlebar::Init() {
- titlebar_background_.reset(new NineBox(
- browser_window_->browser()->profile()->GetThemeProvider(),
- 0, IDR_THEME_FRAME, 0, 0, 0, 0, 0, 0, 0));
- titlebar_background_otr_.reset(new NineBox(
- browser_window_->browser()->profile()->GetThemeProvider(),
- 0, IDR_THEME_FRAME_INCOGNITO, 0, 0, 0, 0, 0, 0, 0));
-
// The widget hierarchy is shown below.
//
// +- HBox (container_) --------------------------------------------------+
@@ -64,8 +57,6 @@ void BrowserTitlebar::Init() {
// +----------------------------------------------------------------------+
container_ = gtk_hbox_new(FALSE, 0);
- g_signal_connect(G_OBJECT(container_), "expose-event",
- G_CALLBACK(OnExpose), this);
g_signal_connect(window_, "window-state-event",
G_CALLBACK(OnWindowStateChanged), this);
@@ -130,21 +121,6 @@ void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) {
}
}
-gboolean BrowserTitlebar::OnExpose(GtkWidget* widget, GdkEventExpose* e,
- BrowserTitlebar* titlebar) {
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
- cairo_rectangle(cr, e->area.x, e->area.y, e->area.width, e->area.height);
- cairo_clip(cr);
- Profile* profile = titlebar->browser_window_->browser()->profile();
- NineBox* image = profile->IsOffTheRecord()
- ? titlebar->titlebar_background_otr_.get()
- : titlebar->titlebar_background_.get();
- image->RenderTopCenterStrip(cr, e->area.x, 0, e->area.width);
- cairo_destroy(cr);
-
- return FALSE; // Allow subwidgets to paint.
-}
-
gboolean BrowserTitlebar::OnWindowStateChanged(GtkWindow* window,
GdkEventWindowState* event, BrowserTitlebar* titlebar) {
// Update the maximize/restore button.
diff --git a/chrome/browser/gtk/browser_titlebar.h b/chrome/browser/gtk/browser_titlebar.h
index b491625..1dc8121 100644
--- a/chrome/browser/gtk/browser_titlebar.h
+++ b/chrome/browser/gtk/browser_titlebar.h
@@ -14,7 +14,6 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/menu_gtk.h"
-#include "chrome/browser/gtk/nine_box.h"
class BrowserWindowGtk;
class CustomDrawButton;
@@ -51,11 +50,6 @@ class BrowserTitlebar : public MenuGtk::Delegate {
int image_hot, GtkWidget* box,
int tooltip);
- // Callback for when the titlebar (include the background of the tab strip)
- // needs to be redrawn.
- static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e,
- BrowserTitlebar* window);
-
// Callback for changes to window state. This includes
// maximizing/restoring/minimizing the window.
static gboolean OnWindowStateChanged(GtkWindow* window,
@@ -91,10 +85,6 @@ class BrowserTitlebar : public MenuGtk::Delegate {
scoped_ptr<CustomDrawButton> restore_button_;
scoped_ptr<CustomDrawButton> close_button_;
- // The background of the title bar and tab strip.
- scoped_ptr<NineBox> titlebar_background_;
- scoped_ptr<NineBox> titlebar_background_otr_;
-
// The context menu.
scoped_ptr<MenuGtk> context_menu_;
};
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 4342ff6..7bf9932 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -360,6 +360,8 @@ gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget,
// TODO(tc): This will have to be dynamic once themes are supported. Maybe
// detect the theme install and delete the pointer?
static NineBox* custom_frame_border = NULL;
+ static NineBox* default_background = NULL;
+ static NineBox* default_background_otr = NULL;
if (window->use_custom_frame_.GetValue()) {
ThemeProvider* theme_provider =
@@ -376,9 +378,22 @@ gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget,
IDR_WINDOW_BOTTOM_LEFT_CORNER,
IDR_WINDOW_BOTTOM_CENTER,
IDR_WINDOW_BOTTOM_RIGHT_CORNER);
+ default_background = new NineBox(theme_provider,
+ 0, IDR_THEME_FRAME, 0, 0, 0, 0, 0, 0, 0);
+ default_background_otr = new NineBox(theme_provider,
+ 0, IDR_THEME_FRAME_INCOGNITO, 0, 0, 0, 0, 0, 0, 0);
}
+ // Draw the default background.
// TODO(tc): Handle maximized windows.
+ cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_rectangle(cr, event->area.x, event->area.y, event->area.width,
+ event->area.height);
+ cairo_clip(cr);
+ NineBox* image = window->browser()->profile()->IsOffTheRecord()
+ ? default_background_otr : default_background;
+ image->RenderTopCenterStrip(cr, event->area.x, 0, event->area.width);
+ cairo_destroy(cr);
// TODO(tc): Draw the theme overlay. The windows code is below.
// if (theme_provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY)) {