Chromium Code Reviews| Index: chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
| diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
| index f9c8b53c89113cc51bcedcca340b967650670e0f..45088a353a66b1be6d8ce3f6a9dfb06167850d0d 100644 |
| --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
| +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
| @@ -2,6 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <gdk/gdkx.h> |
| #include <gtk/gtk.h> |
| #include <map> |
| #include <set> |
| @@ -25,6 +26,7 @@ |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/shell_dialogs/select_file_dialog.h" |
| #include "ui/strings/grit/ui_strings.h" |
| +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| namespace { |
| @@ -272,9 +274,11 @@ void SelectFileDialogImplGTK::SelectFileImpl( |
| params_map_[dialog] = params; |
| - // TODO(erg): Figure out how to fake GTK window-to-parent modality without |
| - // having the parent be a real GtkWindow. |
| - gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
| + // Disable input events handling in the host window to make the dialog modal. |
| + views::DesktopWindowTreeHostX11* host = |
| + static_cast<views::DesktopWindowTreeHostX11*>( |
| + GetAuraTransientParent(dialog)->GetHost()); |
|
sadrul
2015/06/30 17:30:56
Looks like GetAuraTransientParent() could return n
sadrul
2015/06/30 17:30:56
The static cast here is not great. Maybe you could
joone
2015/07/01 03:16:06
Yes, we could get the DWTHX as follows:
views::
|
| + host->DisableEventListening(GDK_WINDOW_XID(gtk_widget_get_window(dialog))); |
| gtk_widget_show_all(dialog); |
| @@ -525,6 +529,11 @@ void SelectFileDialogImplGTK::FileDialogDestroyed(GtkWidget* dialog) { |
| aura::Window* parent = GetAuraTransientParent(dialog); |
| if (!parent) |
| return; |
| + |
| + views::DesktopWindowTreeHostX11* host = |
| + static_cast<views::DesktopWindowTreeHostX11*>(parent->GetHost()); |
| + host->EnableEventListening(); |
| + |
| std::set<aura::Window*>::iterator iter = parents_.find(parent); |
| if (iter != parents_.end()) { |
| (*iter)->RemoveObserver(this); |