winmultiwindowwindow.c [plain text]
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "win.h"
#include "dixevents.h"
#include "winmultiwindowclass.h"
void
winCreateWindowsWindow (WindowPtr pWin);
static void
winDestroyWindowsWindow (WindowPtr pWin);
static void
winUpdateWindowsWindow (WindowPtr pWin);
static void
winFindWindow (pointer value, XID id, pointer cdata);
static
void winInitMultiWindowClass(void)
{
static wATOM atomXWinClass=0;
WNDCLASSEX wcx;
if (atomXWinClass==0)
{
wcx.cbSize=sizeof(WNDCLASSEX);
wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
wcx.lpfnWndProc = winTopLevelWindowProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = g_hInstance;
wcx.hIcon = g_hIconX;
wcx.hCursor = 0;
wcx.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wcx.lpszMenuName = NULL;
wcx.lpszClassName = WINDOW_CLASS_X;
wcx.hIconSm = g_hSmallIconX;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winCreateWindowsWindow - Creating class: %s\n", WINDOW_CLASS_X);
#endif
atomXWinClass = RegisterClassEx (&wcx);
}
}
Bool
winCreateWindowMultiWindow (WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
winTrace ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(CreateWindow);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
pWinPriv->hRgn = NULL;
pWinPriv->hWnd = NULL;
pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
pWinPriv->fXKilled = FALSE;
return fResult;
}
Bool
winDestroyWindowMultiWindow (WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(DestroyWindow);
fResult = (*pScreen->DestroyWindow)(pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
pWinPriv->fXKilled = TRUE;
winDestroyWindowsWindow (pWin);
return fResult;
}
Bool
winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
{
Bool fResult = TRUE;
int iX, iY, iWidth, iHeight;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
HWND hWnd = pWinPriv->hWnd;
RECT rcNew;
RECT rcOld;
#if CYGMULTIWINDOW_DEBUG
RECT rcClient;
RECT *lpRc;
#endif
DWORD dwExStyle;
DWORD dwStyle;
#if CYGMULTIWINDOW_DEBUG
winTrace ("winPositionWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(PositionWindow);
fResult = (*pScreen->PositionWindow)(pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
#if CYGWINDOWING_DEBUG
ErrorF ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n",
x, y);
#endif
if (!hWnd)
{
#if CYGWINDOWING_DEBUG
ErrorF ("\timmediately return since hWnd is NULL\n");
#endif
return fResult;
}
dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE);
dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE);
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
#if CYGMULTIWINDOW_DEBUG
lpRc = &rcNew;
ErrorF ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n",
GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
#endif
AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
GetWindowRect (hWnd, &rcOld);
#if CYGMULTIWINDOW_DEBUG
GetClientRect (hWnd, &rcClient);
lpRc = &rcNew;
ErrorF ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
lpRc = &rcOld;
ErrorF ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
lpRc = &rcClient;
ErrorF ("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
#endif
if (!EqualRect (&rcNew, &rcOld))
{
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winPositionWindowMultiWindow - Need to move\n");
#endif
#if CYGWINDOWING_DEBUG
ErrorF ("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
#endif
MoveWindow (hWnd,
rcNew.left, rcNew.top,
rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
TRUE);
}
else
{
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winPositionWindowMultiWindow - Not need to move\n");
#endif
}
return fResult;
}
Bool
winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
#endif
WIN_UNWRAP(ChangeWindowAttributes);
fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
return fResult;
}
Bool
winUnmapWindowMultiWindow (WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
WIN_UNWRAP(UnrealizeWindow);
fResult = (*pScreen->UnrealizeWindow)(pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
pWinPriv->fXKilled = TRUE;
winDestroyWindowsWindow (pWin);
return fResult;
}
Bool
winMapWindowMultiWindow (WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
#endif
WIN_UNWRAP(RealizeWindow);
fResult = (*pScreen->RealizeWindow)(pWin);
WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
pWinPriv->fXKilled = FALSE;
winUpdateWindowsWindow (pWin);
winReshapeMultiWindow (pWin);
winUpdateRgnMultiWindow (pWin);
return fResult;
}
void
winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winReparentMultiWindow - pWin: %08x\n", pWin);
#endif
WIN_UNWRAP(ReparentWindow);
if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow)(pWin, pPriorParent);
WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
winUpdateWindowsWindow (pWin);
}
void
winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
{
#if 0
WindowPtr pPrevWin;
UINT uFlags;
HWND hInsertAfter;
HWND hWnd = NULL;
#endif
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
winTrace ("winRestackMultiWindow - %08x\n", pWin);
#endif
WIN_UNWRAP(RestackWindow);
if (pScreen->RestackWindow)
(*pScreen->RestackWindow)(pWin, pOldNextSib);
WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
#if 1
if (pWin->nextSib != pOldNextSib)
winReorderWindowsMultiWindow ();
#else
if (!pWinPriv || !pWinPriv->hWnd)
return;
pPrevWin = pWin->prevSib;
while (pPrevWin
&& !winGetWindowPriv(pPrevWin)
&& !winGetWindowPriv(pPrevWin)->hWnd)
pPrevWin = pPrevWin->prevSib;
if (pPrevWin)
{
hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd;
uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
hWnd = GetNextWindow (pWinPriv->hWnd, GW_HWNDPREV);
do
{
if (GetProp (hWnd, WIN_WINDOW_PROP))
{
if (hWnd == winGetWindowPriv(pPrevWin)->hWnd)
{
uFlags |= SWP_NOZORDER;
}
break;
}
hWnd = GetNextWindow (hWnd, GW_HWNDPREV);
}
while (hWnd);
}
else
{
hInsertAfter = HWND_TOP;
uFlags = SWP_NOMOVE | SWP_NOSIZE;
}
SetWindowPos (pWinPriv->hWnd,
hInsertAfter,
0, 0,
0, 0,
uFlags);
#endif
}
void
winCreateWindowsWindow (WindowPtr pWin)
{
int iX, iY;
int iWidth;
int iHeight;
HWND hWnd;
HWND hFore = NULL;
winWindowPriv(pWin);
HICON hIcon;
HICON hIconSmall;
winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
WinXSizeHints hints;
WindowPtr pDaddy;
winInitMultiWindowClass();
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
#endif
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
iX = CW_USEDEFAULT;
if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
iY = CW_USEDEFAULT;
if (winMultiWindowGetTransientFor (pWin, &pDaddy))
{
if (pDaddy)
{
hFore = GetForegroundWindow();
if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL;
}
}
else
{
if (!winMultiWindowGetWMNormalHints(pWin, &hints))
hints.flags = 0;
if (!(hints.flags & (USPosition|PPosition)) &&
!pWin->overrideRedirect)
{
iX = CW_USEDEFAULT;
iY = CW_USEDEFAULT;
}
}
hWnd = CreateWindowExA (WS_EX_TOOLWINDOW,
WINDOW_CLASS_X,
WINDOW_TITLE_X,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
iX,
iY,
iWidth,
iHeight,
hFore,
(HMENU) NULL,
GetModuleHandle (NULL),
pWin);
if (hWnd == NULL)
{
ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
(int) GetLastError ());
}
pWinPriv->hWnd = hWnd;
winSelectIcons(pWin, &hIcon, &hIconSmall);
if (hIcon) SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
if (hIconSmall) SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowPos (hWnd, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
GetSystemMenu (hWnd, TRUE);
PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0);
SetProp (hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
SetProp (hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
(*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
}
Bool winInDestroyWindowsWindow = FALSE;
static void
winDestroyWindowsWindow (WindowPtr pWin)
{
MSG msg;
winWindowPriv(pWin);
BOOL oldstate = winInDestroyWindowsWindow;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winDestroyWindowsWindow\n");
#endif
if (pWinPriv->hWnd == NULL)
return;
winInDestroyWindowsWindow = TRUE;
SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
DestroyWindow (pWinPriv->hWnd);
pWinPriv->hWnd = NULL;
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg))
{
DispatchMessage (&msg);
}
}
winInDestroyWindowsWindow = oldstate;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("-winDestroyWindowsWindow\n");
#endif
}
static void
winUpdateWindowsWindow (WindowPtr pWin)
{
winWindowPriv(pWin);
HWND hWnd = pWinPriv->hWnd;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winUpdateWindowsWindow\n");
#endif
if (pWin->parent != NULL
&& pWin->parent->parent == NULL
&& pWin->mapped)
{
if (hWnd == NULL)
{
winCreateWindowsWindow (pWin);
assert (pWinPriv->hWnd != NULL);
}
ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
UpdateWindow (pWinPriv->hWnd);
}
else if (hWnd != NULL)
{
winDestroyWindowsWindow (pWin);
assert (pWinPriv->hWnd == NULL);
}
#if CYGMULTIWINDOW_DEBUG
ErrorF ("-winUpdateWindowsWindow\n");
#endif
}
XID
winGetWindowID (WindowPtr pWin)
{
WindowIDPairRec wi = {pWin, 0};
ClientPtr c = wClient(pWin);
FindClientResourcesByType (c, RT_WINDOW, winFindWindow, &wi);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winGetWindowID - Window ID: %d\n", wi.id);
#endif
return wi.id;
}
static void
winFindWindow (pointer value, XID id, pointer cdata)
{
WindowIDPairPtr wi = (WindowIDPairPtr)cdata;
if (value == wi->value)
{
wi->id = id;
}
}
void
winReorderWindowsMultiWindow (void)
{
HWND hwnd = NULL;
WindowPtr pWin = NULL;
WindowPtr pWinSib = NULL;
XID vlist[2];
static Bool fRestacking = FALSE;
DWORD dwCurrentProcessID = GetCurrentProcessId ();
DWORD dwWindowProcessID = 0;
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
winTrace ("winReorderWindowsMultiWindow\n");
#endif
if (fRestacking)
{
#if CYGWINDOWING_DEBUG
ErrorF ("winReorderWindowsMultiWindow - "
"exit because fRestacking == TRUE\n");
#endif
return;
}
fRestacking = TRUE;
for ( hwnd = GetTopWindow (NULL);
hwnd;
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
{
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
if ( GetProp (hwnd, WIN_WINDOW_PROP)
&& (dwWindowProcessID == dwCurrentProcessID)
&& !IsIconic (hwnd) )
{
pWinSib = pWin;
pWin = GetProp (hwnd, WIN_WINDOW_PROP);
if (!pWinSib)
{
vlist[0] = Above;
ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
}
else
{
vlist[0] = winGetWindowID (pWinSib);
vlist[1] = Below;
ConfigureWindow (pWin, CWSibling | CWStackMode,
vlist, wClient(pWin));
}
}
}
fRestacking = FALSE;
}
void
winMinimizeWindow (Window id)
{
WindowPtr pWin;
winPrivWinPtr pWinPriv;
#ifdef XWIN_MULTIWINDOWEXTWM
win32RootlessWindowPtr pRLWinPriv;
#endif
HWND hWnd;
ScreenPtr pScreen = NULL;
winPrivScreenPtr pScreenPriv = NULL;
winScreenInfo *pScreenInfo = NULL;
#if CYGWINDOWING_DEBUG
ErrorF ("winMinimizeWindow\n");
#endif
dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
if (!pWin)
{
ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
return;
}
pScreen = pWin->drawable.pScreen;
if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
#ifdef XWIN_MULTIWINDOWEXTWM
if (pScreenPriv && pScreenInfo->fInternalWM)
{
pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
hWnd = pRLWinPriv->hWnd;
}
else
#else
if (pScreenPriv)
#endif
{
pWinPriv = winGetWindowPriv (pWin);
hWnd = pWinPriv->hWnd;
}
ShowWindow (hWnd, SW_MINIMIZE);
}
void
winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
RegionPtr oldRegion)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
ErrorF ("CopyWindowMultiWindow\n");
#endif
WIN_UNWRAP(CopyWindow);
(*pScreen->CopyWindow)(pWin, oldpt, oldRegion);
WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
}
void
winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
WindowPtr pSib, VTKind kind)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
ErrorF ("MoveWindowMultiWindow to (%d, %d)\n", x, y);
#endif
WIN_UNWRAP(MoveWindow);
(*pScreen->MoveWindow)(pWin, x, y, pSib, kind);
WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
}
void
winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
unsigned int h, WindowPtr pSib)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if CYGWINDOWING_DEBUG
ErrorF ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
#endif
WIN_UNWRAP(ResizeWindow);
(*pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
}
int
winAdjustXWindow (WindowPtr pWin, HWND hwnd)
{
RECT rcDraw;
RECT rcWin;
DrawablePtr pDraw;
XID vlist[4];
LONG dX, dY, dW, dH, x, y;
DWORD dwStyle, dwExStyle;
#define WIDTH(rc) (rc.right - rc.left)
#define HEIGHT(rc) (rc.bottom - rc.top)
#if CYGWINDOWING_DEBUG
ErrorF ("winAdjustXWindow\n");
#endif
if (IsIconic (hwnd))
{
#if CYGWINDOWING_DEBUG
ErrorF ("\timmediately return because the window is iconized\n");
#endif
vlist[0] = 0;
vlist[1] = 0;
return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
}
pDraw = &pWin->drawable;
x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
#endif
AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
GetWindowRect (hwnd, &rcWin);
#ifdef CYGMULTIWINDOW_DEBUG
winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
#endif
if (EqualRect (&rcDraw, &rcWin)) {
#if CYGWINDOWING_DEBUG
ErrorF ("\treturn because already adjusted\n");
#endif
return 0;
}
dX = rcWin.left - rcDraw.left;
dY = rcWin.top - rcDraw.top;
dW = WIDTH(rcWin) - WIDTH(rcDraw);
dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
vlist[2] = pDraw->width + dW;
vlist[3] = pDraw->height + dH;
#if CYGWINDOWING_DEBUG
ErrorF ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
vlist[2], vlist[3]);
#endif
return ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight,
vlist, wClient(pWin));
#undef WIDTH
#undef HEIGHT
}