summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:03:15 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:03:15 +0000
commit3e910974afe6fe6e17a5bc38eae915bb220a7ff1 (patch)
treed3614522dc52a93f71e6708b445d112fab46ecde /chrome/browser
parentbcb71cf13f3997254c8c054590f2c43819f5c0cc (diff)
downloadchromium_src-3e910974afe6fe6e17a5bc38eae915bb220a7ff1.zip
chromium_src-3e910974afe6fe6e17a5bc38eae915bb220a7ff1.tar.gz
chromium_src-3e910974afe6fe6e17a5bc38eae915bb220a7ff1.tar.bz2
GTK: Don't close info bubbles based on which toplevel is active.
This fixes the behavior for active toplevel windows and focus follows mouse that moving the mouse onto and then off of the bookmark bubble will close it. This also fixes that we might paint the tab strip active while the system title bar is painted inactive. Unfortunately we can't stop the browser window from painting inactive when using the system frame. This reverts us to the old bad behavior that you could drag around the browser window and the bookmark bubble will stay in place. It also reverts us to allowing the info bubble to being able to persist even if it doesnt have focus. This doesn't match windows, but I'm not convinced windows is all that great. BUG=none TEST=see above Review URL: http://codereview.chromium.org/159288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc7
-rw-r--r--chrome/browser/gtk/info_bubble_gtk.cc26
2 files changed, 12 insertions, 21 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 2ebc1cf..bcf46b2 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -817,11 +817,16 @@ void BrowserWindowGtk::Observe(NotificationType type,
if (!window_)
break;
+ // If we lose focus to an info bubble, we don't want to seem inactive.
+ // However we can only control this when we are painting a custom
+ // frame. So if we lose focus BUT it's to one of our info bubbles AND we
+ // are painting a custom frame, then paint as if we are active.
const GdkWindow* active_window = Details<const GdkWindow>(details).ptr();
const GtkWindow* info_bubble_toplevel =
InfoBubbleGtk::GetToplevelForInfoBubble(active_window);
bool is_active = (GTK_WIDGET(window_)->window == active_window ||
- window_ == info_bubble_toplevel);
+ (window_ == info_bubble_toplevel &&
+ use_custom_frame_.GetValue()));
bool changed = (is_active != is_active_);
is_active_ = is_active;
if (changed) {
diff --git a/chrome/browser/gtk/info_bubble_gtk.cc b/chrome/browser/gtk/info_bubble_gtk.cc
index de099ac..56a5ea5 100644
--- a/chrome/browser/gtk/info_bubble_gtk.cc
+++ b/chrome/browser/gtk/info_bubble_gtk.cc
@@ -218,9 +218,6 @@ void InfoBubbleGtk::Init(GtkWindow* transient_toplevel,
gtk_window_group_add_window(gtk_window_get_group(transient_toplevel),
GTK_WINDOW(window_));
gtk_grab_add(window_);
-
- registrar_.Add(this, NotificationType::ACTIVE_WINDOW_CHANGED,
- NotificationService::AllSources());
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());
theme_provider_->InitThemesFor(this);
@@ -229,23 +226,12 @@ void InfoBubbleGtk::Init(GtkWindow* transient_toplevel,
void InfoBubbleGtk::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type.value) {
- case NotificationType::ACTIVE_WINDOW_CHANGED:
- // If we are no longer the active toplevel for whatever reason (whether
- // another toplevel gained focus or our browser did), close.
- if (window_->window != Details<const GdkWindow>(details).ptr())
- Close();
- break;
- case NotificationType::BROWSER_THEME_CHANGED:
- if (theme_provider_->UseGtkTheme()) {
- gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL);
- } else {
- // Set the background color, so we don't need to paint it manually.
- gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, &kBackgroundColor);
- }
- break;
- default:
- NOTREACHED();
+ DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED);
+ if (theme_provider_->UseGtkTheme()) {
+ gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL);
+ } else {
+ // Set the background color, so we don't need to paint it manually.
+ gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, &kBackgroundColor);
}
}