Merge pull request #55967 from bruvzg/wt💩3
This commit is contained in:
commit
62b181a4ef
2 changed files with 20 additions and 3 deletions
|
@ -2247,11 +2247,25 @@ bool OS_Windows::is_window_focused() const {
|
|||
return window_focused;
|
||||
}
|
||||
|
||||
bool OS_Windows::_is_win11_terminal() const {
|
||||
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
DWORD dwMode = 0;
|
||||
if (GetConsoleMode(hStdOut, &dwMode)) {
|
||||
return ((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void OS_Windows::set_console_visible(bool p_enabled) {
|
||||
if (console_visible == p_enabled)
|
||||
return;
|
||||
ShowWindow(GetConsoleWindow(), p_enabled ? SW_SHOW : SW_HIDE);
|
||||
console_visible = p_enabled;
|
||||
|
||||
if (!_is_win11_terminal()) {
|
||||
// GetConsoleWindow is not supported by the Windows Terminal.
|
||||
ShowWindow(GetConsoleWindow(), p_enabled ? SW_SHOW : SW_HIDE);
|
||||
console_visible = p_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
bool OS_Windows::is_console_visible() const {
|
||||
|
@ -2858,7 +2872,8 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
|
|||
}
|
||||
|
||||
DWORD creation_flags = NORMAL_PRIORITY_CLASS & CREATE_NO_WINDOW;
|
||||
if (p_path == get_executable_path() && GetConsoleWindow() != NULL) {
|
||||
if (p_path == get_executable_path() && GetConsoleWindow() != NULL && _is_win11_terminal()) {
|
||||
// Open a new terminal as a workaround for Windows Terminal bug.
|
||||
creation_flags |= CREATE_NEW_CONSOLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,6 +371,8 @@ class OS_Windows : public OS {
|
|||
|
||||
CrashHandler crash_handler;
|
||||
|
||||
bool _is_win11_terminal() const;
|
||||
|
||||
void _drag_event(float p_x, float p_y, int idx);
|
||||
void _touch_event(bool p_pressed, float p_x, float p_y, int idx);
|
||||
|
||||
|
|
Loading…
Reference in a new issue