On Mar 8, 2013, at 6:20 AM, Joerg-Cyril.Hoehle@t-systems.com Joerg-Cyril.Hoehle@t-systems.com wrote:
I had a very annoying experience: when I started winemac the first time, the whole screen turned black for a fraction of a second. That was very unwelcome and reminded me of the infamous Intel-XOrg screen flickering issue that plagued many Linux distros a few years ago :-(
I have tracked this down.
Unless explorer.exe is launched explicitly, it is launched on demand. Inside user32.GetDesktopWindow() there's a check if the desktop window exists. If it doesn't, then explorer.exe is launched.
There is a race, of course, if multiple processes or threads call GetDesktopWindow() at roughly the same time before the desktop window has been created. All of them start explorer.exe.
Explorer.exe creates a window that it intends to act as the desktop window. It then checks if that window actually became the desktop window. If it doesn't, it figures some other instance of explorer.exe won the race, destroys the window, and exits. Only one of the explorer.exe instances survives and it owns the real desktop window.
The flicker is the prospective desktop window of the losers. The windows are created visible, so they are briefly shown before being destroyed.
(The real desktop window is also created visible but it doesn't usually show unless virtual desktop is enabled under X11. That's because both the Mac and X11 drivers have checks for the desktop window and treat it specially. But only the real desktop window, from the winning explorer.exe, qualifies for that special treatment. The windows from the losers are just normal windows.)
I think the solution is to have explorer.exe create its prospective desktop window hidden and only show it if it wins the race. I'll submit a patch shortly.
-Ken