Aero Peek

From MozillaWiki
Jump to: navigation, search


Windows 7 introduces a new feature with its redesigned taskbar to allow applications to expose their tab document interface (TDI) to the taskbar. This allows the taskbar to displays a thumbnail for each tab containing the tab's contents. Each preview has a close button which allows the user to close the tab from the taskbar without switching to the application. When the user moves the mouse over a preview, Windows will hide all other windows except for the window/tab represented by that preview. Each preview has a tooltip and up to 7 customizable buttons.

Internet Explorer 8 uses this feature to expose its browser tabs to the taskbar. We would like to have this ability as well. However, we would also like to allow additional functionality for these thumbnails and previews so that extension authors and perhaps even the default Firefox configuration can provided a customized tab experience for the users based on their workflow - the one-preview-per-tab model does not scale very well for users with many tabs.

Microsoft's documentation for this feature is sparse so there are still some unknowns.


  • Enable the one-preview-per-tab feature
  • Allow extensions to override the default preview behavior and draw arbitrary content to the thumbnails and previews

Proposed Implementation Strategy

The Windows 7 SDK is required to build this feature.

The ITaskbarList3 (or ITaskbarList4) COM interface is used to interact with the taskbar. Registering a tab requires a native window handle (HWND). Unfortunately, these native windows must be toplevel windows so we need to create invisible proxy windows. Registering a tab also requires providing a "parent" TDI window - the taskbar will automatically remove the preview for the MDI window when a tab for it is registered.

These proxy windows will have their own window procedure and will not have an nsWindow associated with them. The following messages need to be handled:

  • WM_CREATE needs to make some calls to the DWM
  • WM_CLOSE handles the thumbnail's close button clicks
  • WM_ACTIVATE is sent when the thumbnail is clicked on
  • WM_COMMAND is sent when one of the thumbnail's buttons is clicked
  • WM_DWMSENDICONICTHUMBNAIL is sent when the thumbnail needs to be drawn
  • WM_DWMSENDICONICLIVEPREVIEWBITMAP is sent when we need to draw the preview.

Since we need to create proxy windows in order to show a taskbar preview, it is not necessary to have any relation to a tab's native window. Clients of this API will provide a controller for each preview. This controller will be responsible for handling any messages (close, activate and buttons) and any necessary drawing. All drawing will be done to a canvas element which is created by the TaskbarPreview.

The proposed controller interface is as follows:

 interface nsITaskbarPreviewController : nsISupports
   readonly attribute unsigned int width;
   readonly attribute unsigned int height;
   void drawPreview(in nsIDOMCanvasRenderingContext2D ctx);
   void drawThumbnail(in nsIDOMCanvasRenderingContext2D ctx, in unsigned int width, in unsigned int height);
   void onClose();
   void onActivate();
   // TODO: buttons

The taskbar preview interface is as follows:

 interface nsITaskbarPreview : nsISupports
   attribute nsITaskbarPreviewController controller;
   attribute DOMString tooltip;
   attribute boolean enabled;
   void makeActive();
   // aNext may be null
   void move(in nsITaskbarPreview aNext);
   // TODO: buttons

For drawing the thumbnails, the canvas surface will be backed by a Windows bitmap which is then sent to the DWM.

The Electrolysis project should not cause any complications with the one exception that canvas's drawWindow method must work when drawing a content process's window.


Contact robarnold ( with any feedback or input.