1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #111529 from wagnerfs/fix-windows-native-filedialog-filters

Fix Windows native FileDialog filters not showing descriptions
This commit is contained in:
Thaddeus Crews
2025-10-13 12:30:05 -05:00
2 changed files with 12 additions and 11 deletions

View File

@@ -555,7 +555,7 @@ void DisplayServerWindows::_thread_fd_monitor(void *p_ud) {
if (!exts.is_empty()) { if (!exts.is_empty()) {
String str = String(";").join(exts); String str = String(";").join(exts);
filter_exts.push_back(str.utf16()); filter_exts.push_back(str.utf16());
if (tokens.size() == 2) { if (tokens.size() >= 2) {
filter_names.push_back(tokens[1].strip_edges().utf16()); filter_names.push_back(tokens[1].strip_edges().utf16());
} else { } else {
filter_names.push_back(str.utf16()); filter_names.push_back(str.utf16());

View File

@@ -1127,13 +1127,13 @@ void FileDialog::update_filters() {
} }
String native_all_name; String native_all_name;
native_all_name += all_filters;
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE_MIME)) { if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE_MIME)) {
native_all_name += all_filters; if (!native_all_name.is_empty()) {
native_all_name += ", ";
}
native_all_name += all_mime;
} }
if (!native_all_name.is_empty()) {
native_all_name += ", ";
}
native_all_name += all_mime;
if (max_filters < filters.size()) { if (max_filters < filters.size()) {
all_filters += ", ..."; all_filters += ", ...";
@@ -1148,13 +1148,14 @@ void FileDialog::update_filters() {
String desc = filters[i].get_slicec(';', 1).strip_edges(); String desc = filters[i].get_slicec(';', 1).strip_edges();
String mime = filters[i].get_slicec(';', 2).strip_edges(); String mime = filters[i].get_slicec(';', 2).strip_edges();
String native_name; String native_name;
native_name += flt;
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE_MIME)) { if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE_MIME)) {
native_name += flt; if (!native_name.is_empty() && !mime.is_empty()) {
native_name += ", ";
}
native_name += mime;
} }
if (!native_name.is_empty() && !mime.is_empty()) {
native_name += ", ";
}
native_name += mime;
if (!desc.is_empty()) { if (!desc.is_empty()) {
filter->add_item(atr(desc) + " (" + flt + ")"); filter->add_item(atr(desc) + " (" + flt + ")");
processed_filters.push_back(flt + ";" + atr(desc) + " (" + native_name + ");" + mime); processed_filters.push_back(flt + ";" + atr(desc) + " (" + native_name + ");" + mime);