Skip to content

Commit 55e04d5

Browse files
authored
Disable the process creation cursor animation by default (#14293)
1 parent 63fa9f3 commit 55e04d5

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/windows/common/SubProcess.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ std::wstring ReadFileContent(wil::unique_hfile& Handle)
4646
}
4747
} // namespace
4848

49-
SubProcess::SubProcess(LPCWSTR ApplicationName, LPCWSTR CommandLine, DWORD Flags) :
50-
m_applicationName(ApplicationName), m_commandLine(CommandLine), m_flags(Flags)
49+
SubProcess::SubProcess(LPCWSTR ApplicationName, LPCWSTR CommandLine, DWORD Flags, DWORD StartupFlags) :
50+
m_applicationName(ApplicationName), m_commandLine(CommandLine), m_flags(Flags), m_startupFlags(StartupFlags)
5151
{
5252
}
5353

@@ -159,7 +159,7 @@ wil::unique_handle SubProcess::Start()
159159

160160
STARTUPINFOEX StartupInfo{};
161161
StartupInfo.StartupInfo.cb = sizeof(StartupInfo);
162-
StartupInfo.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
162+
StartupInfo.StartupInfo.dwFlags = STARTF_USESTDHANDLES | m_startupFlags;
163163

164164
// N.B. Passing a pseudoconsole requires all standard handles to be null
165165
if (m_pseudoConsole == nullptr)

src/windows/common/SubProcess.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SubProcess
2929
std::wstring Stderr;
3030
};
3131

32-
SubProcess(LPCWSTR ApplicationName, LPCWSTR CommandLine, DWORD Flags = CREATE_UNICODE_ENVIRONMENT);
32+
SubProcess(LPCWSTR ApplicationName, LPCWSTR CommandLine, DWORD Flags = CREATE_UNICODE_ENVIRONMENT, DWORD StartupFlags = STARTF_FORCEOFFFEEDBACK);
3333

3434
void SetStdHandles(HANDLE Stdin, HANDLE Stdout, HANDLE Stderr);
3535
void SetPseudoConsole(HPCON Console);
@@ -58,6 +58,7 @@ class SubProcess
5858
LPCWSTR m_desktop = nullptr;
5959
HANDLE m_token = nullptr;
6060
DWORD m_flags = 0;
61+
DWORD m_startupFlags = 0;
6162

6263
HANDLE m_stdIn = nullptr;
6364
HANDLE m_stdOut = nullptr;

src/windows/common/interop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ CreateProcessResult CreateProcess(_In_ CreateProcessParsed* Parsed, _In_ HANDLE
194194
wsl::windows::common::helpers::SetHandleInheritable(StdOut);
195195
wsl::windows::common::helpers::SetHandleInheritable(StdErr);
196196

197-
wsl::windows::common::SubProcess process(Parsed->ApplicationName.c_str(), Parsed->CommandLine(), CREATE_UNICODE_ENVIRONMENT);
197+
// N.B. Passing StartupFlags = 0 so that the cursor feedback is set to its default behavior.
198+
// See: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
199+
wsl::windows::common::SubProcess process(Parsed->ApplicationName.c_str(), Parsed->CommandLine(), CREATE_UNICODE_ENVIRONMENT, 0);
198200

199201
CreateProcessResult Result{};
200202
if (Parsed->CreatePseudoconsole)

0 commit comments

Comments
 (0)