mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
fix: dialog.showMessageBox defaultid on Windows (#48520)
* fix: dialog.showMessageBox defaultid on Windows Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update shell/browser/ui/message_box_win.cc Co-authored-by: Robo <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -163,8 +163,19 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent,
|
||||
config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW;
|
||||
}
|
||||
|
||||
if (default_id > 0)
|
||||
config.nDefaultButton = kIDStart + default_id;
|
||||
if (default_id >= 0 &&
|
||||
base::checked_cast<size_t>(default_id) < buttons.size()) {
|
||||
if (!no_link) {
|
||||
auto common = GetCommonID(buttons[default_id]);
|
||||
if (common.button != -1) {
|
||||
config.nDefaultButton = common.id;
|
||||
} else {
|
||||
config.nDefaultButton = kIDStart + default_id;
|
||||
}
|
||||
} else {
|
||||
config.nDefaultButton = kIDStart + default_id;
|
||||
}
|
||||
}
|
||||
|
||||
// TaskDialogIndirect doesn't allow empty name, if we set empty title it
|
||||
// will show "electron.exe" in title.
|
||||
|
||||
Reference in New Issue
Block a user