You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Improve native file dialog parent window selection.
This commit is contained in:
committed by
Pāvels Nadtočajevs
parent
134da37497
commit
3e4e6e6c0c
@@ -402,26 +402,26 @@ void DisplayServerX11::set_system_theme_change_callback(const Callable &p_callab
|
||||
portal_desktop->set_system_theme_change_callback(p_callable);
|
||||
}
|
||||
|
||||
Error DisplayServerX11::file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) {
|
||||
WindowID window_id = last_focused_window;
|
||||
Error DisplayServerX11::file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback, WindowID p_window_id) {
|
||||
WindowID window_id = p_window_id;
|
||||
|
||||
if (!windows.has(window_id)) {
|
||||
if (!windows.has(window_id) && !windows[window_id].is_popup) {
|
||||
window_id = MAIN_WINDOW_ID;
|
||||
}
|
||||
|
||||
String xid = vformat("x11:%x", (uint64_t)windows[window_id].x11_window);
|
||||
return portal_desktop->file_dialog_show(last_focused_window, xid, p_title, p_current_directory, String(), p_filename, p_mode, p_filters, TypedArray<Dictionary>(), p_callback, false);
|
||||
return portal_desktop->file_dialog_show(p_window_id, xid, p_title, p_current_directory, String(), p_filename, p_mode, p_filters, TypedArray<Dictionary>(), p_callback, false);
|
||||
}
|
||||
|
||||
Error DisplayServerX11::file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) {
|
||||
WindowID window_id = last_focused_window;
|
||||
Error DisplayServerX11::file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback, WindowID p_window_id) {
|
||||
WindowID window_id = p_window_id;
|
||||
|
||||
if (!windows.has(window_id)) {
|
||||
if (!windows.has(window_id) && !windows[window_id].is_popup) {
|
||||
window_id = MAIN_WINDOW_ID;
|
||||
}
|
||||
|
||||
String xid = vformat("x11:%x", (uint64_t)windows[window_id].x11_window);
|
||||
return portal_desktop->file_dialog_show(last_focused_window, xid, p_title, p_current_directory, p_root, p_filename, p_mode, p_filters, p_options, p_callback, true);
|
||||
return portal_desktop->file_dialog_show(p_window_id, xid, p_title, p_current_directory, p_root, p_filename, p_mode, p_filters, p_options, p_callback, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user