On 14 May 2000, Alexandre Julliard wrote:
> Ove Kaaven <[EMAIL PROTECTED]> writes:
>
> > This patch lets the x11drv windowing driver be sort of workable on top of
> > a memory DC.
>
> Why do you need that?
It is a foundation for some semi-hackish stuff to get Battle.net going.
Its interactive screen uses CreateWindow to create buttons and edit
controls, and its paint routine (WM_PAINT handler) goes something like
this:
-IDirectDrawSurface::Lock(primary)
-draw the button's fancy background
-IDirectDrawSurface::Unlock
-USER32.GetDC(hwnd)
-draw the button's text (with TextOut)
-USER32.ReleaseDC
We also know that while DGA (at least DGA 1.0) is active, the X server
will not allow drawing directly on the screen.
So what I did, was to make DirectDraw take over the DISPLAY driver and let
any normal CreateDCs done on it create a memory DC with the primary
DirectDrawSurface DIBsection selected into it. Then I called into the DCE
routines to let it reinitialize its DCE cache (which is used by GetDC) so
it got these new DCs. GetDC calls the SetDrawable function on a cached DCE
to set which window to draw on (which is not applicable to memory DCs), as
well as the appropriate origin coordinates (which *is* applicable to
memory DCs). (I haven't submitted these patches yet.)
And then Battle.net began to work (not perfectly, but it's a start). And
since the XImage part of the DIBSection is off-screen, drawing on the
screen should then even work in DGA mode.
Not pretty, but X is too different from a Windows display driver to have
much of a choice.