July 12th, 2010

What is the cost of WS_CLIPSIBLINGS if the sibling windows don't overlap?

Commenter Robert May asks via the Suggestion Box whether there is a penalty to pay for using WS_CLIP­SIBLINGS when the sibling windows are not overlapping. When you use the WS_CLIP­SIBLINGS style, the window manager clips out the portion of the client rectangle that is covered by sibling windows. This is usually desirable behavior; otherwise you end up with two windows trying to paint at the same location, and somebody is likely to get hurt. (The One notable exception is in dialog boxes, where some controls like the group box were designed to have other controls drawn on top of them.)

The cost of this flag is that when it comes time to calculate the visible region for a window, the space occupied by sibling windows higher in the z-order are clipped out. This happens even if the sibling windows don’t overlap; after all, the only way to find out whether there are any overlapping sibling windows is to enumerate the sibling windows looking for them! Of course, if there is in fact no overlapping, then the calculations are trivial. The only cost was the loop which determines that there are no applicable siblings to be clipped out.

Topics
Other

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.