summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2015-08-03 15:59:40 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2016-11-17 13:15:44 +0000
commit94f2c5c1242844bbd27cad2ccb0083216ea2853a (patch)
tree8e5221a212689202456e255ed19c15e3e1b9b771 /hw
parent6076710db4f4ac4b5a75b08a408306706f64e7e0 (diff)
Push multiwindow wndproc WM_PAINT down into engine
Only GDI engine is supported in multiwindow mode currently, so only in GDI engine.
Diffstat (limited to 'hw')
-rw-r--r--hw/xwin/win.h3
-rw-r--r--hw/xwin/winmultiwindowwndproc.c42
-rw-r--r--hw/xwin/winshadddnl.c1
-rw-r--r--hw/xwin/winshadgdi.c58
4 files changed, 68 insertions, 36 deletions
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 7fe4612d3..03184dec0 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -271,6 +271,8 @@ typedef Bool (*winFinishScreenInitProcPtr) (int, ScreenPtr, int, char **);
typedef Bool (*winBltExposedRegionsProcPtr) (ScreenPtr);
+typedef Bool (*winBltExposedWindowRegionProcPtr) (ScreenPtr, WindowPtr);
+
typedef Bool (*winActivateAppProcPtr) (ScreenPtr);
typedef Bool (*winRedrawScreenProcPtr) (ScreenPtr pScreen);
@@ -503,6 +505,7 @@ typedef struct _winPrivScreenRec {
winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
winFinishScreenInitProcPtr pwinFinishScreenInit;
winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winBltExposedWindowRegionProcPtr pwinBltExposedWindowRegion;
winActivateAppProcPtr pwinActivateApp;
winRedrawScreenProcPtr pwinRedrawScreen;
winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 5e5efb15e..56e7b8092 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -328,7 +328,6 @@ LRESULT CALLBACK
winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
POINT ptMouse;
- HDC hdcUpdate;
PAINTSTRUCT ps;
WindowPtr pWin = NULL;
winPrivWinPtr pWinPriv = NULL;
@@ -483,18 +482,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_PAINT:
/* Only paint if our window handle is valid */
- if (hwndScreen == NULL)
+ if (hwnd == NULL)
break;
- /* BeginPaint gives us an hdc that clips to the invalidated region */
- hdcUpdate = BeginPaint(hwnd, &ps);
- /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
- if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 &&
- ps.rcPaint.left == 0 && ps.rcPaint.top == 0) {
- EndPaint(hwnd, &ps);
- return 0;
- }
-
#ifdef XWIN_GLX_WINDOWS
if (pWinPriv->fWglUsed) {
/*
@@ -504,36 +494,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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...
*/
+ BeginPaint(hwnd, &ps);
ValidateRect(hwnd, &(ps.rcPaint));
+ EndPaint(hwnd, &ps);
}
else
#endif
- /* Try to copy from the shadow buffer */
- if (!BitBlt(hdcUpdate,
- ps.rcPaint.left, ps.rcPaint.top,
- ps.rcPaint.right - ps.rcPaint.left,
- ps.rcPaint.bottom - ps.rcPaint.top,
- s_pScreenPriv->hdcShadow,
- ps.rcPaint.left + pWin->drawable.x,
- ps.rcPaint.top + pWin->drawable.y, SRCCOPY)) {
- LPVOID lpMsgBuf;
-
- /* Display a fancy error message */
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf, 0, NULL);
-
- ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n",
- (LPSTR) lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
+ /* Call the engine dependent repainter */
+ if (*s_pScreenPriv->pwinBltExposedWindowRegion)
+ (*s_pScreenPriv->pwinBltExposedWindowRegion) (s_pScreen, pWin);
- /* EndPaint frees the DC */
- EndPaint(hwnd, &ps);
return 0;
case WM_MOUSEMOVE:
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 0ec5246fc..9481ecb42 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -1203,6 +1203,7 @@ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
+ pScreenPriv->pwinBltExposedWindowRegion = NULL;
pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
pScreenPriv->pwinRealizeInstalledPalette
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 067dd6f8c..46be62304 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -62,6 +62,9 @@ static Bool
winBltExposedRegionsShadowGDI(ScreenPtr pScreen);
static Bool
+ winBltExposedWindowRegionShadowGDI(ScreenPtr pScreen, WindowPtr pWin);
+
+static Bool
winActivateAppShadowGDI(ScreenPtr pScreen);
static Bool
@@ -814,6 +817,60 @@ winBltExposedRegionsShadowGDI(ScreenPtr pScreen)
}
/*
+ * Blt exposed region to the given HWND
+ */
+
+static Bool
+winBltExposedWindowRegionShadowGDI(ScreenPtr pScreen, WindowPtr pWin)
+{
+ winScreenPriv(pScreen);
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin);
+
+ HWND hWnd = pWinPriv->hWnd;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+
+ hdcUpdate = BeginPaint(hWnd, &ps);
+ /* Avoid the BitBlt if the PAINTSTRUCT region is bogus */
+ if (ps.rcPaint.right == 0 && ps.rcPaint.bottom == 0 &&
+ ps.rcPaint.left == 0 && ps.rcPaint.top == 0) {
+ EndPaint(hWnd, &ps);
+ return 0;
+ }
+
+ /* Try to copy from the shadow buffer to the invalidated region */
+ /* XXX: looks like those coordinates should get transformed ??? */
+ if (!BitBlt(hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
+ ps.rcPaint.right - ps.rcPaint.left,
+ ps.rcPaint.bottom - ps.rcPaint.top,
+ pScreenPriv->hdcShadow,
+ ps.rcPaint.left + pWin->drawable.x,
+ ps.rcPaint.top + pWin->drawable.y,
+ SRCCOPY)) {
+ LPVOID lpMsgBuf;
+
+ /* Display an error message */
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf, 0, NULL);
+
+ ErrorF("winBltExposedWindowRegionShadowGDI - BitBlt failed: %s\n",
+ (LPSTR) lpMsgBuf);
+ LocalFree(lpMsgBuf);
+ }
+
+ /* EndPaint frees the DC */
+ EndPaint(hWnd, &ps);
+
+ return TRUE;
+}
+
+/*
* Do any engine-specific appliation-activation processing
*/
@@ -1160,6 +1217,7 @@ winSetEngineFunctionsShadowGDI(ScreenPtr pScreen)
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
+ pScreenPriv->pwinBltExposedWindowRegion = winBltExposedWindowRegionShadowGDI;
pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;
pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI;
pScreenPriv->pwinRealizeInstalledPalette =