Date: | March 27, 2006 / year-entry #109 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20060327-16/?p=31773 |
Comments: | 59 |
Summary: | A commenter named "Al" wondered why the window manager couldn't just take over behavior that used to be within the application's purview, such as painting the non-client area, in order to avoid problems with applications not responding to messages promptly enough. If the window manager were being rewritten, then perhaps it could. But to do... |
A commenter named "Al" wondered why the window manager couldn't just take over behavior that used to be within the application's purview, such as painting the non-client area, in order to avoid problems with applications not responding to messages promptly enough. If the window manager were being rewritten, then perhaps it could. But to do it now would introduce many compatibility issues. First, there are many applications that have subtle dependencies on message ordering or receiving certain types of messages at certain times, even though there is no actual guarantee in the specification that such messages be delivered. There are a large number of applications that rely on Second, removing customizability of message behavior from the window manager would prevent programs from customizing their appearance in nonstandard ways. Media players are perhaps the most popular example of programs that want to override normal non-client painting in order to present a totally customized window to the user. Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application? That said, there have been changes to the window manager over the years to maintain this "air of customizability" while simultaneously intervening on behalf of the user to keep things from going completely to the dogs. For example, if a window stops painting for an extended period of time, Windows would take it upon itself to paint the window with a standard caption bar (even if the application wanted to customize the caption bar), just so that the user would be able to see something. Another example of this "message virtualization" is the appending of the phrase "(Not responding)" to the caption of a window that has stopped responding, and capturing the window contents as they were last visible, drawing those captured window contents in the meantime until the application woke up from its slumber, and even allowing you to move, resize, minimize, and close those unresponsive windows. The infrastructure necessary to support this behavior is quite extensive, because the window manager needs to maintain two sets of bookkeeping. The first is, "What the application thinks the window state is"; if the application asks for the size of its hung window, it needs to be told, "Oh, you're still that size you were before, don't you worry your pretty little head", even though the actual window size on the screen has changed significantly. Once the hung window starts responding to messages again, all the activity that happened "while it was away" needs to be replayed to get the window "back up to speed" with the state of the world. Interesting things happen if the program wanted to customize one of the actions that happened to the "virtual window". For example, it might want to reject certain window sizes or display a special message before minimizing. Resolving these conflicts in a manner that doesn't cause applications to crash outright is another of the difficulties of trying to get the virtual and real window states back into sync. In a sense, therefore, the window manager does take over selected behaviors that used to be within the application's purview, but it has to do it in a delicate enough manner that neither the application nor the end user will even realize that it's happening. And that's what makes it hard. |
Comments (59)
Comments are closed. |
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
Frankly, yes.
"If the window manager were being rewritten, then perhaps it could"
Isn’t that exactly what is happening in Vista with the new DWM? Wouldn’t that cause exactly the issues you mention with WM_PAINT messages?
"… as long as programs have to ask for the feature to be activated."
And in fact that’s what they do today. The window manager says, "Time to draw your non-client area" and the app decides, "I want a default look (and calls DefWindowProc)" or "I want a custom look (and draws it manually)". The catch is that the mechanism is procedural rather than declarative.
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
I would be deliriously happy. I can’t stand skinned applications.
Raymond – where is the window manager implemented? If the application is hung and not pumping messages, which process (or thread) is actually responsible for the drawing of the "ghost" window?
Cheers
Matt
"Skins" should be systemwide only. I’d be very happy.
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
YES!
Office 2007 is the latest example of skinning gone too far. Is there NOTHING that can convince them to use standard title bars?!
Why not add a window flag to say "the window manager owns my non-client area"? That way at least new applications could avoid the various problems that result from an application drawing its own frame.
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
Actually, the word I would use is "overjoyed". I can’t tell you how many times I’ve accidentally closed the program underneath Windows Media Player because it thinks cute displaying is better than functional behavior.
I am SICK of skinning, and Vista is just making it worse.
I have two basic types of media I play with Media Players: Audio and movies. Audio is played normally with the window minimized, and movies are played full screen. Who cares what the Media Player looks like?
I did read the rest of the article, I’m just not 100% sure I fully understand it yet. However, I now understand why you get that "Not responding" on some applications and not others when you have something appears to lock up.
I wonder if people who read The Old New Thing tend to like plain rectangular windows. Think outside the box folks! (sorry couldn’t help it)
I think you might be asking the wrong bunch of people about skinning.
The fact that huge segments of your apps’ target audience enjoy "skinning" to the point of ignoring actual functionality might be kind of lost on those people who actually expect their computers to work properly.
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
Hell yes, I hate skinned apps because they never fit with the rest of the system.
Matt: Interesting hypothesis. I also hate application skinning (but don’t mind systemwide skinning, as long as it can be controlled by the user).
PatriotB: Microsoft Office has a very long history of gratuitous deviation from standard OS-provided behavior and apparance for windows and controls. In fact, some Windows UI elements, such as caption gradients and some features of common dialogs, originated in Office. Office 2007 just takes it to new extremes.
Thanks to the Windows team going out of their way not to break poorly written applications developers once again have no incentive to clean up their act and actually write working applications. If an application requires a dummy WM_PAINT not to crash it should be made to crash as soon as possible so the developers go in and fix it before releasing their "code".
I want every program to fit with my windows. I no longer use (really can’t use) office. WinAmp et al have no chance of being installed. I use Mplayer2 far more than WMPlayer.
You forced GUIs down our throats.
However I always felt jealous of Mac’s dialog type apps.
To those answering YES to "Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"…
If that’s the case, why is your favourite madia player one of those "skinny" things? There are alternatives, you know.
Another vote for unskinned apps.
As for XP new controls, they are opt-in – by default, apps get non-Luna comctl32.dll (v5.80). If you want Luna (v6.0), you need to have a manifest saying so.
Rikard: I’m tired of downloading third party apps that sacrifice usability, for "looks good if every window is skinned to within an inch of it’s life".
I want functionality, and the app to respond to keyboard short cuts. Those are my two primary requirements. I really don’t care if the main window is a rectangle, circle, etc. I just wabt it to work.
Seems that some developers priorities are not focused on usability…
"Exterminate!"
No, really I’m not against skinning.
It’s just that a few third party media players I have tried, just don’t conform to the Windows standard. One media player that I evaluated had no obvious "Close" or "Minimize" icons.
In fact the main window was such a bizarre shape that I had no visual feedback as to whether the app could be minimized, or re-sized.
I have no problem with customising window’s apps as long as they are still easily useable.
Stewart
I was very happy to notice these changes occur in the window manager. I can’t stand applications that are so poorly written or so buggy that they stop pumping UI messages, and become completely unresponsive.
As recently as NT 4, if an app stopped pumping messages, you couldn’t even *minimize* the app window, much less move it, or see its caption. Incredibly frustrating.
I hope Avalon has a solid, rational way to deal with applications that are too busy to pay attention to their reason for existing — the user.
I’d like to second Matt Ellis’ question:
http://blogs.msdn.com/oldnewthing/archive/2006/03/27/561924.aspx#561999
Which process takes over non-responsive windows?
Even though window managers and themes aren’t identical technically, their effects are a lot alike. Let themes decide whether applications can be skinned. If a user selects Windows Classic theme, then make the menu bar visible in Windows Media Player. If the user selects Windows XP Unprofessional theme, then continue on with the practices of Windows Media Player, Office 2007, and Vista’s version of Windows Explorer.
Regarding this:
> Another example of this "message
> virtualization" is the appending of the
> phrase "(Not responding)" to the caption of
That seems to work in many cases, but I have doubts. Sometimes Internet Explorer gets itself in a condition where it isn’t responding but the window manager doesn’t detect that, and the bugs mushroom from there. I think sometimes this is related to successfully blocking unwanted popups, but there are still bugs in popup blocking so this might be part of the cause. I think it’s not always the cause though.
> The infrastructure necessary to support this
> behavior is quite extensive, because the
> window manager needs to maintain two sets of
> bookkeeping.
And there seem to be bugs in it. Again with the example of Internet Explorer, if the user happens to close the correct (i.e. incorrect) IE Window then suddenly all the other windows wake up, their messages get replayed, and the system is responsive again. But if the problem didn’t originate in Internet Explorer, or maybe if it did originate in IE but originated differently from the other cases, then there is no recovery. Kill every window in the system, get 30 instances of dumprep.exe visible in Task Manager, but eventually all the dumprep.exe and drwatson.exe processes just exit and the system still isn’t doing anything. It seems the window manager is in such bad shape that windows cannot even be opened to offer to send bug reports to Microsoft. The Task Manager is still responsive and its Shutdown command can be invoked, but it doesn’t work. Usually the power button is the only solution. One time I noticed around 100 bug reports in a temp directory that had been created but not sent because of these bugs prevented reporting themselves.
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
Yes. OH GOD, yes. I use Winamp for its features and the vast set of available plugins, but the skins drive me nuts.
I know I’m going to come over as a curmudgeon for saying this, but apps *should not* be able to ‘skin’ themselves by painting their own title bars, etc. etc.
Whatever happened to UI consistency?
Apps like Trillian, Winamp, QuickTime, Media Player, IP Office etc. etc. are visually horrible; they disobey all the UI theme & style choices made by the user, impose their own often awkward & poorly researched widgets & UI paradigms, and don’t gel visually with the rest of the apps on the system.
Application skinning is roughly equivalent to children with crayons scrawling on walls. Sure, you’re customising your environment, but is it worth it? :-)
Apparently there is some nontrivial number of people who *like* skinning their music player because the web is crawling with them. Or is your response to these people, "No, you’re all wrong. You should not be allowed to customize how your program looks. Resistance is futile."
I’ve found it an interesting difference between Windows and X, that in Windows the window decorations seem to be part of the window, so if it goes nonresponsive you frequently aren’t able to move the window at all. Whereas in X you don’t get the busy cursor over the titlebar, only inside it, so you can still move them about even if they’re not repainting.
This would be quite nice when I decide I want to move Enterprise Manager during one of it’s little sulks when I want to get a database list from a remote server.
PS. I second Arlie’s comment: Why did Microsoft create an engine to skin the entire system, but restrict anyone else from writing skins for it?
The fix is a (presumably) trivial change to uxtheme.dll, but why force users to go through that?
Consider this another vote AGAINST skinning. And I’m also voting for a lot of friends and family who also find highly "skinned" apps to be extremely hard to use. These apps are totally inconsistent with the rest of the GUI and other "normal" applications, and in general just look horrible, and are difficult and confusing to use.
The worst offenders seem to be media players, especially DVD players. They are very difficult to use, especially with a keyboard. In fact, most of them have *horrible* support for navigating with a keyboard.
Why does Microsoft make it difficult or impossible to provide *system-wide* skins? There are a lot of useful, usable XP themes / skins out there, that actually improve the usability of the OS and all apps, in a clear, consistent way. Most of them are crap, of course, but some of them are really good. Why did MS spend all of the time to develop a fairly good themes architecture, and then seal it away from users?
Um, why don’t we all ask the authors of WinAMP and Office, to provide skins that look just like Windows Classic? I would use them in a heartbeat!
The problem with skins is just like the Web: everybody does it differently. Works great if you like the Flashy stuff, or if you use "standard out of box" configuration, but woe to anyone who’s customized their desktop so it’s more palatable to their older eyes.
Adam G,
Winamp’s plugin API is so simple that it has been implemented in various other media players. I seem to remember there being one that used native GUI widgets but supported Winamp plugins. All it takes is responding to a few non-standard window messages and, in the case of the DSP/viz plugins, pumping data into a callback function.
The only stuff that doesn’t work is the stuff where the plugin makes use of the fact that it’s running in Winamp’s process by screwing with Winamp’s own windows, which is of course frowned apon anyway.
me: "Either this says something about Microsoft, the theme authors, or both."
Oops, being incorrectly overly correct there… but you get the idea.
So people usually flame MS on Raymond’s blog for removing their choices. Now, with allowing apps to be skinned, people are flaming MS because those people themselves made a choice to download a skinned app but not pick a skin they want ("Good" skinnable apps ship with a "classic $OS" skin, ideally as the default skin).
So what is it? Do you want choice or not?
"Apparently there is some nontrivial number of people who *like* skinning their music player because the web is crawling with them."
Now, ain’t that the truth? People do indeed demand the flashy surface stuff, and give little thought to what it costs them underneath; this doesn’t prevent them, however, from complaining bitterly about the cost after the fact. Think of all the people that install 20-30 "system tray utilities", and then complain about their system startup time.
Raymond, here’s a question: if every problem with Windows ever could magically be fixed by actively preventing all skinning, do you suppose that Microsoft would give up the market share represented by that "nontrivial number"? This is not directed at you personally, of course.
2 oldnewthing:
Is there any recomendations where one must put any delayd computations?
If it is not WM_PAINT? Should it be ON_ACTIVATE or just a timer set for a second etc.
How about the case when window is not destroyed but need to be re-shown with different content every time?
ps. Thanks for this article! It was helpful.
Everybody looking for a good non-skinned media player, check out "Media Player Classic". It looks like the old MP6.4, but is 100 times more advanced: http://sourceforge.net/projects/guliverkli/
"Would you be happy if a change to Windows meant that you could no longer "skin" your favorite media player application?"
Oh yes. yes yes yes! This would make me soo bloody happy I’d cry.
Ive never understood why media player applications *need* to be skinned. If I am going to skin apps at all, I want them applied to all apps on my desktop.
Wasn’t XP meant to do skins anyway?
> Would you be happy if a change to Windows meant
> that you could no longer "skin" your favorite media
> player application?
Oh, I would be so deliriously happy! In fact, my favorite media player application is not skinnable. It emphasizes functionality and usability over fluff.
Yesterday, I had to change the message display plugin in my favorite instant messenger. The straw that broke the camel’s neck was that in the new version of the plugin I used before *the windows started to drop shadows*. Now, if I want shadows, I want them *everywhere*, not in specific windows of a specific application.
The first thing I do after reinstalling Windows XP is turn off the theming. Because it makes console windows inconsistent with the rest of the system. Because it imposes on me the colors I find annoying and the shapes I dislike. Because *I am not in control* — and being in control of my own computer is one thing I value very much.
I guess I won’t be upgrading to Office 2007…
Jorge Coelho "…you actually WANT your stuff to look and behave differently from the standard. If you don’t, then you have no business using a skinnable application."
Could that statement possibly be more arrogant? If I use an application, it’s because it is the best way available for me to accomplish my goals. If it happens to be skinnable, but chooses to annoy me by preventing me from making it look and behave the SAME as the rest of my system, then I have /every/ business continuing to use that application, and I also have /every/ business giving the developers grief to allow me to turn off skinning.
Personally, I use VLC as a media player, because it’s more capable and usable than any other I’ve tried. I’m just fortunate that by default, it uses the standard windows look-n-feel. Skinning is available, but not pushed at you. It’s like mplayer2 but even more visually basic :)
And I’ll third the question: what process deals with the window management of hug windows? I’m guessing explorer.exe?
"As for XP new controls, they are opt-in – by default, apps get non-Luna comctl32.dll (v5.80). If you want Luna (v6.0), you need to have a manifest saying so."
afaik, there are more tricks then that: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/functions/setwindowtheme.asp
"PS. I second Arlie’s comment: Why did Microsoft create an engine to skin the entire system, but restrict anyone else from writing skins for it?
The fix is a (presumably) trivial change to uxtheme.dll, but why force users to go through that?"
I bet that’s because it’s more ok for apps to break their own UI, then for one app or theme to break every other apps UI. I’ve tried many themes on the web, and most of them break one or more of the following:
-Terminal Services
-Fast User Switching
-Proper window decoration for every type of frame
-Undetermined progress bars
-The taskbar (some weird bugs on really broken themes)
1 and 2 depend on the video driver (vesa vs ATi or nVidia), so the authors never even realised.
Either this says something about Microsoft, the theme authors, or both.
Microsoft ofcourse needs to keep skinning support enabled, because there are ISV’s that have "company branded" their apps with skins, the Norton apps for instance are always yellow. I don’t like any of those skins, but getting rid of them is harder then keeping them. Though Microsoft perhaps make things worse by setting the example. I bet it’s the marketing layer on top that you see. just like the Nortons. So now MSIE (7), WMP, MSN * (explorer, messenger), Office, the control panel, system restore, the security center and others that i can’t think of atm, are all skinned. Ugliest thing ever is the Microsoft Calculator Plus. And it *does* break standard UI, just try right clicking the titlebar. What titlebar? There is none!
Wow. So there are a lot of ‘old timers’ here, judging my the general anti-skinning reaction. :-) I’m an old timer myself, but I’m also the developer of skinnable applications, so be warned! ;-)
This said, I agree 100% with that MAJOR problem with skinned applications is that all the usability *you were used to* goes to hell. Put someone used to Windows suddenly working on a skinnable alternate shell and he will be totally lost at what to do next.
HOWEVER, this is also the the whole point of skinning: Windows customization. And since customization is a *personal* thing, this means you actually WANT your stuff to look and behave differently from the standard. If you don’t, then you have no business using a skinnable application.
Now, skinnable applications are divided into two categories: those which go for eye candy alone and those that also add functionality to a system.
The problem is when you want the extra functionality without the customization part (e.g.; the case with Media Players). This is where I think that it is the responsability of the skinnable application authors to provide a skin that is as completely compatible with the OS as possile. After all the application is skinnable, so it should be able to emulate the native OS as well.
Now, lets get back to our Windows user facing, for the first time, a skinned shell. Imagine this skin is emulating the Mac OS. Our Windows user won’t know what to do, but a Mac user, on the other hand, will immediately feel right at home! So, if I want *my* version of Windows to look and behave like a Mac, or like NeXT, or like BeOS, and I have the tools necessary to make this happen, why shouldn’t I?!
And lets not forget that eye-candy sells! Everybody likes a beautiful thing: that is why the Plus pack was so successful, why everybody – including a lot of Microsoft own developers – is talking about Aqua, and, I even dare say, why Windows never really took off until version 3.0. I remember seeing Windows 3.0, with its 3D look and thinking ‘wow, I have to get this’ while the previous Windows version left me completely cold.
With skinning – which was originaly a power users thing – going mainstream due mainly to WinAmp and the marketing genius of Brad Wardel, Stardock’s CEO, even Microsoft was finally convinced of this. That is why XP got his half-completed ‘Themes’ ability, and why Vista is betting so heavilly on a cool looking GUI, with the Windows Sidebar, Widgets, and all those per pixel alpha transparency effects.
As a side note, in case somebody is curious why native XP theming never really took off, the reason is because Microsoft wasn’t able to solve in time the problem of a badly constructed theme being able to crash the OS. And, as we all know and Raymond pointed out many times, the user would not blame the skin, but the OS itself for crashing. So Microsoft decided to keep the Themes format closed.
Getting back on track, so far I only mentioned eye-candy, but some of the skinnable applications go the extra mile and actually provide a LOT of usability enhancements.
For reasons Raymond Chen also already explained, so I won’t get into them, Microsoft cannot provide the user with a GUI to all the possible tweaks that the OS supports internally. But skinnable applications, being originally oriented for power users, have no such restrictions! Plus they can also add to it. And this is what the applications I make for a living do: they add a lot of functionality AND they are also skinnable.
Of course, letting the user customize so much stuff also means that the Preferences panel of these applications looks like the cockpit of a 747, but oh well… When skinning was a power user thing this was ok, but now I have to comme up with a way to simplify the GUI, perhaps by buring the least used features one or two levels deep and leaving on the surface only the more used features.
And, before you say anything, I’m also guilty of implementing custom controls in Preferences that do not accept keyboard shortcuts. I hang my head in shame, but with the promise that those are all going away on the next versions to be replaced with Windows custom controls. What can I say, I loved the NeXT OS. So please don’t burn me at the stake for it. :-P
"Apparently there is some nontrivial number of people who *like* skinning their music player because the web is crawling with them."
There is a non-trivial number of people who support GWB too, but that doesn’t mean he’s a good leader for the United States.
Yes, they’re all wrong. Customers aren’t always right, and they don’t necessarily know what’s good for them in the long run.
Explorer is just another gui process, and can get hung.
Dewi… "Could that statement possibly be more arrogant?"
You didn’t pay attention to what I said further down: "The problem is when you want the extra functionality without the customization part. " :-)
Personally I also think that skinning should be just a ‘plus’ to functionality. These days there are lots of skinnable applications out there, but, in fact, most of them are more concerned with adding eye candy than functionality. Both are important, but focusing mainly on the former is a mistake, IMHO.
I think Al’s point was why it doesn’t take over *once* the program’s stopped responding. If you’re already creating a title bar and allowing minimizing, why not allow other stuff like restoring from Minimize All? Just show the "ghost" window, and leave the queue alone.
It’s either an APC sent to the window thread, or a new thread created by CSRSS, as it doesn’t work when the process is paused in a debugger.
Jorge: "This is where I think that it is the responsability of the skinnable application authors to provide a skin that is as completely compatible with the OS as possile. After all the application is skinnable, so it should be able to emulate the native OS as well."
And this is where the developers end up chasing a moving target, with nowhere near the resources or dedication available to produce something that works as well as the actual, real native interface.
You talked about how your skinned app provided custom controls with no keyboard shortcuts, that’s just one service the OS supplies for free when you’re using native controls that you have to remember to implement properly for yourself. There are a lot of other points from the user’s perspective that "just work" with native controls, but developers rarely bother to implement properly in skinnable systems. Raymond listed a few of these in Taxes entry a little while back, but there are many other little things that just tend to jar you and bring you out of your normal flow when they don’t "just work" the way you expect them to.
It seems to me that the only paint requests that double-buffering would eliminate are those that the application might never receive in its lifetime, in which case, double-buffering has decreased the performance of those applications…
I’ve always wondered whether a suitable video adaptor could accelerate a window manager by rendering all windows into separate bitmaps and compositing them in real time (this is particularly effective with partially opaque windows of course).
The biggest benefit of an automatic double buffered window manager would not (imho) be related to performance so must as the fact that the window manager could then have v-synch synchronised desktop painting.
And a lack of vsync is really the only thing left that makes full-screen-exclusive necessary for games.
Well, one advantage of a double-buffered WM is that you can take a screenshot of a window that’s currently covered by another window, without having to raise the target window and handle the resulting WM_PAINT messages first. Because the WM will have a buffer of all of that window’s pixels already.
(Or at least, that would be an option. I’m not sure if it’d be possible given the way Vista’s WM will work, because I don’t know how it’ll work.)
BryanK — Vista keeps each top-level window’s most recent visual contents in memory. This is how it does taskbar and alt-tab thumbnails.
Actually, Patriot, it’s probably using PrintWindow, which forces a window to repaint into a memory bitmap instead of the screen. This can be done in XP too, again with the use of PrintWindow. Look at the bottom right:
http://www.winstep.net/temp/aerotasklist.jpg
That’s not Vista running, btw, it’s XP.
Under XP, PrintWindow still has some serious drawbacks however: doesn’t work with layered windows (you have to get the window DC and Bitblt instead, but even that doesn’t work with per pixel alpha layered windows), it can interfere with normal windows repainting, and it fails to get a proper snapshot sometimes. Hopefuly all issues that have been/will be tackled in Vista.
In Vista I believe the thumbnails are live. That is, if the window’s contents are changing while the taskbar tooltip is being displayed (e.g. playing a video), the tooltip will show the live contents of the window. This would be impossible with PrintWindow unless you do it several times a second, but is seamless under Vista since both the window itself and the tooltip are just showing the contents of the 3D surface.
2D surface in a 3D environment you mean, right? Or are windows under Vista actually 3d (so you could look at a folder in explorer from all sides, instead of just front or back)?
Frederik Slijkerman: thanks