@@ -3051,8 +3051,14 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
3051
3051
buttons.push_back (s.utf16 ());
3052
3052
}
3053
3053
3054
+ WindowID window_id = _get_focused_window_or_popup ();
3055
+ if (!windows.has (window_id)) {
3056
+ window_id = MAIN_WINDOW_ID;
3057
+ }
3058
+
3054
3059
config.pszWindowTitle = (LPCWSTR)(title.get_data ());
3055
3060
config.pszContent = (LPCWSTR)(message.get_data ());
3061
+ config.hwndParent = windows[window_id].hWnd ;
3056
3062
3057
3063
const int button_count = buttons.size ();
3058
3064
config.cButtons = button_count;
@@ -3061,7 +3067,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
3061
3067
TASKDIALOG_BUTTON *tbuttons = button_count != 0 ? (TASKDIALOG_BUTTON *)alloca (sizeof (TASKDIALOG_BUTTON) * button_count) : nullptr ;
3062
3068
if (tbuttons) {
3063
3069
for (int i = 0 ; i < button_count; i++) {
3064
- tbuttons[i].nButtonID = i;
3070
+ tbuttons[i].nButtonID = i + 100 ;
3065
3071
tbuttons[i].pszButtonText = (LPCWSTR)(buttons[i].get_data ());
3066
3072
}
3067
3073
}
@@ -3078,7 +3084,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
3078
3084
3079
3085
if (task_dialog_indirect && SUCCEEDED (task_dialog_indirect (&config, &button_pressed, nullptr , nullptr ))) {
3080
3086
if (p_callback.is_valid ()) {
3081
- Variant button = button_pressed;
3087
+ Variant button = button_pressed - 100 ;
3082
3088
const Variant *args[1 ] = { &button };
3083
3089
Variant ret;
3084
3090
Callable::CallError ce;
@@ -3228,7 +3234,7 @@ Error DisplayServerWindows::dialog_input_text(String p_title, String p_descripti
3228
3234
WCHAR font[13 ]; // must be "MS Shell Dlg"
3229
3235
} template_base = {
3230
3236
1 , 0xFFFF , 0 , 0 ,
3231
- DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU ,
3237
+ DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION,
3232
3238
3 , 0 , 0 , 20 , 20 , L" " , L" #32770" , L" " , 8 , FW_NORMAL, 0 , DEFAULT_CHARSET, L" MS Shell Dlg"
3233
3239
};
3234
3240
0 commit comments