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 249cb664541cd16dd7a7b64ce55b8f3022f33d7c..77fa2c23e9bc11327404fb51d1228ab944bd68f3 100644 |
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h" |
+#include <gdk/gdkx.h> |
#include <gtk/gtk.h> |
#include <stddef.h> |
#include <sys/stat.h> |
@@ -32,6 +33,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 { |
@@ -164,9 +166,14 @@ 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 this dialog modal. |
+ views::DesktopWindowTreeHostX11* host = |
+ views::DesktopWindowTreeHostX11::GetHostForXID( |
+ owning_window->GetHost()->GetAcceleratedWidget()); |
+ scoped_ptr<views::ScopedHandle> scope_handle = |
+ host->DisableEventListening( |
+ GDK_WINDOW_XID(gtk_widget_get_window(dialog))); |
+ g_object_set_data(G_OBJECT(dialog), "scope_handle", scope_handle.get()); |
joone
2016/03/02 23:40:28
g_object_set_data can't retain the scoped_handle s
sadrul
2016/04/15 09:26:15
You would have to do scope_handle.release() there,
|
gtk_widget_show_all(dialog); |