diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index d076c005c..531da39a1 100755 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -540,12 +540,32 @@ void winWin32RootlessReshapeFrame (RootlessFrameID wid, RegionPtr pShape) { win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid; - HRGN hRgn; + HRGN hRgn, hRgnWindow, hRgnClient; + RECT rcWindow, rcClient; + POINT ptOffset; #if CYGMULTIWINDOW_DEBUG ErrorF ("winWin32RootlessReshapeFrame (%08x)\n", (int) pRLWinPriv); #endif + hRgn = winWin32RootlessCreateRgnFromRegion (pShape); + + /* Create region for non-client area */ + GetWindowRect (pRLWinPriv->hWnd, &rcWindow); + GetClientRect (pRLWinPriv->hWnd, &rcClient); + MapWindowPoints (pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2); + OffsetRgn (hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top); + OffsetRect (&rcClient, -rcWindow.left, -rcWindow.top); + OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); + hRgnWindow = CreateRectRgnIndirect (&rcWindow); + hRgnClient = CreateRectRgnIndirect (&rcClient); + CombineRgn (hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF); + CombineRgn (hRgn, hRgnWindow, hRgn, RGN_OR); + + SetWindowRgn (pRLWinPriv->hWnd, hRgn, TRUE); + + DeleteObject (hRgnWindow); + DeleteObject (hRgnClient); } void diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index b52118b27..82fb078f6 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -440,6 +440,8 @@ ProcWindowsWMFrameDraw (register ClientPtr client) win32RootlessWindowPtr pRLWinPriv; RECT rcNew; WINDOWPLACEMENT wndpl; + RegionRec newShape; + ScreenPtr pScreen; REQUEST_SIZE_MATCH (xWindowsWMFrameDrawReq); @@ -506,6 +508,18 @@ ProcWindowsWMFrameDraw (register ClientPtr client) winWin32RootlessUpdateIcon (pWin->drawable.id); + if (wBoundingShape(pWin) != NULL) + { + pScreen = pWin->drawable.pScreen; + /* wBoundingShape is relative to *inner* origin of window. + Translate by borderWidth to get the outside-relative position. */ + + REGION_NULL(pScreen, &newShape); + REGION_COPY(pScreen, &newShape, wBoundingShape(pWin)); + REGION_TRANSLATE(pScreen, &newShape, pWin->borderWidth, pWin->borderWidth); + winWin32RootlessReshapeFrame (pRLWinPriv, &newShape); + REGION_UNINIT(pScreen, &newShape); + } #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameDraw - done\n"); #endif