Welcome to MSDN Blogs Sign in | Join | Help

Under the Hood of the Desktop Window Manager

I've made a grand total of one post in about the last 21 months.  What have I been doing during this time?  Why, working on the new Desktop Window Manager for Windows Vista, of course!  The Desktop Window Manager (DWM) is one of the more visible features and changes to Windows coming out with the upcoming Windows Vista release.

Does this mean that I've abandoned Windows Presentation Foundation (Avalon) to work on the DWM?  By no means.  The DWM is built upon the core graphics layer of Avalon, and is being developed by the same team responsible for Avalon. 

We've been heads down on design, development, and testing for quite some time, but now that there's an end in sight, I figured I'd come up for air and describe a bit about what we've done and the technical underpinnings of this visible feature.  There's lots and lots that can potentially be discussed, so I'm going to keep this first post fairly broad and high level, and will be interested in feedback if there are other specific areas of interest that readers would like to delve further into.  So please do comment with your thoughts!

The public face of the Desktop Window Manager

The DWM is of course just part of Windows Vista and not considered distinct from it.  Its features are exclusively available in the Windows Vista Aero experience.  I'm pulling out some of the more recognizable features here.

This is "Aero Glass", the semi-transparent look that Aero provides, with the blurry content behind the window frames, designed to allow the user to focus on the window itself, and not on what lies behind.

 

Here are the live thumbnail views provided on the Windows Vista taskbar.

 

And here are Windows Flip and Windows Flip3D -- the updated Windows Vista experiences invoked by Alt-Tab and Windows-Tab, respectively, for navigating between and selecting windows.

 

Desktop Composition

By far the largest change to Windows Vista in the way that windows are presented is the introduction of "desktop composition".  This underlies everything that is done by the DWM.  The primary takeaway for desktop composition:  the way an application gets pixels on the screen has fundamentally changed

In all versions of Windows, up until Windows XP, applications were asked by Windows to paint their visible region, and they would paint directly to the buffer that was to be displayed by the video card.  With Windows Vista, applications are asked by Windows to paint their entire surface to an offscreen surface (alternatively known as a bitmap, buffer, or texture), and it's up to the DWM to take all of these offscreen surfaces, and "compose" them together to the onscreen buffer.

Read the previous paragraph again.  From a windowing system display perspective, this has profound implications in terms of the features that can be implemented, and the quality that can be achieved.  Some examples:

  • Access to windows - now that applications are rendered offscreen, those offscreen representations can be used in other places.  This is precisely how the Flip, Flip3D, and thumbnail features work, and other features can be built that take advantage of this as well.
     
  • Don't involve background applications in window operations - when a window moves across the screen in XP and before, the portions of background windows that are newly visible only get painted when the background application wakes up and starts painting (in response to WM_PAINT messages it receives when the top window is moving).  For non-responsive background applications, or even responsive ones that happen to be paged out, this can yield a very poor user experience. 

    Consider moving an 'Paint' program window over an IE window.  On XP and before, the following symptoms are unfortunately all too common:

       

    In both of these cases, the underlying Internet Explorer application was unable to repaint itself quick enough to avoid the "trails" that the moving Paint window left behind. 

    Under Windows Vista, this simply isn't the case -- underlying windows do not receive WM_PAINTs and are not asked to re-render, since their content is already available to the DWM and is used to composite the screen.
     
  • Tear free experience - given that the DWM orchestrates all rendering to the screen, the latest technologies provided by DirectX that are typically used for games can be used for the overall desktop experience.  In particular, graphics cards' ability to "flip" the front buffer results in an absolutely tear free experience as windows are moved around the screen, increasing the smoothness and quality of the user experience.
     
  • High resolution support - the majority of applications out there are agnostic of the monitor resolution (DPI) that they're running at.  On the increasingly popular higher resolution monitors (120 DPI, 144 DPI, and beyond), this can produce a bad experience where applications appear very small in physical space.  Because the DWM has access to offscreen representation of the application window, the DWM is in a unique position to scale such DPI-unaware applications for their final presentation to the user, making for a much improved experience on the higher resolution monitor.

Possible Future Topics

Desktop composition is the most fundamental aspect of what the DWM provides, but we've really only scratched the surface of that topic, and there are still a lot of related topics to explore for a full understanding of what we're doing in Windows Vista.  Here's a rough cut of likely topics, roughly in the order I'd expect to tackle them.

  • DWMs use of DirectX, GPUs, and hardware acceleration
  • The importance and impact of the Windows Vista Display Driver Model to the DWM
  • Redirecting GDI and DirectX applications
  • How underlying WPF concepts and technology are being used
  • How the DWM paints the window frame and other non-client area
  • Remoting, Magnification, and Accessibility under the DWM
  • High DPI support
  • Publicly exposed DWM APIs
  • Rendering and visibility optimizations
  • Memory usage in the DWM

Again, please do comment with your interests and where you'd like this conversation to go.  No promises of course that we'll even get to any of them... but I do expect to.

Other DWM-related Sources of Information

While this is probably the most technically comprehensive discussion thus far of the DWM out on the web (though I'm certainly happy to be proven wrong), there are definitely other places with great sources of information and news: 

  • My ever-esteemed colleague Kam VedBrat maintains a blog that often gives a great inside perspective about the DWM, specific DWM features, and Windows Vista Aero. 
  • The microsoft.public.windows.developer.winfx.aero newsgroup carries discussion of all things Aero
Published Sunday, March 05, 2006 10:59 PM by Greg Schechter
Filed under:

Comments

Monday, March 06, 2006 3:09 AM by Anonymous

# re: Under the Hood of the Desktop Window Manager

I'd like to know why DWM can't just use the alpha channel of the buffer that Avalon draws to, to be able to do completely hardware accelerated irregular shaped and alpha blended windows, but instead has to drop Avalon HW acceleration and go to software rendering...
Monday, March 06, 2006 8:39 AM by Konstantin Gonikman

# re: Under the Hood of the Desktop Window Manager

Great to see you again Greg. That's very-very-very cool stuff, I'm just waiting to see more low-level details (particularly regarding the use of DWM in custom apps).

Welcome back!
Monday, March 06, 2006 9:41 AM by Stephane Rodriguez

# re: Under the Hood of the Desktop Window Manager


"Tear free experience"

How is this possible? Doesn't this depend on how much is getting drawn?

Two decades ago, on machines like Atari ST and Amiga, it was all about the vertical blank. People used to write applications (demo) that would draw based on the vertical blank frequency, avoid the drawing spot, resulting in smooth scrollers and so on. Whatever happened to this?

In other words, I don't think the tear experience scales well if you drawing too much on the screen at the same time, say you are running a couple videos concurrently.

And I still fail to see how tear-free experience will make mom and dad feel excited about Windows Vista. Sorry, it had to be said.
Monday, March 06, 2006 10:22 AM by JoeW

# re: Under the Hood of the Desktop Window Manager

Thanks Greg

I would like to know more about the public APIs.  Specifically I would like to know how Vista's native dialog boxes are rendered (message box, explorer windows etc).  Do they still use GDI or do they use an unmanaged composition engine?
Monday, March 06, 2006 11:13 AM by jfo's coding

# Greg gives an overview of the new window manager in Windows Vista (DWM)

Greg shows of what he's been working on for the last 21 months. 
It's worth a read, as he points...
Monday, March 06, 2006 11:44 AM by Josh Einstein

# re: Under the Hood of the Desktop Window Manager

Found this via Jessica Fosler's blog. I'm subscribed. Hope to see more great posts like this. DWM is very exciting and I'm glad to see Windows painting working the way it always should have.
Monday, March 06, 2006 12:05 PM by STEFANO DEMILIANI WeBlog

# Vista UI at work...

Monday, March 06, 2006 1:06 PM by Rob Relyea

# Windows Vista DWM (Desktop Window Manager) Details

Greg Schechter rejoins us after a lengthy blogging pause to fill us in on profound changes in how Windows...
Monday, March 06, 2006 1:15 PM by Corrado's BLogs

# Windows Vista Desktop Window Manager

Monday, March 06, 2006 2:14 PM by David Larsson

# High DPI Mode?

I have been playing around with the High DPI-mode in the latest Vista CTP, mainly to see what compatibility problems (if any) we will have with a medical record viewing application that I help building. And boy, do we have problems.
Can we expect this feature to improve significantly during the beta cycle? I'm not sure this bitmap scaling for non-DPI-aware applications work - all text becomes very blurry and really isn't much easier on the eyes. Then there are problems with popup windows, like menus and semi transparent "tooltips" that we use, appearing in the wrong location or not at all. (It's an ATL/WTL application.)
Well, it is otherwise an impressive improvement to Windows and I look forward to reading more about the DWM!
Monday, March 06, 2006 4:21 PM by Keith Hill

# re: Under the Hood of the Desktop Window Manager

Thanks for shedding light on this topic.  Regarding your future topics, please bring 'em on and the quicker, the better.  :-)
Monday, March 06, 2006 5:39 PM by Mat

# re: Under the Hood of the Desktop Window Manager

Can't wait you to blog about all listed topics!
Monday, March 06, 2006 6:30 PM by David

# re: Under the Hood of the Desktop Window Manager

I think I'm understanding that each window's content is stored in memory so that they do not receive WM_PAINT messages when a window moves over them and then reveals part of the background window.

My question is how do you handle the memory requirements for that as it could potential eat a lot of memory?



Monday, March 06, 2006 7:02 PM by Shawn Oster

# Some Questions...

As I'm reading a few dozen questions come to mind.  You hit on some of them in your "upcoming topics" hit list but here are the things that sparked:

1. How signifigant will hardware acceleration be to Glass?  It used to be there was the 2D benchmarks for work apps then the 3D benchmark for the fun things.  An amazing game card would often be horrible at having a lot of small Excel/Word/Visual Studio windows open.

2. One of the first things new developers learn is to do their own screen buffering, to a bitmap, metafile, etc.  Does the DWM change that since it's already buffering?

3. What kind of impact will this have on apps like Photoshop?  Are there things raster image editing programs can do to improve speed if they are running on Vista?

4. If you are running old hardward does everything still go through the DWM?  Like inside a Virtual PC?

5. How much control will we have over DWM?  For example could someone create Flip/Flip3D as a stand-alone app?  The nerdling fun side of my brain imagines interfaces a la Minority Report (minus the gloves and Tom Cruise).

6. Hmm, speaking of the Minority Report UI, how well will video drag?

7. How heavy a load does DWM put on the system?  I remember when shell replacements were big (LiteStep, geoShell, Cloud9, etc) and the goal was always reducing load while giving UI goodness.  Sounds like DWM could be that as long as it isn't seen as a boat anchor.

Looking forward to more blog posts on this subject.  Try to come up for air just a wee bit more often :)
Monday, March 06, 2006 7:35 PM by DCMonkey

# re: Under the Hood of the Desktop Window Manager

Will and how will the DWM affect windows redrawing while resizing? I've noticed some apps in the Feb CTP (Event Viewer comes to mind) that redraw rather chaotically when resizing. I guess I was expecting a more Mac OS X like experience, where the window contents are redrawn cleanly and completely even if this causes the size of the window to lag somewhat behind the mouse movements. Both methods have their downsides but the later gives a more solid feel to the applications IMHO.

Any insights?
Monday, March 06, 2006 7:54 PM by Kirill Osenkov

# re: Under the Hood of the Desktop Window Manager

Great news, sounds very promising.

What impact does it have on existing applications? My existing Win32 application uses a custom double-buffer to create a flicker-free experience.

Does it mean I should get rid of my (now unnecessary) custom back buffer when I port my app to Vista? Does it also mean that all flickering applications will automatically become flicker-free?
Tuesday, March 07, 2006 12:53 AM by HTK

# re: Under the Hood of the Desktop Window Manager

Hi Greg, the first screenshot, with the bigger caption buttons, is this a real screenshot or something done with photoshop? If this is a real screenshot it shows how great vista will scale to higher dpi monitors!
Tuesday, March 07, 2006 1:04 AM by HTK

# re: Under the Hood of the Desktop Window Manager

Another thing related to what I stated first, but on the polar opposite:

The same way one can have the system render itself proportionally bigger, the opposite seems technically feasable, to make everything smaller resulting in virtually more desktop space, at least to some extent, before text becomes unreadable.

What do you think Greg?
Tuesday, March 07, 2006 2:53 AM by Kam VedBrat

# Greg Schechter gives you a look under the hood of the DWM

Greg Schechter is one of the Architects on the Avalon team who's focus for the last year or so has been...
Tuesday, March 07, 2006 3:05 AM by Олег Михайлик

# DWM, Desktop Window Manager — для тех, кто не понял

Дельное объяснение без понтов и лишней зауми.
Tuesday, March 07, 2006 3:13 AM by Chris Nahr

# re: Under the Hood of the Desktop Window Manager

That sounds fantastic! Does the automatic window buffering mean we could get rid of the traditional WM_PAINT event processing altogether, and just draw new elements immediately as required?

Also, what happens when a window is scaled to a higher resolution? Will OpenType text be recognized as such, and appropriately re-rendered at a greater point size?
Tuesday, March 07, 2006 3:16 AM by ion

# re: Under the Hood of the Desktop Window Manager

Is it possible to enable anti-aliasing on DWM to prevent the jagged edges on skin and in Flip3D?
Tuesday, March 07, 2006 3:46 AM by Eli

# re: Under the Hood of the Desktop Window Manager

Look forward to hearing about it. =)

I have a couple of questions. How do the glass blurring effects work? Pixel shaders? And, does the DWM use the 3D hardware to accelerate non-WPF, old GDI drawing commands?

# jtb.blog » Blog Archive » Windows Vista - Aero Screenshots

Tuesday, March 07, 2006 4:00 AM by Anonymous

# re: Under the Hood of the Desktop Window Manager

I would love to hear more details about how you are doing your text rendering now that you are going through the DWM all the time.
Tuesday, March 07, 2006 4:26 AM by Ian Ringrose

# re: Under the Hood of the Desktop Window Manager

Witch versions of Windows Vista will include this?  E.g. is it in the OEM version that will ship with ALL new PCs?

As an application writer what should I do differently, e.g. given that the OS is doing "double buffering", should I detect that I am on Vista and do my redrawing in a different way?
Tuesday, March 07, 2006 5:00 AM by ping pong

# re: Under the Hood of the Desktop Window Manager

Is DWM written in managed language?
Tuesday, March 07, 2006 5:04 AM by Mike Dimmick

# re: Under the Hood of the Desktop Window Manager

Can you do anything about the fact that launching any Java app or applet with Sun's JRE 1.5.0_06 causes the DWM to switch off?

I'm guessing that Sun are using DirectDraw with a locked primary surface to do their rendering. A communication from David Blythe indicated that this would disable the DWM.
Tuesday, March 07, 2006 7:07 AM by DGC

# re: Under the Hood of the Desktop Window Manager

I'm interested in the memory usage of the DWM. If every window is rendered offscreen, isn't it the case that in some extreme situations some of these offscreen surfaces may be either paged down to disk or re-rendered continuously affecting the whole system performance?

Also, does the desktop composition process try to fix potential aliasing issues? I have noticed a quite annoying border aliasing on some of the Flick3D screenshots.
Tuesday, March 07, 2006 7:49 AM by Atlanta web developerr

# re: Under the Hood of the Desktop Window Manager

Good work.  You definetely get people excited about the new interfaces.  I really am hoping it opens the door to UI development that might otherwise be outside of the box ;)

Rawk on... and keep posting eye candy for us.
Tuesday, March 07, 2006 11:57 AM by KJK::Hyperion

# re: Under the Hood of the Desktop Window Manager

Ok, cool, but is it programmable from a third party application? in other words: how can I totally abuse this wonderful technology?
Tuesday, March 07, 2006 3:17 PM by Jean-Marc, XP Geek !

# WDM : un article à lire

Malheureusement en anglais, mais très intéressant, cet article vous expliquera le fonctionnement du Windows...
Tuesday, March 07, 2006 10:29 PM by Daniel Lehenbauer's Blog

# GregSc on the Vista desktop manager

Look like a familiar problem?  Want to know what we’re doing about in Windows Vista? 

Greg...
Wednesday, March 08, 2006 1:11 AM by kiwi

# re: Under the Hood of the Desktop Window Manager

I do not like the transparency effect. The first thing I do is turn it off (thanks for providing the option BTW!).

I think it's very cool (the transparency effect) the first 10 minutes, but then it becomes annoying... It's just confusing to see the graphics behind a window, especially from colored webpages. So, can't MS graphical designers come with a different, less "poor", wow-effect for Vista? One that would be usable for ever, not just 10 minutes? Come on, I know you guys can do it :)
Wednesday, March 08, 2006 5:57 PM by bob

# re: Under the Hood of the Desktop Window Manager

second the request for info on anti-aliasing. The 3d flip is cool, but I can't take jaggies any more...

Also second the request for info on memory usage- should I buy a 512meg (1gig?) graphics card in the future, etc?
Wednesday, March 08, 2006 7:01 PM by 'Joe Foti' <jf0h@melodeo.com>

# re: Under the Hood of the Desktop Window Manager

First forgive me since I haven't installed a beta copy of Vista yet (I have 5308 but haven't decided to install or wait for consumer beta release) and some of this post may be answered if I had.

This is really interesting to me and the off-screen approach makes total sense.  That said, what types of effects from DX10 will also make their way into the DWM?  A simple example from MAC is the way windows minimize and maximize.  Will the DWM take any advantage of particle affects or other fun UI?  Will this be left up to the community to build and not really be done by Gold Master time frame by MS?  Kinda the way things went with windowblinds etc...

I worked for AOL over the last few years and we had a presentation 2 years ago on a concept of what a Vista AOL client may look and act like done by MS.  This showed seamless movements between browsing a picture on the web and dragging it into another app across the screen.  It also showed how the desktop can be utilized as a personal clip board with images from the web dragged seamlessly as well as text and special affects to make everything "alive" (move, pulse, etc...).  Do these things exist or will they in the coming consumer beta?
Thursday, March 09, 2006 5:25 AM by GRiNSER

# re: Under the Hood of the Desktop Window Manager

why is there just flip3d and nothing equally functional like expose in mac os x where you can drag and drop from one to another window while seeing all windows at once? flip3d is, in my opinion, more like a toy than a useful thing, because tabbing or scrolling through the whole open windows is much more time consuming than having all windows in a small preview at once on the whole screen.
Thursday, March 09, 2006 11:49 AM by Mike Taulty's Weblog

# Windows gets a Window Manager

Thursday, March 09, 2006 3:21 PM by Andy

# re: Under the Hood of the Desktop Window Manager

Shawn wrote:
"4. If you are running old hardward does everything still go through the DWM?  Like inside a Virtual PC?"

I got the impression from the post that DWM will only be used with the new Aero Glass interface. Therefore, if you're running on older hardware, you can switch back to the XP look, and use the traditional window manager.
Thursday, March 09, 2006 5:20 PM by Keith Patrick

# re: Under the Hood of the Desktop Window Manager

I'm curious to hear the relationship between DWM and WPF.  I've read on the Avalon newsgroup that Explorer (and thus DWM) is not using WPF, and that WPF isn't even installed by default with Vista.  That leads me to think that there's a great deal of duplicate code in both technologies, and I worry about a divergence of functionality along the lines of Office's UI widgets and commctrl32.dll.  If this really is the case, do the two technologies eventually converge, with everything built to WPF?
Friday, March 10, 2006 2:16 AM by MueMeister

# re: Under the Hood of the Desktop Window Manager

Hey Greg,

thanks for the post but what about the important topic: "How underlying WPF concepts and technology are being used"? I always read that DWM uses wpf tech? Please post about that issue it is important to know!!!

chris
Friday, March 10, 2006 2:32 AM by Pablo Fernicola's Personal Blog

# Peaceful Coexistence - Windows Vista's Desktop Experience and Applications

I read and participate in newsgroups (and blogs) regularly.  This entry is derived from a recent long post of mine in response to some very passionate newsgroup posts by some folks using the latest Windows Vista CTP

The are a number of very positive
Saturday, March 11, 2006 1:51 AM by Greg Schechter

# Responding to Comments on This Post

Lots of great comments coming in.  Rather than responding to them with more comments, I added a new post to do that.
Sunday, March 12, 2006 2:25 PM by deebs

# re: Under the Hood of the Desktop Window Manager

That is one very, very neatly constructed aero objects.  It is awesome!
Monday, March 13, 2006 7:16 AM by Mahalakshmi N

# re: Under the Hood of the Desktop Window Manager

Very interesting and informative conversation. Thanks Greg...
Sunday, March 19, 2006 3:40 PM by Greg Schechter's Blog

# DWM's use of DirectX, GPUs, and hardware acceleration

For the last few years, both desktop and laptop PCs have been outfitted with increasingly powerful graphics...
Sunday, March 26, 2006 12:37 PM by Olivier Le Pichon

# re: Under the Hood of the Desktop Window Manager

Composition Engine remebere me of Microsoft Talisman project. May be a connexion?
Monday, April 10, 2006 12:57 AM by Kam VedBrat

# Charlie Owen talks Windows Vista..

Charlie Owen on the Windows Media Center team has been posting quite a bit lately on Windows Vista. He's...
Friday, April 21, 2006 3:05 AM by Greg Schechter's Blog

# Desktop Window Manager Index of Post Topics

Here's a list of topics that I have posted on (with active links) or expect to post on (without links)...
Saturday, April 22, 2006 4:31 AM by Kam VedBrat

# Sean McBride asks &amp;quot;Windows Vista Aero... Why again?&amp;quot;

I came across Sean's blog while figuring out how to register with Technocrati... He recently got around...
Monday, June 05, 2006 6:21 PM by Mike Taulty's Weblog

# Vista, Desktop Window Manager and Thumbnails

Thursday, June 08, 2006 7:01 AM by David Boschmans Weblog

# DWM &amp;amp; Aero Glass at work

When talking about WPF during the Windows Vista ISV Touchdown training a lot of people were interested...

# Randomly technology related (sometimes) &raquo; Blog Archive &raquo; Random rantings : Vista beta 2, 64 bit computing and drivers

Monday, August 07, 2006 3:45 AM by Greg Schechter's Blog

# High DPI Support in Windows Vista Aero

A good amount of ink has been spilled on this blog talking about all the
cost, nuance, impact, and...
Thursday, September 28, 2006 8:31 PM by The Great Flying Tortoise

# How I Learned to Stop Worrying and Love the Vista

Today I'd like to share the fearful tale about a Vista upgrade gone horribly wrong.&amp;nbsp; Base on a true...
Friday, November 24, 2006 5:40 AM by Jo’s Braindump » Cool Windows Vista Desktop Stuff

# Jo&#8217;s Braindump &raquo; Cool Windows Vista Desktop Stuff

Friday, November 24, 2006 5:40 AM by Jo’s Braindump » Cool Windows Vista Desktop Stuff

# Jo&#8217;s Braindump &raquo; Cool Windows Vista Desktop Stuff

Tuesday, December 05, 2006 10:32 PM by SteveX Compiled » Blog Archive » Vista DWM

# SteveX Compiled &raquo; Blog Archive &raquo; Vista DWM

# Neverwinter Nights 2 is working in Vista | Windows Vista on a MacBook Pro

# Desktop Window Manager in Vista &laquo; My .NET and Everything that goes with it&#8230;

# What is the Desktop Window Manager (DWM) in Vista? - CyberNet News

# Why, the news analyst tell,Vista Was Vulnerable? &laquo; VistaMalaya

Thursday, May 31, 2007 9:58 AM by David Boschmans Weblog

# DWM & Aero Glass at work

When talking about WPF during the Windows Vista ISV Touchdown training a lot of people were interested

# blog.budigelli.com &raquo; Blog Archive &raquo; Desktop Window Manager in Vista

# Sense of life &raquo; Expose (z kreseczk?? nad ostatnim e) w DWM

# Software Information &raquo; Greg Schechter&#8217;s Blog : Under the Hood of the Desktop Window Manager

# Tim Anderson&#8217;s ITWriting - Tech writing blog &raquo; Microsoft&#8217;s Vista Capable campaign: where it all went wrong

Tuesday, January 20, 2009 2:29 PM by aero | hilpers

# aero | hilpers

Wednesday, January 21, 2009 11:13 PM by Desktop composition | keyongtech

# Desktop composition | keyongtech

# Greg Schechter s Blog Under the Hood of the Desktop Window Manager | Shed Kits

# Greg Schechter s Blog Under the Hood of the Desktop Window Manager | Wood TV Stand

# Greg Schechter s Blog Under the Hood of the Desktop Window Manager | Insomnia Cure

# Greg Schechter s Blog Under the Hood of the Desktop Window Manager | work from home

New Comments to this post are disabled
 
Page view tracker