Skip to content
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

Window repetedly minimizes and focuses itself right after back from sleep #15279

Open
AadneEM opened this issue May 3, 2023 · 3 comments
Open
Labels
Area-Windowing Window frame, quake mode, tearout Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Milestone

Comments

@AadneEM
Copy link

AadneEM commented May 3, 2023

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.0

Other Software

No response

Steps to reproduce

This happens infrequently. But always right as I come back to the PC and unlock it. Haven't been able to determine if there is anything specific that triggers it.

Expected Behavior

That the window maintains the previous state

Actual Behavior

The window rapidly and repetedly minimizes and "unminimizes" itself, no matter what other window was in focus

@AadneEM AadneEM added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 3, 2023
@zadjii-msft
Copy link
Member

A theory: if you've got a display port monitor, on Windows 11, then when the PC goes to sleep, then the OS will disconnect that display. And, when a display gets removed, the windows on it will get minimized.

We think there's a race somewhere between the Terminal's own HWND and the hidden conpty hwnd that's stuck in a loop here. One thinks it should be minimized, the other thinks it should be restored, and the two get stuck in a loop.

What we're not totally sure about is how to mitigate that loop...

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Area-Windowing Window frame, quake mode, tearout and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 3, 2023
@zadjii-msft zadjii-msft added this to the Terminal v1.19 milestone May 3, 2023
@lhecker
Copy link
Member

lhecker commented May 3, 2023

...one option would be to assume that any time we do a ShowWindow inside conhost on the hidden hwnd, the message will 100% arrive the loop immediately. We could then ignore that message. The problem is the question what happens if the user sends a show message followed by a hide message in between us sending ours. In that case we'd ignore the show message. But I feel like that this doesn't really matter, since the show/hide order between WT showing/hiden and the console application showing/hiding is a race condition already anyways.

@zadjii-msft zadjii-msft modified the milestones: Terminal v1.19, Backlog Oct 4, 2023
@zadjii-msft zadjii-msft added the Help Wanted We encourage anyone to jump in on these. label Oct 4, 2023
@xpalidotious
Copy link

I'm occasionally having a similar problem (although #17616 which was closed as a dupe of this issue is a better description of the problem I'm having).

I've only had the issue a few times, but in each case it occurred when I had a large number of open tabs (probably 140 tabs in the most recent case). I've always noticed that minimizing or restoring terminal once I've been running it for a while and have a large number of tabs open is very slow and can cause issues if I get impatient and click the taskbar icon more than once.

I've just tried to re-create the problem and had success by simply opening a large number of Windows command prompt tabs and rapidly clicking the Terminal icon on the taskbar a few times.

The first time I deliberately triggered the issue I had opened 132 tabs. I closed the program and tried to replicate the issue with fewer open tabs. With just over 40 open tabs I couldn't trigger the issue, so I opened a few more and tried again - this time with just over 60 open tabs a few rapid clicks on the taskbar icon instantly triggered the issue.

Hopefully someone can use this information to replicate the issue and fix the problem, because losing over a hundred open tabs is not fun at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout Help Wanted We encourage anyone to jump in on these. Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

4 participants