]> khamidou — GitHub mirrors - electron.git/commitdiff
:checkered_flag: support defaultId for dialog boxes on Windows
authorleethomas <leet944@gmail.com>
Sun, 10 Jan 2016 23:55:26 +0000 (15:55 -0800)
committerleethomas <leet944@gmail.com>
Sun, 10 Jan 2016 23:55:26 +0000 (15:55 -0800)
atom/browser/ui/message_box_win.cc

index 58287dd5b7d5512424372369f302babe63503aa1..253733de59dfd6b02ef22ed3dde7cb7bdef30d69 100644 (file)
@@ -84,10 +84,11 @@ int ShowMessageBoxUTF16(HWND parent,
       TDF_ALLOW_DIALOG_CANCELLATION;  // Allow canceling the dialog.
 
   TASKDIALOGCONFIG config = { 0 };
-  config.cbSize     = sizeof(config);
-  config.hwndParent = parent;
-  config.hInstance  = GetModuleHandle(NULL);
-  config.dwFlags    = flags;
+  config.cbSize           = sizeof(config);
+  config.hwndParent       = parent;
+  config.hInstance        = GetModuleHandle(NULL);
+  config.dwFlags          = flags;
+  config.nDefaultButton   = default_id ? (kIDStart + default_id) : 0;
 
   // TaskDialogIndirect doesn't allow empty name, if we set empty title it
   // will show "electron.exe" in title.