From 32c881bde963510199d3b17c567d12c07365bda9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 24 Jun 2014 21:52:06 +0800 Subject: [PATCH] gtk: Make BrowserWindow::HasModalDialog work. Fixes atom/atom#2658. --- atom/browser/ui/file_dialog_gtk.cc | 5 ++++- atom/browser/ui/message_box_gtk.cc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index 9b813e705465..618ec31b63df 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -19,7 +19,8 @@ class FileChooserDialog { FileChooserDialog(GtkFileChooserAction action, atom::NativeWindow* parent_window, const std::string& title, - const base::FilePath& default_path) { + const base::FilePath& default_path) + : dialog_scope_(new atom::NativeWindow::DialogScope(parent_window)) { const char* confirm_text = GTK_STOCK_OK; if (action == GTK_FILE_CHOOSER_ACTION_SAVE) confirm_text = GTK_STOCK_SAVE; @@ -109,6 +110,8 @@ class FileChooserDialog { SaveDialogCallback save_callback_; OpenDialogCallback open_callback_; + scoped_ptr dialog_scope_; + DISALLOW_COPY_AND_ASSIGN(FileChooserDialog); }; diff --git a/atom/browser/ui/message_box_gtk.cc b/atom/browser/ui/message_box_gtk.cc index 792ef4db239d..4915d099588f 100644 --- a/atom/browser/ui/message_box_gtk.cc +++ b/atom/browser/ui/message_box_gtk.cc @@ -22,7 +22,8 @@ class MessageBox { const std::string& title, const std::string& message, const std::string& detail) - : cancel_id_(0) { + : cancel_id_(0), + dialog_scope_(new NativeWindow::DialogScope(parent_window)) { GtkWindow* window = parent_window ? parent_window->GetNativeWindow() : NULL; dialog_ = gtk_dialog_new_with_buttons( title.c_str(), @@ -84,6 +85,8 @@ class MessageBox { GtkWidget* dialog_; MessageBoxCallback callback_; + scoped_ptr dialog_scope_; + // The id to return when the dialog is closed without pressing buttons. int cancel_id_;