From b0b54338e2f8aed6e6a683ebddd2a2acbefabecd Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 11 Oct 2010 16:25:03 +0100 Subject: [PATCH] hw/xwin: Add a flag to track which windows have been drawn to using WGL. Reviewed-by: Colin Harrison Signed-off-by: Jon TURNEY --- hw/xwin/glx/Makefile.am | 6 +++++- hw/xwin/glx/winpriv.c | 3 +++ hw/xwin/winmultiwindowwindow.c | 10 +++++++++- hw/xwin/winmultiwindowwndproc.c | 14 ++++++++++++++ hw/xwin/winwindow.h | 3 +++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/hw/xwin/glx/Makefile.am b/hw/xwin/glx/Makefile.am index cdcba35c9..6b840bacb 100644 --- a/hw/xwin/glx/Makefile.am +++ b/hw/xwin/glx/Makefile.am @@ -16,7 +16,11 @@ if XWIN_MULTIWINDOWEXTWM DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM endif -DEFS = $(DEFS_MULTIWINDOW) $(DEFS_MULTIWINDOWEXTWM) +if XWIN_GLX_WINDOWS +DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS +endif + +DEFS = $(DEFS_MULTIWINDOW) $(DEFS_MULTIWINDOWEXTWM) $(DEFS_GLX_WINDOWS) INCLUDES = -I$(top_srcdir)/miext/rootless diff --git a/hw/xwin/glx/winpriv.c b/hw/xwin/glx/winpriv.c index a35392b26..7772a7569 100644 --- a/hw/xwin/glx/winpriv.c +++ b/hw/xwin/glx/winpriv.c @@ -61,6 +61,9 @@ HWND winGetWindowInfo(WindowPtr pWin) { /* copy window handle */ hwnd = pWinPriv->hWnd; + + /* mark GLX active on that hwnd */ + pWinPriv->fWglUsed = TRUE; } return hwnd; diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 2d9a46e40..2139c7cf5 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -110,7 +110,10 @@ winCreateWindowMultiWindow (WindowPtr pWin) pWinPriv->hWnd = NULL; pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen); pWinPriv->fXKilled = FALSE; - +#ifdef XWIN_GLX_WINDOWS + pWinPriv->fWglUsed = FALSE; +#endif + return fResult; } @@ -652,6 +655,11 @@ winDestroyWindowsWindow (WindowPtr pWin) winDestroyIcon(hIcon); winDestroyIcon(hIconSm); +#ifdef XWIN_GLX_WINDOWS + /* No longer note WGL used on this window */ + pWinPriv->fWglUsed = FALSE; +#endif + /* Process all messages on our queue */ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 1a3be78d5..fb1938b3a 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -472,6 +472,20 @@ winTopLevelWindowProc (HWND hwnd, UINT message, return 0; } +#ifdef XWIN_GLX_WINDOWS + if (pWinPriv->fWglUsed) + { + /* + For regions which are being drawn by GL, the shadow framebuffer doesn't have the + correct bits, so don't bitblt from the shadow framebuffer + + XXX: For now, just leave it alone, but ideally we want to send an expose event to + the window so it really redraws the affected region... + */ + ValidateRect(hwnd, &(ps.rcPaint)); + } + else +#endif /* Try to copy from the shadow buffer */ if (!BitBlt (hdcUpdate, ps.rcPaint.left, ps.rcPaint.top, diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index ebe43091f..a6c8e05dd 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -80,6 +80,9 @@ typedef struct winPrivScreenPtr pScreenPriv; Bool fXKilled; HDWP hDwp; +#ifdef XWIN_GLX_WINDOWS + Bool fWglUsed; +#endif /* Privates used by primary fb DirectDraw server */ LPDDSURFACEDESC pddsdPrimary;