Skip to content

Commit c019b76

Browse files
committed
Remove WinAPI #undef hacks needed for mingw-std-threads
Instead, we rename the conflicting symbols.
1 parent ce94b26 commit c019b76

15 files changed

+46
-73
lines changed

editor/dependency_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ void DependencyEditorOwners::_list_rmb_clicked(int p_item, const Vector2 &p_pos,
302302
}
303303

304304
if (only_scenes_selected) {
305-
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRN("Open Scene", "Open Scenes", selected_items.size()), FILE_OPEN);
305+
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRN("Open Scene", "Open Scenes", selected_items.size()), FILE_OPEN_);
306306
} else if (selected_items.size() == 1) {
307-
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open"), FILE_OPEN);
307+
file_options->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTR("Open"), FILE_OPEN_);
308308
} else {
309309
return;
310310
}
@@ -333,7 +333,7 @@ void DependencyEditorOwners::_empty_clicked(const Vector2 &p_pos, MouseButton p_
333333

334334
void DependencyEditorOwners::_file_option(int p_option) {
335335
switch (p_option) {
336-
case FILE_OPEN: {
336+
case FILE_OPEN_: {
337337
PackedInt32Array selected_items = owners->get_selected_items();
338338
for (int i = 0; i < selected_items.size(); i++) {
339339
int item_idx = selected_items[i];

editor/dependency_editor.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ class DependencyEditor : public AcceptDialog {
6464
DependencyEditor();
6565
};
6666

67-
#ifdef MINGW_ENABLED
68-
#undef FILE_OPEN
69-
#endif
70-
7167
class DependencyEditorOwners : public AcceptDialog {
7268
GDCLASS(DependencyEditorOwners, AcceptDialog);
7369

@@ -84,7 +80,7 @@ class DependencyEditorOwners : public AcceptDialog {
8480

8581
private:
8682
enum FileMenu {
87-
FILE_OPEN
83+
FILE_OPEN_,
8884
};
8985

9086
public:

editor/filesystem_dock.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
23232323
}
23242324
} break;
23252325

2326-
case FILE_OPEN: {
2326+
case FILE_OPEN_: {
23272327
// Open folders.
23282328
TreeItem *selected = tree->get_root();
23292329
selected = tree->get_next_selected(selected);
@@ -3211,18 +3211,18 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
32113211
if (all_files) {
32123212
if (all_files_scenes) {
32133213
if (filenames.size() == 1) {
3214-
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_OPEN);
3214+
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scene"), FILE_OPEN_);
32153215
p_popup->add_icon_item(get_editor_theme_icon(SNAME("CreateNewSceneFrom")), TTRC("New Inherited Scene"), FILE_INHERIT);
32163216
if (GLOBAL_GET("application/run/main_scene") != filenames[0]) {
32173217
p_popup->add_icon_item(get_editor_theme_icon(SNAME("PlayScene")), TTRC("Set as Main Scene"), FILE_MAIN_SCENE);
32183218
}
32193219
} else {
3220-
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scenes"), FILE_OPEN);
3220+
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open Scenes"), FILE_OPEN_);
32213221
}
32223222
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Instance")), TTRC("Instantiate"), FILE_INSTANTIATE);
32233223
p_popup->add_separator();
32243224
} else if (filenames.size() == 1) {
3225-
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open"), FILE_OPEN);
3225+
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Open"), FILE_OPEN_);
32263226
p_popup->add_separator();
32273227
}
32283228

@@ -3255,7 +3255,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
32553255
bool root_path_not_selected = p_paths[0] != "res://" && (p_paths.size() <= 1 || p_paths[1] != "res://");
32563256

32573257
if (all_folders && foldernames.size() > 0) {
3258-
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Expand Folder"), FILE_OPEN);
3258+
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Load")), TTRC("Expand Folder"), FILE_OPEN_);
32593259

32603260
if (foldernames.size() == 1) {
32613261
p_popup->add_icon_item(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), TTRC("Expand Hierarchy"), FOLDER_EXPAND_ALL);

editor/filesystem_dock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class FileSystemDock : public VBoxContainer {
101101

102102
private:
103103
enum FileMenu {
104-
FILE_OPEN,
104+
FILE_OPEN_, // Conflict with WinAPI.
105105
FILE_INHERIT,
106106
FILE_MAIN_SCENE,
107107
FILE_INSTANTIATE,

editor/plugins/script_editor_plugin.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ void ScriptEditor::_file_dialog_action(const String &p_file) {
11961196
}
11971197
[[fallthrough]];
11981198
}
1199-
case FILE_OPEN: {
1199+
case FILE_OPEN_: {
12001200
open_file(p_file);
12011201
file_dialog_option = -1;
12021202
} break;
@@ -1281,10 +1281,10 @@ void ScriptEditor::_menu_option(int p_option) {
12811281
file_dialog->popup_file_dialog();
12821282
open_textfile_after_create = true;
12831283
} break;
1284-
case FILE_OPEN: {
1284+
case FILE_OPEN_: {
12851285
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
12861286
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
1287-
file_dialog_option = FILE_OPEN;
1287+
file_dialog_option = FILE_OPEN_;
12881288

12891289
List<String> extensions;
12901290
ResourceLoader::get_recognized_extensions_for_type("Script", &extensions);
@@ -4258,7 +4258,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
42584258

42594259
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTRC("New Script..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_NEW);
42604260
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTRC("New Text File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_NEW_TEXTFILE);
4261-
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTRC("Open...")), FILE_OPEN);
4261+
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTRC("Open...")), FILE_OPEN_);
42624262
file_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_editor/reopen_closed_script"), FILE_REOPEN_CLOSED);
42634263

42644264
recent_scripts = memnew(PopupMenu);

editor/plugins/script_editor_plugin.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,13 @@ class EditorScriptCodeCompletionCache;
230230
class FindInFilesDialog;
231231
class FindInFilesPanel;
232232

233-
#ifdef MINGW_ENABLED
234-
#undef FILE_OPEN
235-
#endif
236-
237233
class ScriptEditor : public PanelContainer {
238234
GDCLASS(ScriptEditor, PanelContainer);
239235

240236
enum {
241237
FILE_NEW,
242238
FILE_NEW_TEXTFILE,
243-
FILE_OPEN,
239+
FILE_OPEN_, // Conflict with WinAPI.
244240
FILE_REOPEN_CLOSED,
245241
FILE_OPEN_RECENT,
246242
FILE_SAVE,

editor/plugins/shader_editor_plugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void ShaderEditorPlugin::_setup_popup_menu(PopupMenuType p_type, PopupMenu *p_me
397397
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new", TTRC("New Shader..."), KeyModifierMask::CMD_OR_CTRL | Key::N), FILE_NEW);
398398
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/new_include", TTRC("New Shader Include..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::N), FILE_NEW_INCLUDE);
399399
p_menu->add_separator();
400-
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open", TTRC("Load Shader File..."), KeyModifierMask::CMD_OR_CTRL | Key::O), FILE_OPEN);
400+
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open", TTRC("Load Shader File..."), KeyModifierMask::CMD_OR_CTRL | Key::O), FILE_OPEN_);
401401
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/open_include", TTRC("Load Shader Include File..."), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::O), FILE_OPEN_INCLUDE);
402402
}
403403

@@ -518,7 +518,7 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
518518
shader_create_dialog->config(base_path.path_join("new_shader"), false, false, 2);
519519
shader_create_dialog->popup_centered();
520520
} break;
521-
case FILE_OPEN: {
521+
case FILE_OPEN_: {
522522
InspectorDock::get_singleton()->open_resource("Shader");
523523
} break;
524524
case FILE_OPEN_INCLUDE: {

editor/plugins/shader_editor_plugin.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ class HBoxContainer;
4444
class VisualShaderEditor;
4545
class WindowWrapper;
4646

47-
#ifdef MINGW_ENABLED
48-
#undef FILE_OPEN
49-
#endif
50-
5147
class ShaderEditorPlugin : public EditorPlugin {
5248
GDCLASS(ShaderEditorPlugin, EditorPlugin);
5349

@@ -64,7 +60,7 @@ class ShaderEditorPlugin : public EditorPlugin {
6460
enum {
6561
FILE_NEW,
6662
FILE_NEW_INCLUDE,
67-
FILE_OPEN,
63+
FILE_OPEN_,
6864
FILE_OPEN_INCLUDE,
6965
FILE_SAVE,
7066
FILE_SAVE_AS,

editor/plugins/visual_shader_editor_plugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,7 +4900,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
49004900
popup_menu->set_item_disabled(NodeMenuOptions::CUT, selected_deletable_graph_elements.is_empty());
49014901
popup_menu->set_item_disabled(NodeMenuOptions::COPY, selected_deletable_graph_elements.is_empty());
49024902
popup_menu->set_item_disabled(NodeMenuOptions::PASTE, copy_buffer_empty);
4903-
popup_menu->set_item_disabled(NodeMenuOptions::DELETE, selected_deletable_graph_elements.is_empty());
4903+
popup_menu->set_item_disabled(NodeMenuOptions::DELETE_, selected_deletable_graph_elements.is_empty());
49044904
popup_menu->set_item_disabled(NodeMenuOptions::DUPLICATE, selected_deletable_graph_elements.is_empty());
49054905
popup_menu->set_item_disabled(NodeMenuOptions::CLEAR_COPY_BUFFER, copy_buffer_empty);
49064906

@@ -6042,7 +6042,7 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) {
60426042
case NodeMenuOptions::PASTE:
60436043
_paste_nodes(true, menu_point);
60446044
break;
6045-
case NodeMenuOptions::DELETE:
6045+
case NodeMenuOptions::DELETE_:
60466046
_delete_nodes_request(TypedArray<StringName>());
60476047
break;
60486048
case NodeMenuOptions::DUPLICATE:
@@ -6713,7 +6713,7 @@ VisualShaderEditor::VisualShaderEditor() {
67136713
popup_menu->add_item(TTR("Cut"), NodeMenuOptions::CUT);
67146714
popup_menu->add_item(TTR("Copy"), NodeMenuOptions::COPY);
67156715
popup_menu->add_item(TTR("Paste"), NodeMenuOptions::PASTE);
6716-
popup_menu->add_item(TTR("Delete"), NodeMenuOptions::DELETE);
6716+
popup_menu->add_item(TTR("Delete"), NodeMenuOptions::DELETE_);
67176717
popup_menu->add_item(TTR("Duplicate"), NodeMenuOptions::DUPLICATE);
67186718
popup_menu->add_item(TTR("Clear Copy Buffer"), NodeMenuOptions::CLEAR_COPY_BUFFER);
67196719
popup_menu->connect(SceneStringName(id_pressed), callable_mp(this, &VisualShaderEditor::_node_menu_id_pressed));

editor/plugins/visual_shader_editor_plugin.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,13 @@ class VisualShaderEditor : public ShaderEditor {
328328
PASTE_PARAMS_TO_MATERIAL,
329329
};
330330

331-
#ifdef MINGW_ENABLED
332-
#undef DELETE
333-
#endif
334-
335331
enum NodeMenuOptions {
336332
ADD,
337333
SEPARATOR, // ignore
338334
CUT,
339335
COPY,
340336
PASTE,
341-
DELETE,
337+
DELETE_, // Conflict with WinAPI.
342338
DUPLICATE,
343339
CLEAR_COPY_BUFFER,
344340
SEPARATOR2, // ignore

0 commit comments

Comments
 (0)