-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A hypothetical fix for hidden windows #15213
Conversation
We had a report in a mail thread that someone's Terminal windows were getting created hidden, and never showing themselves. As a theory, I'm guessing that dwFlags didn't say that we should actually use `wShowWindow`. So, to be more correct, let's actually obey that. I'm gonna send this package to them to see if it fixes them. Related to #14957. Likely regressed in #13838.
Do you want to wait for validation before reviews or merge? |
@@ -79,7 +79,7 @@ bool WindowEmperor::HandleCommandlineArgs() | |||
// so we can open a new window with the same state. | |||
STARTUPINFOW si; | |||
GetStartupInfoW(&si); | |||
const auto showWindow = si.wShowWindow; | |||
const uint32_t showWindow = WI_IsFlagSet(si.dwFlags, STARTF_USESHOWWINDOW) ? si.wShowWindow : SW_SHOW; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to prefer SW_SHOWDEFAULT
. FYI, SW_SHOWDEFAULT
actually.. wait
wait
SW_SHOWDEFAULT
is supposed to do this entire thing (check the flag, use wShowWindow
if it's set, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now i'm curious, why was SHOWDEFAULT not working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably, because we'd collect the wShowWindow
here, and eventually plumb it into the ShowWindow
call in AppHost::_WindowInitializedHandler
, regardless of what the actual dwFlags
said. So if the wShowWindow
was set to 0
, then we'd hide the window even if the flags didn't call for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I've got a couple other questions about this whole kit and/or kaboodle.
So, okay. This happens when a commandline comes in.
Can you walk me through what happens in these scenarios?
- Terminal is not running, and you run
wt
- Terminal is not running, and you run
start /min wt
- Terminal is running, and you run
wt
- Terminal is running, and you run
start /min wt
- Terminal is running in Attach to most recent window mode, and you run
start /min wt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. whose nShowCmd
/wShowWindow
are we using? The one from the receiving process, or the sending process?
- Terminal is not running, and you run
start /min wt
, and then you runstart /max wt -w -1
or juststart wt -w -1
- Would the new window get the incoming
wShowWindow
, or would it get the one of the original WT instance started with/min
?
- Would the new window get the incoming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Terminal boots. Looks at its combined
si.dwFlags
andsi.wShowWindow
, sticks that into theRemoting::CommandlineArgs
. That's given to theAppHost
, who uses that in the post-init call toShowWindow
(unlesslaunchMode
is set to*maximized*
) - Same deal as 1. Here,
si.dwFlags
+si.wShowWindow
-->SW_SHOWMINIMIZED
- Terminal boots. Looks at its combined
si.dwFlags
andsi.wShowWindow
, sticks that into theRemoting::CommandlineArgs
. Those get remoted to the monarch. They hand them off to theAppHost
created for this window. ThatAppHost
, uses that in the post-init call toShowWindow
, just like in 1. - Same deal. We just remote
SW_SHOWMINIMIZED
to the monarch who gives that to the eventual window that gets created - Terminal boots. Looks at its combined
si.dwFlags
andsi.wShowWindow
. FindsSW_SHOWMINIMIZED
. Sticks that in theCommandlineArgs
.ProposeCommandline
's that to the Monarch, who passes it to an existing window. That existing window finds a commandline of"wt"
. Treats that as anew-tab
subcommand. A new tab is opened. The state of the window is unaffected. - Same as 2 ; and then we remote a
SW_MAXIMIZE
in theCommandlineArgs
for the new window, and create a second window with a different state.- yes, the new window gets the startupinfo from the process that initiated the creation of this window.
Sound right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is easily reproducible if you launch Windows Terminal through Nvidia Nsight Systems. The PR fixes the issue for me. 👍
I'm building a Release signed msix for our internal friend to try out, but Leonard's comment is promising |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VER I FIED
We had a report in a mail thread that someone's Terminal windows were getting created hidden, and never showing themselves.
As a theory, I'm guessing that dwFlags didn't say that we should actually use
wShowWindow
. So, to be more correct, let's actually obey that.I'm gonna send this package to them to see if it fixes them.
Related to #14957.
Likely regressed in #13838.