Chromium Code Reviews| Index: chrome/browser/ui/gtk/panels/panel_gtk.cc |
| diff --git a/chrome/browser/ui/gtk/panels/panel_gtk.cc b/chrome/browser/ui/gtk/panels/panel_gtk.cc |
| index 4361cf931c7f10049d9166322bb3081b6847b7ab..d1debdbc90dbc382dc3b99b1577cec27e9057aca 100644 |
| --- a/chrome/browser/ui/gtk/panels/panel_gtk.cc |
| +++ b/chrome/browser/ui/gtk/panels/panel_gtk.cc |
| @@ -195,7 +195,7 @@ void SetFrameSize(const gfx::Size& new_size) { |
| frame_size.SetSize(new_size.width(), new_size.height()); |
| } |
| -} |
| +} // namespace |
| // static |
| NativePanel* Panel::CreateNativePanel(Panel* panel, |
| @@ -608,7 +608,20 @@ gboolean PanelGtk::OnTitlebarButtonPressEvent( |
| if (event->type != GDK_BUTTON_PRESS) |
| return TRUE; |
| - gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(window_))); |
| + // If the panel is in a stack, bring all other panels in the stack to the |
| + // top. |
| + StackedPanelCollection* stack = panel_->stack(); |
| + if (stack) { |
| + for (StackedPanelCollection::Panels::const_iterator iter = |
| + stack->panels().begin(); |
| + iter != stack->panels().end(); ++iter) { |
| + gdk_window_raise(gtk_widget_get_window(GTK_WIDGET( |
| + (*iter)->GetNativeWindow()))); |
| + } |
| + } else { |
| + gdk_window_raise(gtk_widget_get_window(GTK_WIDGET(window_))); |
| + } |
| + |
| EnsureDragHelperCreated(); |
| drag_helper_->InitialTitlebarMousePress(event, titlebar_->widget()); |
| return TRUE; |
| @@ -864,6 +877,20 @@ bool PanelGtk::IsPanelActive() const { |
| } |
| void PanelGtk::PreventActivationByOS(bool prevent_activation) { |
| + // If the GTK window is set with no focus accepted, it introduces the |
| + // following issues: |
| + // 1) It cannot be brought to the top by calling gdk_window_raise. |
| + // 2) Even after it is forced to the top by calling gtk_window_present or |
| + // gtk_window_set_keep_above, it is not lowered in the z-order when the |
| + // client area of other window is clicked. |
| + // When a docked panel is minimized to a few pixel lines, we do not want it |
| + // to take focus since the user would have hard time to notice that. However, |
| + // when a stacked panel is collapsed to the titlebar-only, focusing on it |
| + // seems not to be too bad. Since we do not have other solution to solve |
|
Dmitry Titov
2013/06/20 00:57:23
The main reason for us to avoid focusing is to pre
|
| + // the two issues mentioned above for stacked panels, we choose not to |
| + // prevent activation for non-docked panels. |
| + if (panel_->collection()->type() != PanelCollection::DOCKED) |
| + prevent_activation = false; |
| gtk_window_set_accept_focus(window_, !prevent_activation); |
| } |