Window transparency dilemma
- From: Marty <net@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Dec 2007 17:22:13 -0800
I'm seeing some strange PM behavior that I can't quite understand, apparently relating to whether or not a window was created in a given process.
I'm trying to emulate transparent window behavior as closely as possible and I've had good success so far, with only one minor drawing glitch. I've been able to re-capture the bitmap underneath the window (and superimpose my transparent bitmap over it) by triggering off of when my window's visible region changes (WinSetVisibleRegionNotify, WM_VRNENABLED/WM_VRNDISABLED). My logic here is that if the user changes the Z-order of a window underneath my transparent window, my transparent window's visible region will change. I know I'll never be able to capture updates that windows below my transparent window are doing in their client areas, but at least when the user moves them around I can get these changes and update my bitmaps accordingly.
This much is working really well. When my visible region changes, I hide my window, re-capture the bitmap, and show it again.
The drawing glitch is... if the window being moved happens to exist in the same process (and for that matter, message queue thread in this case) as the transparent window, it all goes to hell. The transparent window hides itself, but the windows below it never redraw before the window re-captures the bitmap again.
So if I had another one of my app's windows underneath the transparent window, and I click and drag its titlebar to bring it to the top and move it, the desktop window below it never gets a chance to redraw to cover over where the window used to be. Also, the hiding of the transparent window becomes ineffective because the desktop doesn't redraw there either! This is very strange because if I'm dragging the titlebar of a window from another process, it all works absolutely perfectly!
So it looks like there might be some kind of "short-circuit" in the full window dragging behavior, where my transparent window hides and re-shows itself before the other windows ever get a chance to know what happened. This might have been viewed as an optimization in the PMShell, eliminating some seemingly unnecessary window message traffic, but it's making this task absolutely impossible.
Any suggestions on how I can force the full dragging behavior to allow the other windows to get a chance to draw themselves? My transparent window's style is: CS_MOVENOTIFY | CS_CLIPSIBLINGS. Its parent and owner are HWND_DESKTOP.
My window procedure for the transparent window has a flow like this:
case WM_CREATE:
// Create memory device contexts/HPS for offscreen bitmaps
// Create bitmap handles of the appropriate size
// Initialize other stuff
WinSetVisibleRegionNotify( myWin, TRUE );
...
break;
case WM_MOVE:
// Perform a bitblt from the window HPS to offscreen memory HPS
...
break;
case WM_PAINT:
// Perform a bitblt from memory HPS to the window HPS in the
// visible region only if the visible region is enabled.
break;
case WM_VRNDISABLED:
// Increase visible region counter (window ULONG) to avoid recursion.
vrnNotificationCount = WinQueryWindowULong( myWin, ... );
WinSetWindowULong( myWin, ..., vrnNotificationCount + 1 );
if ( !vrnNotificationCount )
{
WinShowWindow( myWin, FALSE );
}
break;
case WM_VRNENABLED:
vrnNotificationCount = WinQueryWindowULong( myWin, ... );
WinSetWindowULong( myWin, ..., 0 );
if ( vrnNotificationCount )
{
WinShowWindow( myWin, TRUE );
WinPostMsg( myWin, WM_MOVE, NULL, NULL );
// Originally WinSendMsg... made no difference.
}
break;
--
[Reverse the parts of the e-mail address to reply.]
.
- Follow-Ups:
- Re: Window transparency dilemma
- From: Marty
- Re: Window transparency dilemma
- Prev by Date: Re: WinStartApp question
- Next by Date: Re: Window transparency dilemma
- Previous by thread: WinStartApp question
- Next by thread: Re: Window transparency dilemma
- Index(es):
Relevant Pages
|
Loading