diff options
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/gtk/info_bubble_gtk.cc | 26 |
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); } } |