@@ -3051,8 +3051,14 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
30513051 buttons.push_back (s.utf16 ());
30523052 }
30533053
3054+ WindowID window_id = _get_focused_window_or_popup ();
3055+ if (!windows.has (window_id)) {
3056+ window_id = MAIN_WINDOW_ID;
3057+ }
3058+
30543059 config.pszWindowTitle = (LPCWSTR)(title.get_data ());
30553060 config.pszContent = (LPCWSTR)(message.get_data ());
3061+ config.hwndParent = windows[window_id].hWnd ;
30563062
30573063 const int button_count = buttons.size ();
30583064 config.cButtons = button_count;
@@ -3061,7 +3067,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
30613067 TASKDIALOG_BUTTON *tbuttons = button_count != 0 ? (TASKDIALOG_BUTTON *)alloca (sizeof (TASKDIALOG_BUTTON) * button_count) : nullptr ;
30623068 if (tbuttons) {
30633069 for (int i = 0 ; i < button_count; i++) {
3064- tbuttons[i].nButtonID = i;
3070+ tbuttons[i].nButtonID = i + 100 ;
30653071 tbuttons[i].pszButtonText = (LPCWSTR)(buttons[i].get_data ());
30663072 }
30673073 }
@@ -3078,7 +3084,7 @@ Error DisplayServerWindows::dialog_show(String p_title, String p_description, Ve
30783084
30793085 if (task_dialog_indirect && SUCCEEDED (task_dialog_indirect (&config, &button_pressed, nullptr , nullptr ))) {
30803086 if (p_callback.is_valid ()) {
3081- Variant button = button_pressed;
3087+ Variant button = button_pressed - 100 ;
30823088 const Variant *args[1 ] = { &button };
30833089 Variant ret;
30843090 Callable::CallError ce;
@@ -3228,7 +3234,7 @@ Error DisplayServerWindows::dialog_input_text(String p_title, String p_descripti
32283234 WCHAR font[13 ]; // must be "MS Shell Dlg"
32293235 } template_base = {
32303236 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,
32323238 3 , 0 , 0 , 20 , 20 , L" " , L" #32770" , L" " , 8 , FW_NORMAL, 0 , DEFAULT_CHARSET, L" MS Shell Dlg"
32333239 };
32343240
0 commit comments