From: Eran Tiktin Date: Sat, 22 Aug 2015 01:20:52 +0000 (+0300) Subject: Fix no close button in message box on Windows X-Git-Tag: v0.31.1~20^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b1406fbad93e65c6bd54c646cdb3fe37aed1c0dc;p=electron.git Fix no close button in message box on Windows This resolves #2293. --- diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index 051f8f5e..ecdc9677 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -78,9 +78,9 @@ int ShowMessageBoxUTF16(HWND parent, const base::string16& message, const base::string16& detail, const gfx::ImageSkia& icon) { - TASKDIALOG_FLAGS flags = TDF_SIZE_TO_CONTENT; // show all content. - if (cancel_id != 0) - flags |= TDF_ALLOW_DIALOG_CANCELLATION; // allow dialog to be cancelled. + TASKDIALOG_FLAGS flags = + TDF_SIZE_TO_CONTENT | // Show all content. + TDF_ALLOW_DIALOG_CANCELLATION; // Allow canceling the dialog. TASKDIALOGCONFIG config = { 0 }; config.cbSize = sizeof(config); diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index d8c6c0a8..a4131784 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -80,12 +80,15 @@ window.alert = (message, title='') -> buttons = ['OK'] message = message.toString() dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons} + # Alert should always return undefined. + return # And the confirm(). window.confirm = (message, title='') -> dialog = remote.require 'dialog' buttons = ['OK', 'Cancel'] - not dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons} + cancelId = 1 + not dialog.showMessageBox remote.getCurrentWindow(), {message, title, buttons, cancelId} # But we do not support prompt(). window.prompt = ->