]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix no close button in message box on Windows
authorEran Tiktin <eran.t@mce-sys.com>
Sat, 22 Aug 2015 01:20:52 +0000 (04:20 +0300)
committerEran Tiktin <eran.t@mce-sys.com>
Sat, 22 Aug 2015 01:20:52 +0000 (04:20 +0300)
This resolves #2293.

atom/browser/ui/message_box_win.cc
atom/renderer/lib/override.coffee

index 051f8f5eff6c379f71e8731c67ee0719618343a3..ecdc96770bb23427f0f9cdc6a25c3b28c12cdd27 100644 (file)
@@ -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);
index d8c6c0a86d790e0dfc8eba1ee99ee3fec65af27f..a413178442f21dcde1613ce73f8be435d9fd1cac 100644 (file)
@@ -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 = ->