fix: dialog.showMessageBox defaultid on Windows (#48519)
* 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:
parent
d1c2d06bae
commit
af55e45ce8
1 changed files with 13 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue