mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
fix: dialog.showMessageBox defaultid on Windows (#48216)
* fix: dialog.showMessageBox defaultid on Windows * Update shell/browser/ui/message_box_win.cc Co-authored-by: Robo <hop2deep@gmail.com> --------- Co-authored-by: Robo <hop2deep@gmail.com>
This commit is contained in:
@@ -163,8 +163,19 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent,
|
|||||||
config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW;
|
config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (default_id > 0)
|
if (default_id >= 0 &&
|
||||||
config.nDefaultButton = kIDStart + default_id;
|
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
|
// TaskDialogIndirect doesn't allow empty name, if we set empty title it
|
||||||
// will show "electron.exe" in title.
|
// will show "electron.exe" in title.
|
||||||
|
|||||||
Reference in New Issue
Block a user