terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Graphic artifacts (small gray squares) on the desktop when the window is minimized

Open thomaslevesque opened this issue 2 years ago • 28 comments

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.1555

Other Software

No response

Steps to reproduce

I'm not sure exactly when it happens. I use WT without issues, and after a while I notice the glitch; not sure what makes it appear. Once it starts appearing, it stays.

Expected Behavior

There should be no graphic artifacts on the desktop when I minimize or restore the window.

Actual Behavior

Whenever I minimize the window, small gray squares appear just above the taskbar:

image

The gray squares are only visible on the desktop. If any window masks that part of the desktop, they don't appear (in other words, they appear below all windows, with the lowest z-index).

Their number seems to match the number of open tabs in WT, although it's a bit inconsistent.

When I restore the window, I see just one small gray square in the top left corner of the screen:

image

It also appears below all windows except the WT window (i.e. when the WT window is maximized I still see the square in its top-left corner, but any other window masks it).

thomaslevesque avatar Apr 21 '23 00:04 thomaslevesque

Hey, do you happen to have "mica4all" or "mica everywhere" (I can't remember the name!) installed?

DHowett avatar Apr 21 '23 01:04 DHowett

@DHowett no, never heard of it.

thomaslevesque avatar Apr 21 '23 01:04 thomaslevesque

This sounds very much like the bug i'm reporting too (picture below).

I posted a video of it on youtube:

https://youtu.be/UfArtJ9bbB8

Does yours behave in a similar manner?

https://github.com/microsoft/terminal/issues/15536#issuecomment-1587351533

image

ClaireCJS avatar Jun 12 '23 15:06 ClaireCJS

Not exactly. I just see small grey squares, not rectangles like in your screenshot. Might be related, though. (haven't seen this in a while btw, maybe it's been fixed?)

thomaslevesque avatar Jun 13 '23 01:06 thomaslevesque

Not exactly. I just see small grey squares, not rectangles like in your screenshot. Might be related, though. (haven't seen this in a while btw, maybe it's been fixed?)

Interesting. If you look at my white rectangles, the right edge of them is a grey square - so it seems related, but different?

ClaireCJS avatar Jun 13 '23 03:06 ClaireCJS

If someone's still seeing this regularly, it might be helpful to know what the actual window class for that window is (with like, spyxx or winspy). I'd guess that it's either:

  • PseudoConsoleWindow
  • DesktopWindowXamlSource

and which one it is would really change my theory of the root cause.

Also, knowing what version you're on would also help. If it's a xaml island window (for some reason), then 1.18 probably changed the way this presents itself.

zadjii-msft avatar Sep 20 '23 16:09 zadjii-msft

A thought: why are we using WS_OVERLAPPEDWINDOW instead of WS_OVERLAPPED..?

zadjii-msft avatar Sep 20 '23 16:09 zadjii-msft

If someone's still seeing this regularly

I am. I hate it so much and it plagues me every day, but it's better than not using Windows Terminal and not even being able to see filenames with emoji & unicode in them. I hate hate hate hate hate hate hate it.

it might be helpful to know what the actual window class for that window is (with like, spyxx or winspy).

Okay! It seems Winspy is discontinued and now there's something called WinSpy++ that's basically the same thing.

I'd guess that it's either:

  • PseudoConsoleWindow
  • DesktopWindowXamlSource

and which one it is would really change my theory of the root cause.

The classname is actually SHELLDLL_DefView. Seems to be associated with...explorer.exe?!?!?!

None of this happened for years (30yrs of that command line, 2 yrs of that command line on the same machine) until I installed Windows Terminal, then it happened, and always happened, consistently... Even if I ran my TCC/TakeCommand (jpsoft.com) command line without Windows Terminal wrapped around it. I'm pretty sure at some point I even tried uninstalling Windows Terminal, but nope, so I reinstalled it. It's quite perplexing and I'd love to get to the bottom of it.

Also, knowing what version you're on would also help. If it's a xaml island window (for some reason), then 1.18 probably changed the way this presents itself.

Which version of windows terminal? 1.17.11461.0 I'm really limited by what's in the app store. I've failed to build it on my own and decided that's not an endeavor suited to me. However, I'd happily try a precompiled build of a later version if someone would supply it to me. [Windows 10.0.19045.3393]

Here's more info. I really wish WinSpy++ had a text-dump functionality to avoid awkward screenshotting:

image

image

image

image

image

image

ClaireCJS avatar Sep 20 '23 16:09 ClaireCJS

SHELLDLL_DefView

what the fishsticks is that? I've literally never heard of that, and it's for sure not something the Terminal is making ourselves.

zadjii-msft avatar Sep 20 '23 16:09 zadjii-msft

Wait hold up - what's the class of the teeny tiny window: image

not the one that's seemingly appearing by the taskbar. There's... a lot of shell customizations you got going on there. I wouldn't be surprised if it was some weird combo of all those running together.

But that tiny white rectangle - that's the one I am pretty sure is caused by us

zadjii-msft avatar Sep 20 '23 17:09 zadjii-msft

There's no customizations I weren't running for at least 10 years before the day I installed windows terminal, and minimizing and un-minimizing windows terminal windows are what cause these to display.

I've had a unified constantly developed personal command line since the 1980s. It did not break until the day (technically, the minute) windows terminal came along.

This does not happen on any of the other machines where I use the exact same customizations without windows terminal.

Turning displayfusion off (which adds some buttons on window taskbars) does not change this.

ClaireCJS avatar Sep 20 '23 17:09 ClaireCJS

Anyway, those screenshots were from the tiny black square that isn't near the taskbar.

I'll happily gather screenshots of the ones by the taskbar too, if that helps!

ClaireCJS avatar Sep 20 '23 17:09 ClaireCJS

what the fuck

minimized-phwnd

okay, so there's a good chance the PseudoConsoleWindow is moving there when it's minimized. why tho

zadjii-msft avatar Sep 20 '23 17:09 zadjii-msft

Is this a eureka moment? There's a lot I understand, but there's more I don't understand, including a lot of what's going on here! :)

ClaireCJS avatar Sep 20 '23 17:09 ClaireCJS

not really. If you've got winspy++ screenshots of what that rectangle looks like on your machine, that'll be helpful. I can't seem to find a combo of flags to turn on to make it become visible[^1] on my machine.

[^1]: I mean, yea the window is WS_VISIBLE, but I mean like, visible to a human / rendered to the screen. Maybe this is some weird transparency thing?

zadjii-msft avatar Sep 20 '23 17:09 zadjii-msft

I can do that.

Well, they look like this:

image

[winspy screenshots coming next comment]

ClaireCJS avatar Sep 20 '23 17:09 ClaireCJS

Here's the Winspy++ screenshots:

image

image

image

image

image

image

ClaireCJS avatar Sep 20 '23 17:09 ClaireCJS

Well, a couple curious things there:

  • There's no owner, so this isn't the conpty window. That's clear from the Class not being PseudoConsoleWindow, but that makes me think it's unrelated to us.
  • It's 3072x1728 px big? That's not the window we're looking for, that's for sure. It might be the desktop?
    • Actually, looks like the first screenshots you shared were for the same window handle.

Looks like it was a miss on the finder, for whatever reason.

Here's an idea though: if you go into WinSpy++, then hit More >>, you should be able to find a cmd.exe (or tcc.exe or whatever the shell is), with a pseudoconsolewindow underneath it (after double-clicking). Hit the Autoupdate button, and see how that window reacts to the Terminal restoring and being minimized. The Flash button is also helpful for ID'ing where on the screen a window should be (it will flash the bounds of a window even if the window isn't visible).

Once you've got a lock on the right pseudoconsolewindow, share those screenshots?

zadjii-msft avatar Sep 20 '23 19:09 zadjii-msft

3072x1728? That's... not even the resolution of the desktop i'm dropping the finder on, it's a 1920x1080 desktop. 3 out of 4 of mine are. It's probably some combination of my 4 displays (31080p + 1VGA).

Yes, it appears that it's missing actually. And I missed that it was missing. oof

ClaireCJS avatar Sep 20 '23 19:09 ClaireCJS

Here's an idea though: if you go into WinSpy++, then hit More >>, you should be able to find a cmd.exe (or tcc.exe or whatever the shell is), with a pseudoconsolewindow underneath it (after double-clicking). Hit the Autoupdate button, and see how that window reacts to the Terminal restoring and being minimized. The Flash button is also helpful for ID'ing where on the screen a window should be (it will flash the bounds of a window even if the window isn't visible).

Once you've got a lock on the right pseudoconsolewindow, share those screenshots?

Well, it's kind of hard to share the screen of the flash function flashing, but basically...

image

  1. Flashing the entire TCC flashes a square with the size and placement that is approximately the default size and placement TCC comes up with, when it starts on my screen. And it always starts on the same monitor, even if my taskbar shortcuts are on different monitors. TCC before Windows Terminal when launched directly did not behave that way.

I'm starting to think Windows Terminal and multiple monitors and moving TCC to a different monitor somehow is causing some sort of disconnect where TCC might have leftover aspects of its windows in the original monitor from where it was moved from (and originally opened into) (i.e. primary monitor).

  1. Flashing 002416B0 TCC.EXE "TCC:c658" captured the upper-left square and about 3 more square's width to the right. Small rectangle.

  2. Flashing 07442Dc2 PsuedoConsoleWindow captured the upper-left square and a few pixels to the left of it.

  3. Flashing Default IME - i see nothing

I'm staring to think this is specific to how Windows Terminal interacts with TCC when TCC is moved to another monitor. I have thought it behaved strange, but not quite been able to put my finger on it.

ClaireCJS avatar Sep 20 '23 19:09 ClaireCJS

Okay, maybe we've been tying two related but ultimately separate things here.

Quick way to separate these out: @ClaireCJS Do you see the same behavior without any tcc.exe tabs? Just a plain-old PowerShell or Command Prompt tab. Let's eliminate one variable here.


We definitely do have reports of the tiny, top-left square without TCC, but this may be exacerbated by it. I'm tempted to switch to

diff --git a/src/interactivity/base/InteractivityFactory.cpp b/src/interactivity/base/InteractivityFactory.cpp
index fe8fc55cd..4e675cb85 100644
--- a/src/interactivity/base/InteractivityFactory.cpp
+++ b/src/interactivity/base/InteractivityFactory.cpp
@@ -330,8 +330,8 @@ using namespace Microsoft::Console::Interactivity;
                 // will return the console handle again, not the owning
                 // terminal's handle. It's not entirely clear why, but WS_POPUP
                 // is absolutely vital for this to work correctly.
-                const auto windowStyle = WS_OVERLAPPEDWINDOW | WS_POPUP;
-                const auto exStyles = WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE;
+                const auto windowStyle = WS_OVERLAPPED | WS_POPUP;^M
+                const auto exStyles = WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE;^M

                 // Attempt to create window.
                 hwnd = CreateWindowExW(exStyles,

But I need to sync with my user32 contact before I'd feel comfortable with that. It seems to remove the size when it's restored (the tiny rectangle), but not the tiny one....

zadjii-msft avatar Sep 20 '23 19:09 zadjii-msft

Oh, it's definitely TCC+Windows Terminal specific. I think it was phrased that way on it's own issue but then my issue got merged/mentioned into this issue since they're the same thing with apparently two different causes.

But yea, to answer your question, it doesn't happen with powershell tabs

but it also doesn't happen when TCC is run without windows terminal

I suspect TCC is doing something weird and nonstandard and Windows Terminal isn't detecting something it meant to detect correctly. It's kind of been the broad pattern.

ClaireCJS avatar Sep 20 '23 20:09 ClaireCJS

Oh butts you're right, there's a whole other thread for that.

I'm gonna de-merge them, move relevant comments over, and collapse things in this thread. Thanks for bearing with me ☺️

zadjii-msft avatar Sep 20 '23 20:09 zadjii-msft

How did I miss

(haven't seen this in a while btw, maybe it's been fixed?)

Well then. I'm going to tenuously mark this Fixed?, and give the community till the end of 1.20 to find a repro. If we don't hear anything, I'm gonna go ahead and say this was magically fixed along the way.

If anyone DOES end up with a repro for this specifically[^1], then a Task Manager dump of OpenConsole.exe (NOT WindowsTerminal.exe) might be enlightening.

[^1]: not the TCC thing tracked in #15536

zadjii-msft avatar Sep 26 '23 20:09 zadjii-msft

Sounds good to me. If I see it again, I'll let you know.

thomaslevesque avatar Sep 27 '23 02:09 thomaslevesque

This happens concistently still for me. I have reformatted and reinstalled windows 11 several times (Windows 11 Pro) on a modern and powerful laptop from Lenovo. I did not experience this on my previous laptop which was a Windows Surface Book 2.

Windows terminal: Version: 1.18.3181.0

Laptop info: Processor13th Gen Intel(R) Core(TM) i9-13905H 2.60 GHz Installed RAM 64,0 GB Version Windows 11 Pro Version 23H2 Installed on ‎06.‎01.‎2024 Operating system build 22631.3007 Experience Windows Feature Experience Pack 1000.22681.1000.0

I have noticed these squares appear in the same way as described above after WSL ubuntu terminal being open over night or just over a long period of time. I noticed that the squares dissappear after restarting the PC. Once I noticed the squares dissappeared after running "wsl" in powershell as it seemed like WSL had turned itself off over night. Perhaps the root cause is WSL not gracefully shutting down while terminal windows are still open and the laptop is hibernation mode.

If possible, tell me if there is anything I can do to fix this.

EDIT: I will update this comment or make a new one when it happens again with the task manager dump. If possible, give me a step by step on how to do that if it is something specific as I have not done that before.

EDIT 2: I generated a DMP file for windows terminal when the squares returned again. It is 900 mb. What is the best way to share this info?

ShakoFarhad avatar Jan 19 '24 09:01 ShakoFarhad

@ShakoFarhad Sorry I missed that! You should be able to share that with the team following these steps: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#share-with-the-team

Is it a dump of windowsterminal.exe, or openconsole.exe? We're pretty confident the squares are due to openconsole.exe, (which Terminal uses)

zadjii-msft avatar Feb 07 '24 12:02 zadjii-msft

Seeing this again, for the first time in a while: image

If anyone DOES end up with a repro for this specifically1, then a Task Manager dump of OpenConsole.exe (NOT WindowsTerminal.exe) might be enlightening.

Which one? I have 4 instances of OpenConsole.exe

thomaslevesque avatar Feb 14 '24 16:02 thomaslevesque

image

07/31/2024

jonasmarco avatar Aug 01 '24 00:08 jonasmarco